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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.57      minskim     4:   "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
1.57      minskim    18:   <div class="book" lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.57      minskim    22:           <h1 class="title"><a name="the-pkgsrc-guide"></a>The
                     23:           pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
1.48      dillo      64:           <p class="copyright">Copyright &#169; 1994-2005 The
1.1       grant      65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.48      dillo      69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.10
                     70:           2005/10/05 13:59:56 dillo Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
1.51      rillig     91:         <dt><span class="chapter"><a href="#introduction">1. What
                     92:         is pkgsrc?</a></span></dt>
1.1       grant      93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.46      gdt       111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
                    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=
1.47      reed      142:                 "#platform-specific-notes">3.2. Platform-specific
1.30      wiz       143:                 notes</a></span></dt>
1.1       grant     144: 
                    145:                 <dd>
                    146:                   <dl>
                    147:                     <dt><span class="sect2"><a href=
1.30      wiz       148:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     149:                     X)</a></span></dt>
                    150: 
                    151:                     <dt><span class="sect2"><a href=
1.30      wiz       152:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.30      wiz       155:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     156: 
1.30      wiz       157:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    158:                     IRIX</a></span></dt>
1.1       grant     159: 
1.30      wiz       160:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    161:                     Linux</a></span></dt>
1.1       grant     162: 
                    163:                     <dt><span class="sect2"><a href=
1.30      wiz       164:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        165: 
                    166:                     <dt><span class="sect2"><a href=
1.30      wiz       167:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     168:                   </dl>
                    169:                 </dd>
                    170:               </dl>
                    171:             </dd>
                    172: 
                    173:             <dt><span class="chapter"><a href="#using">4. Using
                    174:             pkgsrc</a></span></dt>
                    175: 
                    176:             <dd>
                    177:               <dl>
                    178:                 <dt><span class="sect1"><a href=
                    179:                 "#getting-started">4.1. Working with binary
                    180:                 packages</a></span></dt>
                    181: 
                    182:                 <dd>
                    183:                   <dl>
                    184:                     <dt><span class="sect2"><a href=
1.30      wiz       185:                     "#where-to-get-binary-packages">4.1.1. Where to
                    186:                     get binary packages</a></span></dt>
1.1       grant     187: 
                    188:                     <dt><span class="sect2"><a href=
1.30      wiz       189:                     "#how-to-use-binary-packages">4.1.2. How to use
                    190:                     binary packages</a></span></dt>
1.1       grant     191: 
                    192:                     <dt><span class="sect2"><a href=
1.30      wiz       193:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     194:                     warning</a></span></dt>
                    195:                   </dl>
                    196:                 </dd>
                    197: 
1.30      wiz       198:                 <dt><span class="sect1"><a href=
                    199:                 "#building-packages-from-source">4.2. Building
                    200:                 packages from source</a></span></dt>
1.1       grant     201: 
                    202:                 <dd>
                    203:                   <dl>
                    204:                     <dt><span class="sect2"><a href=
1.30      wiz       205:                     "#requirements">4.2.1.
1.1       grant     206:                     Requirements</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.30      wiz       209:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     210:                     distfiles</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.30      wiz       213:                     "#how-to-build-and-install">4.2.3. How to build
                    214:                     and install</a></span></dt>
1.1       grant     215: 
                    216:                     <dt><span class="sect2"><a href=
1.30      wiz       217:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     218:                     compiler</a></span></dt>
                    219:                   </dl>
                    220:                 </dd>
                    221:               </dl>
                    222:             </dd>
                    223: 
1.38      dillo     224:             <dt><span class="chapter"><a href="#configuring">5.
                    225:             Configuring pkgsrc</a></span></dt>
                    226: 
                    227:             <dd>
                    228:               <dl>
                    229:                 <dt><span class="sect1"><a href=
1.45      wiz       230:                 "#general-configuration">5.1. General
                    231:                 configuration</a></span></dt>
                    232: 
                    233:                 <dt><span class="sect1"><a href=
                    234:                 "#variables-affecting-build">5.2. Variables
                    235:                 affecting the build process</a></span></dt>
                    236: 
                    237:                 <dt><span class="sect1"><a href=
                    238:                 "#developer-advanced-settings">5.3.
                    239:                 Developer/advanced settings</a></span></dt>
                    240: 
                    241:                 <dt><span class="sect1"><a href=
                    242:                 "#selecting-build-options">5.4. Selecting Build
1.42      dillo     243:                 Options</a></span></dt>
1.38      dillo     244:               </dl>
                    245:             </dd>
                    246: 
                    247:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     248:             binary packages</a></span></dt>
                    249: 
                    250:             <dd>
                    251:               <dl>
1.30      wiz       252:                 <dt><span class="sect1"><a href=
1.38      dillo     253:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       254:                 single binary package</a></span></dt>
1.1       grant     255: 
1.30      wiz       256:                 <dt><span class="sect1"><a href=
1.38      dillo     257:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     258:                 Settings for creation of binary
                    259:                 packages</a></span></dt>
                    260: 
1.38      dillo     261:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     262:                 Doing a bulk build of all packages</a></span></dt>
                    263: 
                    264:                 <dd>
                    265:                   <dl>
                    266:                     <dt><span class="sect2"><a href=
1.38      dillo     267:                     "#binary.configuration">6.3.1.
1.1       grant     268:                     Configuration</a></span></dt>
                    269: 
                    270:                     <dt><span class="sect2"><a href=
1.38      dillo     271:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       272:                     Other environmental
1.1       grant     273:                     considerations</a></span></dt>
                    274: 
                    275:                     <dt><span class="sect2"><a href=
1.38      dillo     276:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     277: 
                    278:                     <dt><span class="sect2"><a href=
1.38      dillo     279:                     "#what-it-does">6.3.4. What it
1.1       grant     280:                     does</a></span></dt>
                    281: 
                    282:                     <dt><span class="sect2"><a href=
1.38      dillo     283:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     284:                     requirements</a></span></dt>
                    285: 
                    286:                     <dt><span class="sect2"><a href=
1.38      dillo     287:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed      288:                     sandbox for chrooted builds</a></span></dt>
1.1       grant     289: 
                    290:                     <dt><span class="sect2"><a href=
1.38      dillo     291:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       292:                     partial set of packages</a></span></dt>
1.13      hubertf   293: 
                    294:                     <dt><span class="sect2"><a href=
1.38      dillo     295:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   296:                     bulk build</a></span></dt>
1.1       grant     297:                   </dl>
                    298:                 </dd>
                    299: 
1.30      wiz       300:                 <dt><span class="sect1"><a href=
1.38      dillo     301:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       302:                 packages collection</a></span></dt>
1.1       grant     303: 
                    304:                 <dd>
                    305:                   <dl>
                    306:                     <dt><span class="sect2"><a href=
1.38      dillo     307:                     "#cdpack-example">6.4.1. Example of
1.1       grant     308:                     cdpack</a></span></dt>
                    309:                   </dl>
                    310:                 </dd>
                    311:               </dl>
                    312:             </dd>
                    313: 
1.38      dillo     314:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     315:             Asked Questions</a></span></dt>
                    316: 
                    317:             <dd>
                    318:               <dl>
1.30      wiz       319:                 <dt><span class="sect1"><a href=
1.38      dillo     320:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       321:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     322: 
1.30      wiz       323:                 <dt><span class="sect1"><a href=
1.38      dillo     324:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       325:                 documentation?</a></span></dt>
1.1       grant     326: 
1.5       hubertf   327:                 <dt><span class="sect1"><a href=
1.38      dillo     328:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   329:                 management (pkgtools)</a></span></dt>
1.1       grant     330: 
1.30      wiz       331:                 <dt><span class="sect1"><a href=
1.38      dillo     332:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       333:                 non-root</a></span></dt>
                    334: 
                    335:                 <dt><span class="sect1"><a href=
1.38      dillo     336:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       337:                 when fetching distfiles?</a></span></dt>
                    338: 
                    339:                 <dt><span class="sect1"><a href=
1.38      dillo     340:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       341:                 XFree86 from pkgsrc?</a></span></dt>
                    342: 
                    343:                 <dt><span class="sect1"><a href=
1.38      dillo     344:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       345:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     346: 
1.30      wiz       347:                 <dt><span class="sect1"><a href=
1.38      dillo     348:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       349:                 from behind a firewall</a></span></dt>
1.1       grant     350: 
1.38      dillo     351:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   352:                 How do I tell <span><strong class="command">make
                    353:                 fetch</strong></span> to do passive
1.1       grant     354:                 FTP?</a></span></dt>
                    355: 
1.30      wiz       356:                 <dt><span class="sect1"><a href=
1.38      dillo     357:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       358:                 distfiles at once</a></span></dt>
1.1       grant     359: 
1.30      wiz       360:                 <dt><span class="sect1"><a href=
1.38      dillo     361:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       362:                 &#8220;<span class="quote">Don't know how to make
                    363:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   364:                 mean?</a></span></dt>
1.13      hubertf   365: 
1.30      wiz       366:                 <dt><span class="sect1"><a href=
1.38      dillo     367:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       368:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   369:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     370: 
1.30      wiz       371:                 <dt><span class="sect1"><a href=
1.38      dillo     372:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       373:                 pkgsrc</a></span></dt>
1.1       grant     374: 
1.38      dillo     375:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      376:                 How do I change the location of configuration
                    377:                 files?</a></span></dt>
1.1       grant     378: 
                    379:                 <dt><span class="sect1"><a href=
1.38      dillo     380:                 "#audit-packages">7.15. Automated security
1.1       grant     381:                 checks</a></span></dt>
                    382:               </dl>
                    383:             </dd>
                    384:           </dl>
                    385:         </dd>
                    386: 
1.46      gdt       387:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     388:         pkgsrc developer's guide</a></span></dt>
                    389: 
                    390:         <dd>
                    391:           <dl>
1.38      dillo     392:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    393:             Package components - files, directories and
                    394:             contents</a></span></dt>
                    395: 
                    396:             <dd>
                    397:               <dl>
                    398:                 <dt><span class="sect1"><a href=
1.45      wiz       399:                 "#components.Makefile">8.1. <code xmlns=
                    400:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    401:                 "filename">Makefile</code></a></span></dt>
                    402: 
                    403:                 <dt><span class="sect1"><a href=
1.45      wiz       404:                 "#components.distinfo">8.2. <code xmlns=
                    405:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    406:                 "filename">distinfo</code></a></span></dt>
                    407: 
                    408:                 <dt><span class="sect1"><a href=
1.38      dillo     409:                 "#components.patches">8.3.
1.27      rillig    410:                 patches/*</a></span></dt>
                    411: 
1.30      wiz       412:                 <dt><span class="sect1"><a href=
1.38      dillo     413:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       414:                 files</a></span></dt>
1.27      rillig    415: 
                    416:                 <dt><span class="sect1"><a href=
1.38      dillo     417:                 "#components.optional">8.5. Optional
1.27      rillig    418:                 files</a></span></dt>
                    419: 
1.38      dillo     420:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz       421:                 <code xmlns=
                    422:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    423:                 "filename">work*</code></a></span></dt>
1.27      rillig    424: 
1.38      dillo     425:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz       426:                 <code xmlns=
                    427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    428:                 "filename">files/*</code></a></span></dt>
                    429:               </dl>
                    430:             </dd>
                    431: 
1.38      dillo     432:             <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz       433:             Programming in <code xmlns=
                    434:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    435:             "filename">Makefile</code>s</a></span></dt>
                    436: 
                    437:             <dd>
                    438:               <dl>
                    439:                 <dt><span class="sect1"><a href=
1.45      wiz       440:                 "#makefile.variables">9.1. <code xmlns=
                    441:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    442:                 "filename">Makefile</code>
                    443:                 variables</a></span></dt>
                    444: 
1.27      rillig    445:                 <dd>
                    446:                   <dl>
                    447:                     <dt><span class="sect2"><a href=
1.38      dillo     448:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    449:                     conventions</a></span></dt>
                    450:                   </dl>
                    451:                 </dd>
                    452: 
1.25      rillig    453:                 <dt><span class="sect1"><a href=
1.38      dillo     454:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    455: 
                    456:                 <dd>
                    457:                   <dl>
                    458:                     <dt><span class="sect2"><a href=
1.38      dillo     459:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    460:                     list</a></span></dt>
                    461: 
                    462:                     <dt><span class="sect2"><a href=
1.38      dillo     463:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       464:                     Converting an internal list into an external
                    465:                     list</a></span></dt>
1.25      rillig    466: 
                    467:                     <dt><span class="sect2"><a href=
1.38      dillo     468:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       469:                     variables to a shell command</a></span></dt>
1.27      rillig    470: 
                    471:                     <dt><span class="sect2"><a href=
1.38      dillo     472:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    473:                     guideline</a></span></dt>
                    474: 
                    475:                     <dt><span class="sect2"><a href=
1.38      dillo     476:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       477:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    478:                   </dl>
                    479:                 </dd>
                    480:               </dl>
                    481:             </dd>
                    482: 
1.38      dillo     483:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     484:             issues</a></span></dt>
                    485: 
                    486:             <dd>
                    487:               <dl>
1.38      dillo     488:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       489:                 ID</a></span></dt>
1.1       grant     490: 
1.30      wiz       491:                 <dt><span class="sect1"><a href=
1.38      dillo     492:                 "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz       493:                 <code xmlns=
                    494:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    495:                 "filename">PLIST</code> generation</a></span></dt>
1.1       grant     496: 
1.38      dillo     497:                 <dt><span class="sect1"><a href=
                    498:                 "#print-PLIST">10.3. Tweaking output of
                    499:                 <span><strong class="command">make
1.14      xtraeme   500:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     501: 
1.38      dillo     502:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     503:                 Variable substitution in PLIST</a></span></dt>
                    504: 
1.30      wiz       505:                 <dt><span class="sect1"><a href=
1.48      dillo     506:                 "#manpage-compression">10.5. Man page
                    507:                 compression</a></span></dt>
1.1       grant     508: 
1.30      wiz       509:                 <dt><span class="sect1"><a href=
1.38      dillo     510:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       511:                 <code class=
1.14      xtraeme   512:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     513: 
1.30      wiz       514:                 <dt><span class="sect1"><a href=
1.47      reed      515:                 "#platform-specific-plist">10.7. Platform-specific
1.30      wiz       516:                 and differing PLISTs</a></span></dt>
1.1       grant     517: 
                    518:                 <dt><span class="sect1"><a href=
1.38      dillo     519:                 "#faq.common-dirs">10.8. Sharing directories
                    520:                 between packages</a></span></dt>
1.1       grant     521:               </dl>
                    522:             </dd>
                    523: 
1.38      dillo     524:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     525:             Buildlink methodology</a></span></dt>
                    526: 
                    527:             <dd>
                    528:               <dl>
1.30      wiz       529:                 <dt><span class="sect1"><a href=
1.38      dillo     530:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       531:                 packages to use buildlink3</a></span></dt>
1.1       grant     532: 
1.30      wiz       533:                 <dt><span class="sect1"><a href=
1.38      dillo     534:                 "#creating-buildlink3.mk">11.2. Writing
1.45      wiz       535:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                    536:                 class="filename">buildlink3.mk</code>
1.14      xtraeme   537:                 files</a></span></dt>
1.1       grant     538: 
                    539:                 <dd>
                    540:                   <dl>
                    541:                     <dt><span class="sect2"><a href=
1.38      dillo     542:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       543:                     buildlink3.mk file</a></span></dt>
1.1       grant     544: 
                    545:                     <dt><span class="sect2"><a href=
1.38      dillo     546:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       547:                     <code class=
1.14      xtraeme   548:                     "varname">BUILDLINK_DEPENDS.<em class=
                    549:                     "replaceable"><code>pkg</code></em></code> in
1.45      wiz       550:                     <code xmlns=
                    551:                     "http://www.w3.org/TR/xhtml1/transitional"
                    552:                     class="filename">buildlink3.mk</code>
1.1       grant     553:                     files</a></span></dt>
                    554:                   </dl>
                    555:                 </dd>
                    556: 
1.30      wiz       557:                 <dt><span class="sect1"><a href=
1.45      wiz       558:                 "#writing-builtin.mk">11.3. Writing <code xmlns=
                    559:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz       560:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     561: 
                    562:                 <dd>
                    563:                   <dl>
                    564:                     <dt><span class="sect2"><a href=
1.38      dillo     565:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz       566:                     <code xmlns=
                    567:                     "http://www.w3.org/TR/xhtml1/transitional"
                    568:                     class="filename">builtin.mk</code>
1.1       grant     569:                     file</a></span></dt>
                    570: 
                    571:                     <dt><span class="sect2"><a href=
1.38      dillo     572:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       573:                     preferences for native or pkgsrc
                    574:                     software</a></span></dt>
1.1       grant     575:                   </dl>
                    576:                 </dd>
                    577:               </dl>
                    578:             </dd>
                    579: 
1.38      dillo     580:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      581:             pkginstall framework</a></span></dt>
                    582: 
                    583:             <dd>
                    584:               <dl>
                    585:                 <dt><span class="sect1"><a href=
1.38      dillo     586:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      587:                 directories outside the installation
                    588:                 prefix</a></span></dt>
                    589: 
                    590:                 <dd>
                    591:                   <dl>
                    592:                     <dt><span class="sect2"><a href=
1.38      dillo     593:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      594:                     manipulation</a></span></dt>
                    595: 
                    596:                     <dt><span class="sect2"><a href=
1.38      dillo     597:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      598:                     manipulation</a></span></dt>
                    599:                   </dl>
                    600:                 </dd>
                    601: 
1.38      dillo     602:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      603:                 Configuration files</a></span></dt>
                    604: 
                    605:                 <dd>
                    606:                   <dl>
                    607:                     <dt><span class="sect2"><a href=
1.38      dillo     608:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      609:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    610:                     set</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.38      dillo     613:                     "#conf-files-configure">12.2.2. Telling the
1.47      reed      614:                     software where configuration files
1.35      jmmv      615:                     are</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.38      dillo     618:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      619:                     installations</a></span></dt>
                    620: 
                    621:                     <dt><span class="sect2"><a href=
1.38      dillo     622:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      623:                     handling of configuration files</a></span></dt>
                    624:                   </dl>
                    625:                 </dd>
                    626: 
                    627:                 <dt><span class="sect1"><a href=
1.38      dillo     628:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      629:                 scripts</a></span></dt>
                    630: 
                    631:                 <dd>
                    632:                   <dl>
                    633:                     <dt><span class="sect2"><a href=
1.38      dillo     634:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      635:                     handling of system startup
                    636:                     scripts</a></span></dt>
                    637:                   </dl>
                    638:                 </dd>
                    639: 
                    640:                 <dt><span class="sect1"><a href=
1.38      dillo     641:                 "#users-and-groups">12.4. System users and
1.35      jmmv      642:                 groups</a></span></dt>
                    643: 
1.38      dillo     644:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      645:                 System shells</a></span></dt>
                    646: 
                    647:                 <dd>
                    648:                   <dl>
                    649:                     <dt><span class="sect2"><a href=
1.38      dillo     650:                     "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv      651:                     configuration files</a></span></dt>
                    652:                   </dl>
                    653:                 </dd>
                    654:               </dl>
                    655:             </dd>
                    656: 
1.38      dillo     657:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     658:             Options handling</a></span></dt>
                    659: 
                    660:             <dd>
                    661:               <dl>
1.30      wiz       662:                 <dt><span class="sect1"><a href=
1.38      dillo     663:                 "#global-default-options">13.1. Global default
1.30      wiz       664:                 options</a></span></dt>
1.1       grant     665: 
1.30      wiz       666:                 <dt><span class="sect1"><a href=
1.38      dillo     667:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       668:                 to use <code xmlns=
                    669:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   670:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     671: 
                    672:                 <dt><span class="sect1"><a href=
                    673:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     674:               </dl>
                    675:             </dd>
                    676: 
1.38      dillo     677:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     678:             build process</a></span></dt>
                    679: 
                    680:             <dd>
                    681:               <dl>
                    682:                 <dt><span class="sect1"><a href=
1.56      rillig    683:                 "#build.intro">14.1. Introduction</a></span></dt>
                    684: 
                    685:                 <dt><span class="sect1"><a href=
                    686:                 "#build.prefix">14.2. Program
1.1       grant     687:                 location</a></span></dt>
                    688: 
1.30      wiz       689:                 <dt><span class="sect1"><a href=
1.56      rillig    690:                 "#build.builddirs">14.3. Directories used during
                    691:                 the build process</a></span></dt>
                    692: 
                    693:                 <dt><span class="sect1"><a href=
                    694:                 "#build.running">14.4. Running a
                    695:                 phase</a></span></dt>
                    696: 
                    697:                 <dt><span class="sect1"><a href=
                    698:                 "#build.fetch">14.5. The <span class=
                    699:                 "emphasis"><em>fetch</em></span>
                    700:                 phase</a></span></dt>
                    701: 
                    702:                 <dt><span class="sect1"><a href=
                    703:                 "#build.checksum">14.6. The <span class=
                    704:                 "emphasis"><em>checksum</em></span>
                    705:                 phase</a></span></dt>
                    706: 
                    707:                 <dt><span class="sect1"><a href=
                    708:                 "#build.extract">14.7. The <span class=
                    709:                 "emphasis"><em>extract</em></span>
                    710:                 phase</a></span></dt>
                    711: 
                    712:                 <dt><span class="sect1"><a href=
                    713:                 "#build.patch">14.8. The <span class=
                    714:                 "emphasis"><em>patch</em></span>
                    715:                 phase</a></span></dt>
                    716: 
                    717:                 <dt><span class="sect1"><a href=
                    718:                 "#build.tools">14.9. The <span class=
                    719:                 "emphasis"><em>tools</em></span>
                    720:                 phase</a></span></dt>
                    721: 
                    722:                 <dt><span class="sect1"><a href=
                    723:                 "#build.wrapper">14.10. The <span class=
                    724:                 "emphasis"><em>wrapper</em></span>
                    725:                 phase</a></span></dt>
                    726: 
                    727:                 <dt><span class="sect1"><a href=
                    728:                 "#build.configure">14.11. The <span class=
                    729:                 "emphasis"><em>configure</em></span>
                    730:                 phase</a></span></dt>
                    731: 
                    732:                 <dt><span class="sect1"><a href=
                    733:                 "#build.build">14.12. The <span class=
                    734:                 "emphasis"><em>build</em></span>
                    735:                 phase</a></span></dt>
                    736: 
                    737:                 <dt><span class="sect1"><a href=
                    738:                 "#build.test">14.13. The <span class=
                    739:                 "emphasis"><em>test</em></span>
                    740:                 phase</a></span></dt>
                    741: 
                    742:                 <dt><span class="sect1"><a href=
                    743:                 "#build.install">14.14. The <span class=
                    744:                 "emphasis"><em>install</em></span>
                    745:                 phase</a></span></dt>
1.1       grant     746: 
                    747:                 <dt><span class="sect1"><a href=
1.56      rillig    748:                 "#build.package">14.15. The <span class=
                    749:                 "emphasis"><em>package</em></span>
                    750:                 phase</a></span></dt>
                    751: 
                    752:                 <dt><span class="sect1"><a href=
                    753:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     754:                 targets</a></span></dt>
                    755:               </dl>
                    756:             </dd>
                    757: 
1.55      rillig    758:             <dt><span class="chapter"><a href="#fixes">15. Making
                    759:             your package work</a></span></dt>
1.1       grant     760: 
                    761:             <dd>
                    762:               <dl>
1.30      wiz       763:                 <dt><span class="sect1"><a href=
1.38      dillo     764:                 "#general-operation">15.1. General
1.30      wiz       765:                 operation</a></span></dt>
1.1       grant     766: 
                    767:                 <dd>
                    768:                   <dl>
                    769:                     <dt><span class="sect2"><a href=
1.38      dillo     770:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       771:                     pull in variables from
                    772:                     /etc/mk.conf</a></span></dt>
1.1       grant     773: 
                    774:                     <dt><span class="sect2"><a href=
1.38      dillo     775:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       776:                     to install documentation</a></span></dt>
                    777: 
                    778:                     <dt><span class="sect2"><a href=
1.38      dillo     779:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     780:                     packages</a></span></dt>
                    781: 
                    782:                     <dt><span class="sect2"><a href=
1.38      dillo     783:                     "#dependencies">15.1.4. Handling
1.1       grant     784:                     dependencies</a></span></dt>
                    785: 
                    786:                     <dt><span class="sect2"><a href=
1.38      dillo     787:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     788:                     other packages</a></span></dt>
                    789: 
                    790:                     <dt><span class="sect2"><a href=
1.38      dillo     791:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       792:                     cannot or should not be built</a></span></dt>
1.1       grant     793: 
                    794:                     <dt><span class="sect2"><a href=
1.38      dillo     795:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       796:                     should not be deleted, once
                    797:                     installed</a></span></dt>
1.1       grant     798: 
                    799:                     <dt><span class="sect2"><a href=
1.38      dillo     800:                     "#security-handling">15.1.8. Handling packages
1.1       grant     801:                     with security problems</a></span></dt>
                    802: 
                    803:                     <dt><span class="sect2"><a href=
1.38      dillo     804:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     805:                     bugs</a></span></dt>
                    806: 
                    807:                     <dt><span class="sect2"><a href=
1.38      dillo     808:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       809:                     incrementing versions when fixing an existing
1.1       grant     810:                     package</a></span></dt>
                    811: 
                    812:                     <dt><span class="sect2"><a href=
1.38      dillo     813:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       814:                     of packages</a></span></dt>
1.1       grant     815:                   </dl>
                    816:                 </dd>
                    817: 
1.30      wiz       818:                 <dt><span class="sect1"><a href=
1.38      dillo     819:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       820:                 issues</a></span></dt>
1.1       grant     821: 
                    822:                 <dd>
                    823:                   <dl>
                    824:                     <dt><span class="sect2"><a href=
1.38      dillo     825:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       826:                     distfiles aren't available for plain
1.1       grant     827:                     downloading</a></span></dt>
                    828: 
                    829:                     <dt><span class="sect2"><a href=
1.38      dillo     830:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       831:                     handle modified distfiles with the 'old'
                    832:                     name</a></span></dt>
1.1       grant     833:                   </dl>
                    834:                 </dd>
                    835: 
1.30      wiz       836:                 <dt><span class="sect1"><a href=
1.38      dillo     837:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       838:                 gotchas</a></span></dt>
1.1       grant     839: 
                    840:                 <dd>
                    841:                   <dl>
                    842:                     <dt><span class="sect2"><a href=
1.38      dillo     843:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     844:                     libtool</a></span></dt>
                    845: 
                    846:                     <dt><span class="sect2"><a href=
1.38      dillo     847:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     848:                     packages that already support
                    849:                     libtool</a></span></dt>
                    850: 
                    851:                     <dt><span class="sect2"><a href=
1.38      dillo     852:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     853:                     Autoconf/Automake</a></span></dt>
                    854:                   </dl>
                    855:                 </dd>
                    856: 
1.30      wiz       857:                 <dt><span class="sect1"><a href=
1.55      rillig    858:                 "#fixes-build">15.4. Building the
                    859:                 package</a></span></dt>
1.1       grant     860: 
                    861:                 <dd>
                    862:                   <dl>
                    863:                     <dt><span class="sect2"><a href=
1.38      dillo     864:                     "#cpp-defines">15.4.1. CPP
1.1       grant     865:                     defines</a></span></dt>
1.51      rillig    866: 
                    867:                     <dt><span class="sect2"><a href=
                    868:                     "#cpp-list">15.4.2. Getting a list of CPP
                    869:                     defines</a></span></dt>
1.1       grant     870:                   </dl>
                    871:                 </dd>
                    872: 
1.30      wiz       873:                 <dt><span class="sect1"><a href=
1.38      dillo     874:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       875:                 actions</a></span></dt>
1.1       grant     876: 
                    877:                 <dd>
                    878:                   <dl>
                    879:                     <dt><span class="sect2"><a href=
1.38      dillo     880:                     "#user-interaction">15.5.1. User
1.2       hubertf   881:                     interaction</a></span></dt>
1.1       grant     882: 
                    883:                     <dt><span class="sect2"><a href=
1.38      dillo     884:                     "#handling-licenses">15.5.2. Handling
1.1       grant     885:                     licenses</a></span></dt>
                    886: 
                    887:                     <dt><span class="sect2"><a href=
1.38      dillo     888:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       889:                     score files</a></span></dt>
1.1       grant     890: 
                    891:                     <dt><span class="sect2"><a href=
1.38      dillo     892:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       893:                     perl scripts</a></span></dt>
1.1       grant     894: 
                    895:                     <dt><span class="sect2"><a href=
1.38      dillo     896:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       897:                     hardcoded paths to other
                    898:                     interpreters</a></span></dt>
1.1       grant     899: 
                    900:                     <dt><span class="sect2"><a href=
1.38      dillo     901:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       902:                     perl modules</a></span></dt>
1.1       grant     903: 
                    904:                     <dt><span class="sect2"><a href=
1.38      dillo     905:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     906:                     info files</a></span></dt>
                    907: 
                    908:                     <dt><span class="sect2"><a href=
1.57      minskim   909:                     "#manpages">15.5.8. Packages installing man
                    910:                     pages</a></span></dt>
                    911: 
                    912:                     <dt><span class="sect2"><a href=
                    913:                     "#gconf2-data-files">15.5.9. Packages
1.30      wiz       914:                     installing GConf2 data files</a></span></dt>
1.1       grant     915: 
                    916:                     <dt><span class="sect2"><a href=
1.57      minskim   917:                     "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz       918:                     installing scrollkeeper data
                    919:                     files</a></span></dt>
1.1       grant     920: 
                    921:                     <dt><span class="sect2"><a href=
1.57      minskim   922:                     "#x11-fonts">15.5.11. Packages installing X11
1.1       grant     923:                     fonts</a></span></dt>
                    924: 
                    925:                     <dt><span class="sect2"><a href=
1.57      minskim   926:                     "#gtk2-modules">15.5.12. Packages installing
1.30      wiz       927:                     GTK2 modules</a></span></dt>
1.1       grant     928: 
                    929:                     <dt><span class="sect2"><a href=
1.57      minskim   930:                     "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz       931:                     SGML or XML data</a></span></dt>
1.1       grant     932: 
                    933:                     <dt><span class="sect2"><a href=
1.57      minskim   934:                     "#mime-database">15.5.14. Packages installing
1.1       grant     935:                     extensions to the MIME database</a></span></dt>
                    936: 
                    937:                     <dt><span class="sect2"><a href=
1.57      minskim   938:                     "#intltool">15.5.15. Packages using
1.1       grant     939:                     intltool</a></span></dt>
1.18      xtraeme   940: 
                    941:                     <dt><span class="sect2"><a href=
1.57      minskim   942:                     "#startup-scripts">15.5.16. Packages installing
1.18      xtraeme   943:                     startup scripts</a></span></dt>
1.57      minskim   944: 
                    945:                     <dt><span class="sect2"><a href=
                    946:                     "#tex-packages">15.5.17. Packages installing
                    947:                     TeX modules</a></span></dt>
1.1       grant     948:                   </dl>
                    949:                 </dd>
                    950: 
1.30      wiz       951:                 <dt><span class="sect1"><a href=
1.38      dillo     952:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       953:                 author</a></span></dt>
1.1       grant     954:               </dl>
                    955:             </dd>
                    956: 
1.38      dillo     957:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     958:             Debugging</a></span></dt>
                    959: 
1.38      dillo     960:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     961:             Submitting and Committing</a></span></dt>
                    962: 
                    963:             <dd>
                    964:               <dl>
1.30      wiz       965:                 <dt><span class="sect1"><a href=
1.38      dillo     966:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       967:                 packages</a></span></dt>
1.1       grant     968: 
1.30      wiz       969:                 <dt><span class="sect1"><a href=
1.41      wiz       970:                 "#general-notes-for-changes">17.2. General notes
                    971:                 when adding, updating, or removing
                    972:                 packages</a></span></dt>
                    973: 
                    974:                 <dt><span class="sect1"><a href=
                    975:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       976:                 a package into CVS</a></span></dt>
1.1       grant     977: 
1.30      wiz       978:                 <dt><span class="sect1"><a href=
1.41      wiz       979:                 "#updating-package">17.4. Updating a package to a
1.30      wiz       980:                 newer version</a></span></dt>
1.1       grant     981: 
1.30      wiz       982:                 <dt><span class="sect1"><a href=
1.41      wiz       983:                 "#moving-package">17.5. Moving a package in
1.30      wiz       984:                 pkgsrc</a></span></dt>
1.1       grant     985:               </dl>
                    986:             </dd>
                    987:           </dl>
                    988:         </dd>
                    989: 
1.46      gdt       990:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant     991:         example package: bison</a></span></dt>
                    992: 
                    993:         <dd>
                    994:           <dl>
1.46      gdt       995:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant     996:             files</a></span></dt>
                    997: 
                    998:             <dd>
                    999:               <dl>
1.30      wiz      1000:                 <dt><span class="sect2"><a href=
1.46      gdt      1001:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1002: 
1.30      wiz      1003:                 <dt><span class="sect2"><a href=
1.46      gdt      1004:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1005: 
1.30      wiz      1006:                 <dt><span class="sect2"><a href=
1.46      gdt      1007:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1008: 
1.30      wiz      1009:                 <dt><span class="sect2"><a href=
1.46      gdt      1010:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1011:                 package with <span><strong class=
1.14      xtraeme  1012:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1013:               </dl>
                   1014:             </dd>
                   1015: 
1.46      gdt      1016:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1017:             Steps for building, installing,
                   1018:             packaging</a></span></dt>
1.1       grant    1019:           </dl>
                   1020:         </dd>
                   1021: 
1.46      gdt      1022:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1023:         logs</a></span></dt>
                   1024: 
                   1025:         <dd>
                   1026:           <dl>
1.46      gdt      1027:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1028:             Building figlet</a></span></dt>
                   1029: 
1.46      gdt      1030:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1031:             Packaging figlet</a></span></dt>
                   1032:           </dl>
                   1033:         </dd>
                   1034: 
1.46      gdt      1035:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1036:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1037: 
1.46      gdt      1038:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1039:         guidelines for the pkgsrc guide</a></span></dt>
                   1040: 
                   1041:         <dd>
                   1042:           <dl>
1.46      gdt      1043:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1044:             Targets</a></span></dt>
                   1045: 
1.46      gdt      1046:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1047:             Procedure</a></span></dt>
                   1048:           </dl>
                   1049:         </dd>
1.1       grant    1050:       </dl>
                   1051:     </div>
                   1052: 
1.57      minskim  1053:     <div class="chapter" lang="en">
1.1       grant    1054:       <div class="titlepage">
                   1055:         <div>
                   1056:           <div>
1.57      minskim  1057:             <h2 class="title"><a name=
1.51      rillig   1058:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1059:             pkgsrc?</h2>
1.1       grant    1060:           </div>
                   1061:         </div>
                   1062:       </div>
                   1063: 
                   1064:       <div class="toc">
                   1065:         <p><b>Table of Contents</b></p>
                   1066: 
                   1067:         <dl>
1.30      wiz      1068:           <dt><span class="sect1"><a href=
                   1069:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1070: 
                   1071:           <dt><span class="sect1"><a href="#overview">1.2.
                   1072:           Overview</a></span></dt>
                   1073: 
                   1074:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1075:           Terminology</a></span></dt>
                   1076: 
                   1077:           <dt><span class="sect1"><a href="#typography">1.4.
                   1078:           Typography</a></span></dt>
                   1079:         </dl>
                   1080:       </div>
                   1081: 
1.57      minskim  1082:       <div class="sect1" lang="en">
1.1       grant    1083:         <div class="titlepage">
                   1084:           <div>
                   1085:             <div>
                   1086:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1087:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1088:             </div>
                   1089:           </div>
                   1090:         </div>
                   1091: 
1.47      reed     1092:         <p>There is a lot of software freely available for
                   1093:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1094:         Unix-flavoured systems, too, sometimes with some
                   1095:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1096:         incorporates any such changes necessary to make that
                   1097:         software run, and makes the installation (and
                   1098:         de-installation) of the software package easy by means of a
                   1099:         single command.</p>
                   1100: 
                   1101:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1102:         the <span><strong class="command">pkg_*</strong></span>
                   1103:         tools so that installation and de-installation, printing of
                   1104:         an inventory of all installed packages and retrieval of
                   1105:         one-line comments or more verbose descriptions are all
                   1106:         simple.</p>
1.1       grant    1107: 
                   1108:         <p>pkgsrc currently contains several thousand packages,
                   1109:         including:</p>
                   1110: 
                   1111:         <div class="itemizedlist">
                   1112:           <ul type="disc">
                   1113:             <li>
                   1114:               <p><a xmlns=
                   1115:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1116:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1117:               target="_top"><code xmlns="" class=
                   1118:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1119:               server</p>
1.1       grant    1120:             </li>
                   1121: 
                   1122:             <li>
                   1123:               <p><a xmlns=
                   1124:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1125:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1126:               target="_top"><code xmlns="" class=
                   1127:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1128:               browser</p>
1.1       grant    1129:             </li>
                   1130: 
                   1131:             <li>
                   1132:               <p><a xmlns=
                   1133:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1134:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1135:               target="_top"><code xmlns="" class=
                   1136:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1137:               Desktop Environment</p>
1.1       grant    1138:             </li>
                   1139: 
                   1140:             <li>
                   1141:               <p><a xmlns=
                   1142:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1143:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1144:               target="_top"><code xmlns="" class=
                   1145:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1146:               Environment</p>
1.1       grant    1147:             </li>
                   1148:           </ul>
                   1149:         </div>
                   1150: 
                   1151:         <p>...just to name a few.</p>
                   1152: 
                   1153:         <p>pkgsrc has built-in support for handling varying
                   1154:         dependencies, such as pthreads and X11, and extended
                   1155:         features such as IPv6 support on a range of platforms.</p>
                   1156: 
                   1157:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1158:         initially developed for NetBSD only. Since then, pkgsrc has
                   1159:         grown a lot, and now supports the following platforms:</p>
                   1160: 
                   1161:         <div class="itemizedlist">
                   1162:           <ul type="disc">
                   1163:             <li>
                   1164:               <p><a href="http://developer.apple.com/darwin/"
                   1165:               target="_top">Darwin</a> (<a href=
                   1166:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1167:               X</a>)</p>
                   1168:             </li>
                   1169: 
                   1170:             <li>
1.3       hubertf  1171:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1172:               "_top">DragonFlyBSD</a></p>
                   1173:             </li>
                   1174: 
                   1175:             <li>
1.1       grant    1176:               <p><a href="http://www.FreeBSD.org/" target=
                   1177:               "_top">FreeBSD</a></p>
                   1178:             </li>
                   1179: 
                   1180:             <li>
1.3       hubertf  1181:               <p>Microsoft Windows, via <a href=
                   1182:               "http://www.microsoft.com/windows/sfu/" target=
                   1183:               "_top">Interix</a></p>
1.1       grant    1184:             </li>
                   1185: 
                   1186:             <li>
                   1187:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1188:               target="_top">IRIX</a></p>
                   1189:             </li>
                   1190: 
                   1191:             <li>
                   1192:               <p><a href="http://www.linux.org/" target=
                   1193:               "_top">Linux</a></p>
                   1194:             </li>
                   1195: 
                   1196:             <li>
                   1197:               <p><a href="http://www.NetBSD.org/" target=
                   1198:               "_top">NetBSD</a> (of course)</p>
                   1199:             </li>
                   1200: 
                   1201:             <li>
1.17      sketch   1202:               <p><a href="http://h30097.www3.hp.com/" target=
                   1203:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1204:             </li>
                   1205: 
                   1206:             <li>
1.1       grant    1207:               <p><a href="http://www.openbsd.org/" target=
                   1208:               "_top">OpenBSD</a></p>
                   1209:             </li>
                   1210: 
                   1211:             <li>
                   1212:               <p><a href="http://www.sun.com/solaris/" target=
                   1213:               "_top">Solaris</a></p>
                   1214:             </li>
                   1215:           </ul>
                   1216:         </div>
                   1217:       </div>
                   1218: 
1.57      minskim  1219:       <div class="sect1" lang="en">
1.1       grant    1220:         <div class="titlepage">
                   1221:           <div>
                   1222:             <div>
                   1223:               <h2 class="title" style="clear: both"><a name=
1.57      minskim  1224:               "overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1225:             </div>
                   1226:           </div>
                   1227:         </div>
                   1228: 
                   1229:         <p>This document is divided into two parts. The first,
                   1230:         <a href="#users-guide" title=
1.46      gdt      1231:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1232:         user's guide</a>, describes how one can use one of the
                   1233:         packages in the Package Collection, either by installing a
                   1234:         precompiled binary package, or by building one's own copy
                   1235:         using the NetBSD package system. The second part, <a href=
1.1       grant    1236:         "#developers-guide" title=
1.46      gdt      1237:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1238:         pkgsrc developer's guide</a>, explains how to prepare a
                   1239:         package so it can be easily built by other NetBSD users
                   1240:         without knowing about the package's building details.</p>
1.1       grant    1241: 
                   1242:         <p>This document is available in various formats:</p>
                   1243: 
                   1244:         <div class="itemizedlist">
                   1245:           <ul type="disc">
                   1246:             <li>
                   1247:               <p><a href="index.html" target="_top">HTML</a></p>
                   1248:             </li>
                   1249: 
                   1250:             <li>
                   1251:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1252:             </li>
                   1253: 
                   1254:             <li>
                   1255:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1256:             </li>
                   1257: 
                   1258:             <li>
                   1259:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1260:             </li>
                   1261:           </ul>
                   1262:         </div>
                   1263:       </div>
                   1264: 
1.57      minskim  1265:       <div class="sect1" lang="en">
1.1       grant    1266:         <div class="titlepage">
                   1267:           <div>
                   1268:             <div>
                   1269:               <h2 class="title" style="clear: both"><a name=
                   1270:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1271:             </div>
                   1272:           </div>
                   1273:         </div>
                   1274: 
                   1275:         <p>There has been a lot of talk about &#8220;<span class=
                   1276:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1277:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1278:         description of all the terminology used within this
                   1279:         document.</p>
                   1280: 
                   1281:         <div class="variablelist">
                   1282:           <dl>
                   1283:             <dt><span class="term">Package</span></dt>
                   1284: 
                   1285:             <dd>
                   1286:               <p>A set of files and building instructions that
                   1287:               describe what's necessary to build a certain piece of
                   1288:               software using pkgsrc. Packages are traditionally
1.45      wiz      1289:               stored under <code xmlns=
                   1290:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1291:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1292:             </dd>
                   1293: 
                   1294:             <dt><span class="term">The NetBSD package
                   1295:             system</span></dt>
                   1296: 
                   1297:             <dd>
                   1298:               <p>This is the former name of &#8220;<span class=
                   1299:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1300:               NetBSD operating system and can be bootstrapped to
                   1301:               run on non-NetBSD operating systems as well. It
                   1302:               handles building (compiling), installing, and
                   1303:               removing of packages.</p>
1.1       grant    1304:             </dd>
                   1305: 
                   1306:             <dt><span class="term">Distfile</span></dt>
                   1307: 
                   1308:             <dd>
                   1309:               <p>This term describes the file or files that are
                   1310:               provided by the author of the piece of software to
                   1311:               distribute his work. All the changes necessary to
                   1312:               build on NetBSD are reflected in the corresponding
                   1313:               package. Usually the distfile is in the form of a
                   1314:               compressed tar-archive, but other types are possible,
1.45      wiz      1315:               too. Distfiles are usually stored below <code xmlns=
                   1316:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1317:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1318:             </dd>
                   1319: 
                   1320:             <dt><span class="term">Port</span></dt>
                   1321: 
                   1322:             <dd>
                   1323:               <p>This is the term used by FreeBSD and OpenBSD
                   1324:               people for what we call a package. In NetBSD
                   1325:               terminology, &#8220;<span class=
                   1326:               "quote">port</span>&#8221; refers to a different
                   1327:               architecture.</p>
                   1328:             </dd>
                   1329: 
                   1330:             <dt><span class="term">Precompiled/binary
                   1331:             package</span></dt>
                   1332: 
                   1333:             <dd>
                   1334:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1335:               distfile and stuffed together in a single
1.45      wiz      1336:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1337:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1338:               installed on machines of the same machine
                   1339:               architecture without the need to recompile. Packages
1.45      wiz      1340:               are usually generated in <code xmlns=
                   1341:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1342:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1343:               an archive on <a href=
1.1       grant    1344:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1345:               "_top">ftp.NetBSD.org</a>.</p>
                   1346: 
                   1347:               <p>Sometimes, this is referred to by the term
                   1348:               &#8220;<span class="quote">package</span>&#8221; too,
                   1349:               especially in the context of precompiled
                   1350:               packages.</p>
                   1351:             </dd>
                   1352: 
                   1353:             <dt><span class="term">Program</span></dt>
                   1354: 
                   1355:             <dd>
                   1356:               <p>The piece of software to be installed which will
1.47      reed     1357:               be constructed from all the files in the distfile by
1.1       grant    1358:               the actions defined in the corresponding package.</p>
                   1359:             </dd>
                   1360:           </dl>
                   1361:         </div>
                   1362:       </div>
                   1363: 
1.57      minskim  1364:       <div class="sect1" lang="en">
1.1       grant    1365:         <div class="titlepage">
                   1366:           <div>
                   1367:             <div>
                   1368:               <h2 class="title" style="clear: both"><a name=
                   1369:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1370:             </div>
                   1371:           </div>
                   1372:         </div>
                   1373: 
                   1374:         <p>When giving examples for commands, shell prompts are
                   1375:         used to show if the command should/can be issued as root,
                   1376:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1377:         privileges are sufficient. We use a <code class=
                   1378:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1379:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1380:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1381:       </div>
                   1382:     </div>
                   1383: 
1.57      minskim  1384:     <div class="part" lang="en">
1.1       grant    1385:       <div class="titlepage">
                   1386:         <div>
                   1387:           <div>
1.57      minskim  1388:             <h1 class="title"><a name=
1.48      dillo    1389:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1390:             guide</h1>
1.1       grant    1391:           </div>
                   1392:         </div>
                   1393:       </div>
                   1394: 
                   1395:       <div class="toc">
                   1396:         <p><b>Table of Contents</b></p>
                   1397: 
                   1398:         <dl>
                   1399:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1400:           get pkgsrc</a></span></dt>
                   1401: 
                   1402:           <dd>
                   1403:             <dl>
1.30      wiz      1404:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1405:               As tar file</a></span></dt>
1.1       grant    1406: 
1.30      wiz      1407:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1408:               SUP</a></span></dt>
                   1409: 
1.30      wiz      1410:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1411:               CVS</a></span></dt>
                   1412:             </dl>
                   1413:           </dd>
                   1414: 
                   1415:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1416:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1417: 
                   1418:           <dd>
                   1419:             <dl>
1.30      wiz      1420:               <dt><span class="sect1"><a href=
                   1421:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1422:               pkgsrc</a></span></dt>
1.1       grant    1423: 
1.30      wiz      1424:               <dt><span class="sect1"><a href=
1.47      reed     1425:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1426:               notes</a></span></dt>
1.1       grant    1427: 
                   1428:               <dd>
                   1429:                 <dl>
1.30      wiz      1430:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1431:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1432: 
1.30      wiz      1433:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1434:                   FreeBSD</a></span></dt>
1.22      tv       1435: 
1.30      wiz      1436:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1437:                   Interix</a></span></dt>
1.1       grant    1438: 
1.30      wiz      1439:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1440:                   IRIX</a></span></dt>
1.1       grant    1441: 
1.30      wiz      1442:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1443:                   Linux</a></span></dt>
1.1       grant    1444: 
1.30      wiz      1445:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1446:                   OpenBSD</a></span></dt>
1.1       grant    1447: 
1.30      wiz      1448:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1449:                   Solaris</a></span></dt>
1.1       grant    1450:                 </dl>
                   1451:               </dd>
                   1452:             </dl>
                   1453:           </dd>
                   1454: 
                   1455:           <dt><span class="chapter"><a href="#using">4. Using
                   1456:           pkgsrc</a></span></dt>
                   1457: 
                   1458:           <dd>
                   1459:             <dl>
                   1460:               <dt><span class="sect1"><a href=
                   1461:               "#getting-started">4.1. Working with binary
                   1462:               packages</a></span></dt>
                   1463: 
                   1464:               <dd>
                   1465:                 <dl>
                   1466:                   <dt><span class="sect2"><a href=
1.30      wiz      1467:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1468:                   get binary packages</a></span></dt>
1.1       grant    1469: 
                   1470:                   <dt><span class="sect2"><a href=
1.30      wiz      1471:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1472:                   binary packages</a></span></dt>
1.1       grant    1473: 
                   1474:                   <dt><span class="sect2"><a href=
1.30      wiz      1475:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1476:                   warning</a></span></dt>
                   1477:                 </dl>
                   1478:               </dd>
                   1479: 
1.30      wiz      1480:               <dt><span class="sect1"><a href=
                   1481:               "#building-packages-from-source">4.2. Building
                   1482:               packages from source</a></span></dt>
1.1       grant    1483: 
                   1484:               <dd>
                   1485:                 <dl>
                   1486:                   <dt><span class="sect2"><a href=
1.30      wiz      1487:                   "#requirements">4.2.1.
                   1488:                   Requirements</a></span></dt>
1.1       grant    1489: 
                   1490:                   <dt><span class="sect2"><a href=
1.30      wiz      1491:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1492:                   distfiles</a></span></dt>
                   1493: 
                   1494:                   <dt><span class="sect2"><a href=
1.30      wiz      1495:                   "#how-to-build-and-install">4.2.3. How to build
                   1496:                   and install</a></span></dt>
1.1       grant    1497: 
                   1498:                   <dt><span class="sect2"><a href=
1.30      wiz      1499:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1500:                   compiler</a></span></dt>
                   1501:                 </dl>
                   1502:               </dd>
                   1503:             </dl>
                   1504:           </dd>
                   1505: 
1.38      dillo    1506:           <dt><span class="chapter"><a href="#configuring">5.
                   1507:           Configuring pkgsrc</a></span></dt>
                   1508: 
                   1509:           <dd>
                   1510:             <dl>
                   1511:               <dt><span class="sect1"><a href=
1.45      wiz      1512:               "#general-configuration">5.1. General
                   1513:               configuration</a></span></dt>
                   1514: 
                   1515:               <dt><span class="sect1"><a href=
                   1516:               "#variables-affecting-build">5.2. Variables affecting
                   1517:               the build process</a></span></dt>
                   1518: 
                   1519:               <dt><span class="sect1"><a href=
                   1520:               "#developer-advanced-settings">5.3.
                   1521:               Developer/advanced settings</a></span></dt>
                   1522: 
                   1523:               <dt><span class="sect1"><a href=
                   1524:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1525:               Options</a></span></dt>
1.38      dillo    1526:             </dl>
                   1527:           </dd>
                   1528: 
                   1529:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1530:           binary packages</a></span></dt>
                   1531: 
                   1532:           <dd>
                   1533:             <dl>
1.30      wiz      1534:               <dt><span class="sect1"><a href=
1.38      dillo    1535:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1536:               single binary package</a></span></dt>
1.1       grant    1537: 
1.30      wiz      1538:               <dt><span class="sect1"><a href=
1.38      dillo    1539:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1540:               Settings for creation of binary
                   1541:               packages</a></span></dt>
                   1542: 
1.38      dillo    1543:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1544:               Doing a bulk build of all packages</a></span></dt>
                   1545: 
                   1546:               <dd>
                   1547:                 <dl>
                   1548:                   <dt><span class="sect2"><a href=
1.38      dillo    1549:                   "#binary.configuration">6.3.1.
1.1       grant    1550:                   Configuration</a></span></dt>
                   1551: 
                   1552:                   <dt><span class="sect2"><a href=
1.38      dillo    1553:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1554:                   Other environmental
1.1       grant    1555:                   considerations</a></span></dt>
                   1556: 
                   1557:                   <dt><span class="sect2"><a href=
1.38      dillo    1558:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1559: 
                   1560:                   <dt><span class="sect2"><a href=
1.38      dillo    1561:                   "#what-it-does">6.3.4. What it
1.30      wiz      1562:                   does</a></span></dt>
1.1       grant    1563: 
                   1564:                   <dt><span class="sect2"><a href=
1.38      dillo    1565:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1566:                   requirements</a></span></dt>
                   1567: 
                   1568:                   <dt><span class="sect2"><a href=
1.38      dillo    1569:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1570:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1571: 
                   1572:                   <dt><span class="sect2"><a href=
1.38      dillo    1573:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1574:                   partial set of packages</a></span></dt>
1.13      hubertf  1575: 
                   1576:                   <dt><span class="sect2"><a href=
1.38      dillo    1577:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1578:                   build</a></span></dt>
1.1       grant    1579:                 </dl>
                   1580:               </dd>
                   1581: 
1.30      wiz      1582:               <dt><span class="sect1"><a href=
1.38      dillo    1583:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1584:               packages collection</a></span></dt>
1.1       grant    1585: 
                   1586:               <dd>
                   1587:                 <dl>
                   1588:                   <dt><span class="sect2"><a href=
1.38      dillo    1589:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1590:                   cdpack</a></span></dt>
                   1591:                 </dl>
                   1592:               </dd>
                   1593:             </dl>
                   1594:           </dd>
                   1595: 
1.38      dillo    1596:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1597:           Asked Questions</a></span></dt>
                   1598: 
                   1599:           <dd>
                   1600:             <dl>
1.30      wiz      1601:               <dt><span class="sect1"><a href=
1.38      dillo    1602:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1603:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1604: 
1.38      dillo    1605:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1606:               Where's the pkgviews documentation?</a></span></dt>
                   1607: 
1.38      dillo    1608:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1609:               Utilities for package management
                   1610:               (pkgtools)</a></span></dt>
                   1611: 
1.30      wiz      1612:               <dt><span class="sect1"><a href=
1.38      dillo    1613:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1614:               non-root</a></span></dt>
1.1       grant    1615: 
1.30      wiz      1616:               <dt><span class="sect1"><a href=
1.38      dillo    1617:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1618:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1619: 
1.30      wiz      1620:               <dt><span class="sect1"><a href=
1.38      dillo    1621:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1622:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1623: 
1.30      wiz      1624:               <dt><span class="sect1"><a href=
1.38      dillo    1625:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1626:               from pkgsrc?</a></span></dt>
1.1       grant    1627: 
1.30      wiz      1628:               <dt><span class="sect1"><a href=
1.38      dillo    1629:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1630:               behind a firewall</a></span></dt>
1.1       grant    1631: 
1.38      dillo    1632:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1633:               How do I tell <span><strong class="command">make
1.14      xtraeme  1634:               fetch</strong></span> to do passive
1.1       grant    1635:               FTP?</a></span></dt>
                   1636: 
1.30      wiz      1637:               <dt><span class="sect1"><a href=
1.38      dillo    1638:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1639:               distfiles at once</a></span></dt>
1.1       grant    1640: 
1.30      wiz      1641:               <dt><span class="sect1"><a href=
1.38      dillo    1642:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1643:               &#8220;<span class="quote">Don't know how to make
                   1644:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1645:               mean?</a></span></dt>
1.13      hubertf  1646: 
1.30      wiz      1647:               <dt><span class="sect1"><a href=
1.38      dillo    1648:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1649:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1650:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1651: 
1.30      wiz      1652:               <dt><span class="sect1"><a href=
1.38      dillo    1653:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1654:               pkgsrc</a></span></dt>
1.1       grant    1655: 
1.38      dillo    1656:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1657:               do I change the location of configuration
                   1658:               files?</a></span></dt>
1.1       grant    1659: 
                   1660:               <dt><span class="sect1"><a href=
1.38      dillo    1661:               "#audit-packages">7.15. Automated security
1.1       grant    1662:               checks</a></span></dt>
                   1663:             </dl>
                   1664:           </dd>
                   1665:         </dl>
                   1666:       </div>
                   1667: 
1.57      minskim  1668:       <div class="chapter" lang="en">
1.1       grant    1669:         <div class="titlepage">
                   1670:           <div>
                   1671:             <div>
1.57      minskim  1672:               <h2 class="title"><a name=
1.1       grant    1673:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1674:               pkgsrc</h2>
                   1675:             </div>
                   1676:           </div>
                   1677:         </div>
                   1678: 
                   1679:         <div class="toc">
                   1680:           <p><b>Table of Contents</b></p>
                   1681: 
                   1682:           <dl>
1.30      wiz      1683:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1684:             tar file</a></span></dt>
                   1685: 
1.30      wiz      1686:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1687:             SUP</a></span></dt>
                   1688: 
1.30      wiz      1689:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1690:             CVS</a></span></dt>
                   1691:           </dl>
                   1692:         </div>
                   1693: 
                   1694:         <p>There are three ways to get pkgsrc. Either as a tar
                   1695:         file, via SUP, or via CVS. All three ways are described
                   1696:         here.</p>
                   1697: 
1.57      minskim  1698:         <div class="sect1" lang="en">
1.1       grant    1699:           <div class="titlepage">
                   1700:             <div>
                   1701:               <div>
                   1702:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  1703:                 "as-tar-file"></a>2.1.&nbsp;As tar file</h2>
1.1       grant    1704:               </div>
                   1705:             </div>
                   1706:           </div>
                   1707: 
                   1708:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1709:           file from <a href=
1.11      ben      1710:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1711:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1712:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1713:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1714:         </div>
                   1715: 
1.57      minskim  1716:         <div class="sect1" lang="en">
1.1       grant    1717:           <div class="titlepage">
                   1718:             <div>
                   1719:               <div>
                   1720:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  1721:                 "via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1722:               </div>
                   1723:             </div>
                   1724:           </div>
                   1725: 
                   1726:           <p>As an alternative to the tar file, you can get pkgsrc
                   1727:           via the Software Update Protocol, SUP. To do so, make
                   1728:           sure your supfile has a line</p>
                   1729:           <pre class="programlisting">
1.51      rillig   1730:     release=pkgsrc
1.1       grant    1731: </pre>
                   1732: 
1.45      wiz      1733:           <p>in it, see the examples in <code xmlns=
                   1734:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1735:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1736:           the <code xmlns=
                   1737:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1738:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1739:           simply run <span><strong class="command">sup -v
                   1740:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1741:         </div>
                   1742: 
1.57      minskim  1743:         <div class="sect1" lang="en">
1.1       grant    1744:           <div class="titlepage">
                   1745:             <div>
                   1746:               <div>
                   1747:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  1748:                 "via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1749:               </div>
                   1750:             </div>
                   1751:           </div>
                   1752: 
                   1753:           <p>To get pkgsrc via CVS, make sure you have
                   1754:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1755:           To do an initial (full) checkout of pkgsrc, do the
                   1756:           following steps:</p>
1.1       grant    1757:           <pre class="screen">
1.14      xtraeme  1758: <code class="prompt">%</code> <strong class=
                   1759: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1760: <code class="prompt">%</code> <strong class=
                   1761: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1762: <code class="prompt">%</code> <strong class=
                   1763: "userinput"><code>cd /usr</code></strong>
                   1764: <code class="prompt">%</code> <strong class=
                   1765: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1766: </pre>
                   1767: 
1.45      wiz      1768:           <p>This will create the <code xmlns=
                   1769:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1770:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1771:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1772:           "filename">/usr</code>, and all the package source will
1.45      wiz      1773:           be stored under <code xmlns=
                   1774:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1775:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1776:           initial checkout, make sure you have <code class=
                   1777:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1778:           <pre class="screen">
1.14      xtraeme  1779: <code class="prompt">%</code> <strong class=
                   1780: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1781: <code class="prompt">%</code> <strong class=
                   1782: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1783: </pre>
                   1784: 
                   1785:           <p>Please also note that it is possible to have multiple
                   1786:           copies of the pkgsrc hierarchy in use at any one time -
                   1787:           all work is done relatively within the pkgsrc tree.</p>
                   1788:         </div>
                   1789:       </div>
                   1790: 
1.57      minskim  1791:       <div class="chapter" lang="en">
1.1       grant    1792:         <div class="titlepage">
                   1793:           <div>
                   1794:             <div>
1.57      minskim  1795:               <h2 class="title"><a name=
1.1       grant    1796:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1797:               systems other than NetBSD</h2>
                   1798:             </div>
                   1799:           </div>
                   1800:         </div>
                   1801: 
                   1802:         <div class="toc">
                   1803:           <p><b>Table of Contents</b></p>
                   1804: 
                   1805:           <dl>
1.30      wiz      1806:             <dt><span class="sect1"><a href=
                   1807:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1808:             pkgsrc</a></span></dt>
1.1       grant    1809: 
1.30      wiz      1810:             <dt><span class="sect1"><a href=
1.47      reed     1811:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1812:             notes</a></span></dt>
1.1       grant    1813: 
                   1814:             <dd>
                   1815:               <dl>
1.30      wiz      1816:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1817:                 Darwin (Mac OS X)</a></span></dt>
                   1818: 
1.30      wiz      1819:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1820:                 FreeBSD</a></span></dt>
                   1821: 
1.30      wiz      1822:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1823:                 Interix</a></span></dt>
                   1824: 
1.30      wiz      1825:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1826:                 IRIX</a></span></dt>
                   1827: 
1.30      wiz      1828:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1829:                 Linux</a></span></dt>
                   1830: 
1.30      wiz      1831:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1832:                 OpenBSD</a></span></dt>
                   1833: 
1.30      wiz      1834:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1835:                 Solaris</a></span></dt>
                   1836:               </dl>
                   1837:             </dd>
                   1838:           </dl>
                   1839:         </div>
                   1840: 
1.57      minskim  1841:         <div class="sect1" lang="en">
1.1       grant    1842:           <div class="titlepage">
                   1843:             <div>
                   1844:               <div>
                   1845:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1846:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1847:                 pkgsrc</h2>
1.1       grant    1848:               </div>
                   1849:             </div>
                   1850:           </div>
                   1851: 
1.27      rillig   1852:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1853:           bootstrap kit to build the required tools to use pkgsrc
                   1854:           on your platform. Besides support for native NetBSD,
                   1855:           pkgsrc and the bootstrap kit have support for the
                   1856:           following operating systems:</p>
                   1857: 
                   1858:           <div class="itemizedlist">
                   1859:             <ul type="disc">
                   1860:               <li>
                   1861:                 <p>Darwin (Mac OS X)</p>
                   1862:               </li>
                   1863: 
                   1864:               <li>
1.16      grant    1865:                 <p>DragonFlyBSD</p>
                   1866:               </li>
                   1867: 
                   1868:               <li>
1.1       grant    1869:                 <p>FreeBSD</p>
                   1870:               </li>
                   1871: 
                   1872:               <li>
                   1873:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1874:               </li>
                   1875: 
                   1876:               <li>
                   1877:                 <p>IRIX</p>
                   1878:               </li>
                   1879: 
                   1880:               <li>
                   1881:                 <p>Linux</p>
                   1882:               </li>
                   1883: 
                   1884:               <li>
                   1885:                 <p>OpenBSD</p>
                   1886:               </li>
                   1887: 
                   1888:               <li>
                   1889:                 <p>Solaris</p>
                   1890:               </li>
1.16      grant    1891: 
                   1892:               <li>
                   1893:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1894:               </li>
1.1       grant    1895:             </ul>
                   1896:           </div>
                   1897: 
                   1898:           <p>Support for other platforms is under development.</p>
                   1899: 
                   1900:           <p>Installing the bootstrap kit should be as simple
                   1901:           as:</p>
                   1902:           <pre class="screen">
1.14      xtraeme  1903: <code class="prompt">#</code> <strong class=
                   1904: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1905: <code class="prompt">#</code> <strong class=
                   1906: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1907: <code class="prompt">#</code> <strong class=
                   1908: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1909: </pre>
                   1910: 
                   1911:           <p>See <a href="#getting" title=
1.57      minskim  1912:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter&nbsp;2,
1.1       grant    1913:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1914:           pkgsrc before bootstrapping. The given
                   1915:           <span><strong class="command">bootstrap</strong></span>
1.45      wiz      1916:           command will use the defaults of <code xmlns=
                   1917:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1918:           "filename">/usr/pkg</code> for the <span class=
                   1919:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1920:           installed in, and <code xmlns=
                   1921:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1922:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1923:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1924:           However, these can also be set using command-line
1.27      rillig   1925:           arguments.</p>
1.1       grant    1926: 
                   1927:           <p>Binary packages for the pkgsrc tools and an initial
                   1928:           set of packages is available for supported platforms. An
                   1929:           up-to-date list of these can be found on <a href=
                   1930:           "http://www.pkgsrc.org/" target=
                   1931:           "_top">www.pkgsrc.org</a>.</p>
1.47      reed     1932: 
                   1933:           <div class="note" style=
                   1934:           "margin-left: 0.5in; margin-right: 0.5in;">
                   1935:             <h3 class="title">Note</h3>
                   1936: 
                   1937:             <p>The bootstrap installs a <span><strong class=
                   1938:             "command">bmake</strong></span> tool. Use this
                   1939:             <span><strong class="command">bmake</strong></span>
                   1940:             when building via pkgsrc. For examples in this guide,
                   1941:             use <span><strong class="command">bmake</strong></span>
                   1942:             instead of &#8220;<span class=
                   1943:             "quote">make</span>&#8221;.</p>
                   1944:           </div>
1.1       grant    1945:         </div>
                   1946: 
1.57      minskim  1947:         <div class="sect1" lang="en">
1.1       grant    1948:           <div class="titlepage">
                   1949:             <div>
                   1950:               <div>
                   1951:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     1952:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   1953:                 notes</h2>
1.1       grant    1954:               </div>
                   1955:             </div>
                   1956:           </div>
                   1957: 
                   1958:           <p>Here are some platform-specific notes you should be
                   1959:           aware of.</p>
                   1960: 
1.57      minskim  1961:           <div class="sect2" lang="en">
1.1       grant    1962:             <div class="titlepage">
                   1963:               <div>
                   1964:                 <div>
1.57      minskim  1965:                   <h3 class="title"><a name=
1.30      wiz      1966:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    1967:                 </div>
                   1968:               </div>
                   1969:             </div>
                   1970: 
                   1971:             <p>Darwin 5.x and 6.x are supported. There are two
                   1972:             methods of using pkgsrc on Mac OS X, by using a
                   1973:             <a href="#platform.osx-image" title=
                   1974:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1975:             <a href="#platform.osx-ufs" title=
                   1976:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1977:             partition</a>.</p>
                   1978: 
                   1979:             <p>Before you start, you will need to download and
                   1980:             install the Mac OS X Developer Tools from Apple's
                   1981:             Developer Connection. See <a href=
                   1982:             "http://developer.apple.com/macosx/" target=
                   1983:             "_top">http://developer.apple.com/macosx/</a> for
                   1984:             details. Also, make sure you install X11 for Mac OS X
                   1985:             and the X11 SDK from <a href=
                   1986:             "http://www.apple.com/macosx/x11/download/" target=
                   1987:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1988:             you intend to build packages that use the X11 Window
                   1989:             System.</p>
                   1990: 
                   1991:             <p>If you already have a UFS partition, or have a spare
                   1992:             partition that you can format as UFS, it is recommended
                   1993:             to use that instead of the disk image. It'll be
                   1994:             somewhat faster and will mount automatically at boot
                   1995:             time, where you must manually mount a disk image.</p>
                   1996: 
                   1997:             <div class="note" style=
                   1998:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1999:               <h3 class="title">Note</h3>
                   2000: 
                   2001:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2002:               because pkgsrc currently requires the file system to
1.1       grant    2003:               be case-sensitive, and HFS+ is not.</p>
                   2004:             </div>
                   2005: 
1.57      minskim  2006:             <div class="sect3" lang="en">
1.1       grant    2007:               <div class="titlepage">
                   2008:                 <div>
                   2009:                   <div>
1.57      minskim  2010:                     <h4 class="title"><a name=
                   2011:                     "platform.osx-image"></a>3.2.1.1.&nbsp;Using a
                   2012:                     disk image</h4>
1.1       grant    2013:                   </div>
                   2014:                 </div>
                   2015:               </div>
                   2016: 
                   2017:               <p>Create the disk image:</p>
                   2018:               <pre class="screen">
1.14      xtraeme  2019: <code class="prompt">#</code> <strong class=
                   2020: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2021: <code class="prompt">#</code> <strong class=
                   2022: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2023: <code class="prompt">#</code> <strong class=
                   2024: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2025: <code class="prompt">#</code> <strong class=
                   2026: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2027: </pre>
                   2028: 
                   2029:               <p>That's it!</p>
                   2030:             </div>
                   2031: 
1.57      minskim  2032:             <div class="sect3" lang="en">
1.1       grant    2033:               <div class="titlepage">
                   2034:                 <div>
                   2035:                   <div>
1.57      minskim  2036:                     <h4 class="title"><a name=
                   2037:                     "platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2038:                     UFS partition</h4>
                   2039:                   </div>
                   2040:                 </div>
                   2041:               </div>
                   2042: 
1.45      wiz      2043:               <p>By default, <code xmlns=
                   2044:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2045:               "filename">/usr</code> will be on your root file
                   2046:               system, normally HFS+. It is possible to use the
                   2047:               default <span class="emphasis"><em>prefix</em></span>
                   2048:               of <code xmlns=
                   2049:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2050:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2051:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2052:               "filename">/usr/pkg</code> to a directory on a UFS
                   2053:               file system. Obviously, another symlink is required
                   2054:               if you want to place the package database directory
                   2055:               outside the <span class=
                   2056:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2057:               <pre class="screen">
1.14      xtraeme  2058: <code class="prompt">#</code> <strong class=
1.22      tv       2059: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    2060: </pre>
                   2061: 
                   2062:               <p>If you created your partitions at the time of
                   2063:               installing Mac OS X and formatted the target
                   2064:               partition as UFS, it should automatically mount on
1.45      wiz      2065:               <code xmlns=
                   2066:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2067:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2068:               the machine boots. If you are (re)formatting a
                   2069:               partition as UFS, you need to ensure that the
                   2070:               partition map correctly reflects &#8220;<span class=
                   2071:               "quote">Apple_UFS</span>&#8221; and not
                   2072:               &#8220;<span class=
1.1       grant    2073:               "quote">Apple_HFS</span>&#8221;.</p>
                   2074: 
                   2075:               <p>The problem is that none of the disk tools will
                   2076:               let you touch a disk that is booted from. You can
                   2077:               unmount the partition, but even if you newfs it, the
                   2078:               partition type will be incorrect and the automounter
                   2079:               won't mount it. It can be mounted manually, but it
                   2080:               won't appear in Finder.</p>
                   2081: 
                   2082:               <p>You'll need to boot off of the OS X Installation
                   2083:               (User) CD. When the Installation program starts, go
                   2084:               up to the menu and select Disk Utility. Now, you will
                   2085:               be able to select the partition you want to be UFS,
                   2086:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2087:               the installer which will reboot your machine. The new
                   2088:               UFS file system will appear in Finder.</p>
                   2089: 
                   2090:               <p>Be aware that the permissions on the new file
                   2091:               system will be writable by root only.</p>
                   2092: 
                   2093:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2094:               earlier versions. Hopefully Apple will fix Disk
                   2095:               Utility in 10.3 (Panther).</p>
                   2096:             </div>
                   2097:           </div>
                   2098: 
1.57      minskim  2099:           <div class="sect2" lang="en">
1.1       grant    2100:             <div class="titlepage">
                   2101:               <div>
                   2102:                 <div>
1.57      minskim  2103:                   <h3 class="title"><a name=
1.30      wiz      2104:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2105:                 </div>
                   2106:               </div>
                   2107:             </div>
                   2108: 
                   2109:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2110:             supported, other versions may work.</p>
                   2111: 
                   2112:             <p>Care should be taken so that the tools that this kit
                   2113:             installs do not conflict with the FreeBSD userland
                   2114:             tools. There are several steps:</p>
                   2115: 
                   2116:             <div class="orderedlist">
                   2117:               <ol type="1">
                   2118:                 <li>
                   2119:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2120:                   <code xmlns=
                   2121:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2122:                   "filename">/var/db/pkg</code>. It is therefore
                   2123:                   recommended that you choose a different location
                   2124:                   (e.g. <code xmlns=
                   2125:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2126:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2127:                   --pkgdbdir option to the bootstrap script.</p>
                   2128:                 </li>
                   2129: 
                   2130:                 <li>
                   2131:                   <p>If you do not intend to use the FreeBSD ports
                   2132:                   tools, it's probably a good idea to move them out
                   2133:                   of the way to avoid confusion, e.g.</p>
                   2134:                   <pre class="screen">
1.14      xtraeme  2135: <code class="prompt">#</code> <strong class=
                   2136: "userinput"><code>cd /usr/sbin</code></strong>
                   2137: <code class="prompt">#</code> <strong class=
                   2138: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2139: <code class="prompt">#</code> <strong class=
                   2140: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2141: <code class="prompt">#</code> <strong class=
                   2142: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2143: <code class="prompt">#</code> <strong class=
                   2144: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2145: </pre>
                   2146:                 </li>
                   2147: 
                   2148:                 <li>
1.45      wiz      2149:                   <p>An example <code xmlns=
                   2150:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2151:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2152:                   placed in <code xmlns=
                   2153:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2154:                   "filename">/etc/mk.conf.example</code> file when
                   2155:                   you use the bootstrap script.</p>
1.1       grant    2156:                 </li>
                   2157:               </ol>
                   2158:             </div>
                   2159:           </div>
                   2160: 
1.57      minskim  2161:           <div class="sect2" lang="en">
1.1       grant    2162:             <div class="titlepage">
                   2163:               <div>
                   2164:                 <div>
1.57      minskim  2165:                   <h3 class="title"><a name=
1.30      wiz      2166:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2167:                 </div>
                   2168:               </div>
                   2169:             </div>
                   2170: 
1.47      reed     2171:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2172:             Windows NT kernel, providing a Unix-like environment
                   2173:             with a tighter kernel integration than available with
                   2174:             Cygwin. It is part of the Windows Services for Unix
                   2175:             package, available for free for any licensed copy of
1.22      tv       2176:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2177:             can be downloaded from <a href=
                   2178:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2179:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2180: 
                   2181:             <p>Services for Unix 3.5, current as of this writing,
                   2182:             has been tested. 3.0 or 3.1 may work, but are not
                   2183:             officially supported. (The main difference in 3.0/3.1
                   2184:             is lack of pthreads.)</p>
                   2185: 
1.57      minskim  2186:             <div class="sect3" lang="en">
1.1       grant    2187:               <div class="titlepage">
                   2188:                 <div>
                   2189:                   <div>
                   2190:                     <h4 class="title"><a name=
                   2191:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2192:                     installing Interix/SFU</h4>
1.1       grant    2193:                   </div>
                   2194:                 </div>
                   2195:               </div>
                   2196: 
                   2197:               <p>At an absolute minimum, the following packages
                   2198:               must be installed from the Windows Services for Unix
                   2199:               3.5 distribution in order to use pkgsrc:</p>
                   2200: 
                   2201:               <div class="itemizedlist">
                   2202:                 <ul type="disc">
                   2203:                   <li>
                   2204:                     <p>Utilities -&gt; Base Utilities</p>
                   2205:                   </li>
                   2206: 
                   2207:                   <li>
                   2208:                     <p>Interix GNU Components -&gt; (all)</p>
                   2209:                   </li>
                   2210: 
                   2211:                   <li>
                   2212:                     <p>Remote Connectivity</p>
                   2213:                   </li>
                   2214: 
                   2215:                   <li>
                   2216:                     <p>Interix SDK</p>
                   2217:                   </li>
                   2218:                 </ul>
                   2219:               </div>
                   2220: 
                   2221:               <p>When using pkgsrc on Interix, DO NOT install the
                   2222:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2223:               without shared module support, installed to
                   2224:               /usr/local, and will only cause confusion. Instead,
                   2225:               install Perl 5.8 from pkgsrc (or from a binary
                   2226:               package).</p>
                   2227: 
                   2228:               <p>The Remote Connectivity subcomponent "Windows
                   2229:               Remote Shell Service" does not need to be installed,
                   2230:               but Remote Connectivity itself should be installed in
                   2231:               order to have a working inetd.</p>
                   2232: 
1.52      tv       2233:               <p>During installation you may be asked whether to
                   2234:               enable setuid behavior for Interix programs, and
                   2235:               whether to make pathnames default to case-sensitive.
                   2236:               Setuid should be enabled, and case-sensitivity MUST
                   2237:               be enabled. (Without case-sensitivity, a large number
                   2238:               of packages including perl will not build.)</p>
                   2239: 
                   2240:               <p>NOTE: Newer Windows service packs change the way
                   2241:               binary execution works (via the Data Execution
                   2242:               Prevention feature). In order to use pkgsrc and other
                   2243:               gcc-compiled binaries reliably, a hotfix containing
                   2244:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2245:               (899522 or newer) must be installed. Hotfixes are
                   2246:               available from Microsoft through a support contract;
                   2247:               however, a NetBSD developer has made most Interix
                   2248:               hotfixes available for personal use from <a href=
                   2249:               "http://www.duh.org/interix/hotfixes.php" target=
                   2250:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2251:             </div>
                   2252: 
1.57      minskim  2253:             <div class="sect3" lang="en">
1.1       grant    2254:               <div class="titlepage">
                   2255:                 <div>
                   2256:                   <div>
                   2257:                     <h4 class="title"><a name=
                   2258:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2259:                     to do if Interix/SFU is already installed</h4>
                   2260:                   </div>
                   2261:                 </div>
                   2262:               </div>
                   2263: 
                   2264:               <p>If SFU is already installed and you wish to alter
                   2265:               these settings to work with pkgsrc, note the
                   2266:               following things.</p>
                   2267: 
                   2268:               <div class="itemizedlist">
                   2269:                 <ul type="disc">
                   2270:                   <li>
                   2271:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2272:                     Programs, select Microsoft Windows Services for
                   2273:                     UNIX, then click Change. In the installer,
                   2274:                     choose Add or Remove, then uncheck
                   2275:                     Utilities-&gt;UNIX Perl.</p>
                   2276:                   </li>
                   2277: 
                   2278:                   <li>
1.47      reed     2279:                     <p>To enable case-sensitivity for the file
                   2280:                     system, run REGEDIT.EXE, and change the
1.1       grant    2281:                     following registry key:</p>
                   2282: 
                   2283:                     <p>
                   2284:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2285:                     Manager\kernel</p>
                   2286: 
                   2287:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2288:                     0; then reboot.</p>
                   2289:                   </li>
                   2290: 
                   2291:                   <li>
                   2292:                     <p>To enable setuid binaries (optional), run
                   2293:                     REGEDIT.EXE, and change the following registry
                   2294:                     key:</p>
                   2295: 
                   2296:                     <p>
                   2297:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2298:                     for UNIX</p>
                   2299: 
                   2300:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2301:                     to 1; then reboot.</p>
                   2302:                   </li>
                   2303:                 </ul>
                   2304:               </div>
                   2305:             </div>
                   2306: 
1.57      minskim  2307:             <div class="sect3" lang="en">
1.1       grant    2308:               <div class="titlepage">
                   2309:                 <div>
                   2310:                   <div>
                   2311:                     <h4 class="title"><a name=
                   2312:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2313:                     notes for using pkgsrc</h4>
                   2314:                   </div>
                   2315:                 </div>
                   2316:               </div>
                   2317: 
1.52      tv       2318:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2319:               or the user running "pkg_add") must be a member of
                   2320:               the local Administrators group. Such a user must also
                   2321:               be used to run the bootstrap. This is slightly
                   2322:               relaxed from the normal pkgsrc requirement of
                   2323:               "root".</p>
                   2324: 
                   2325:               <p>The package manager should use a umask of 002.
                   2326:               "make install" will automatically complain if this is
                   2327:               not the case. This ensures that directories written
                   2328:               in /var/db/pkg are Administrators-group
                   2329:               writeable.</p>
                   2330: 
                   2331:               <p>The popular Interix binary packages from
                   2332:               http://www.interopsystems.com/ use an older version
                   2333:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2334:               used in conjunction with pkgsrc. If you choose to use
                   2335:               them at the same time as the pkgsrc packages, ensure
                   2336:               that you use the proper pkg_* tools for each type of
                   2337:               binary package.</p>
1.22      tv       2338: 
                   2339:               <p>The TERM setting used for DOS-type console windows
                   2340:               (including those invoked by the csh and ksh startup
                   2341:               shortcuts) is "interix". Most systems don't have a
                   2342:               termcap/terminfo entry for it, but the following
                   2343:               .termcap entry provides adequate emulation in most
                   2344:               cases:</p>
                   2345:               <pre class="programlisting">
1.51      rillig   2346:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2347: </pre>
1.1       grant    2348:             </div>
1.52      tv       2349: 
1.57      minskim  2350:             <div class="sect3" lang="en">
1.52      tv       2351:               <div class="titlepage">
                   2352:                 <div>
                   2353:                   <div>
                   2354:                     <h4 class="title"><a name=
                   2355:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2356:                     of the Interix platform</h4>
                   2357:                   </div>
                   2358:                 </div>
                   2359:               </div>
                   2360: 
                   2361:               <p>Though Interix suffices as a familiar and flexible
                   2362:               substitute for a full Unix-like platform, it has some
                   2363:               drawbacks that should be noted for those desiring to
                   2364:               make the most of Interix.</p>
                   2365: 
                   2366:               <div class="itemizedlist">
                   2367:                 <ul type="disc">
                   2368:                   <li>
1.54      tv       2369:                     <p><span class=
1.57      minskim  2370:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2371: 
                   2372:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2373:                     client libraries, and can run X11 based
1.52      tv       2374:                     applications, but it does <span class=
                   2375:                     "emphasis"><em>not</em></span> come with an X
                   2376:                     server. Some options are <a href=
                   2377:                     "http://www.starnet.com/products/xwin32/"
                   2378:                     target="_top">StarNet X-Win32</a>, <a href=
                   2379:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2380:                     target="_top">Hummingbird Exceed</a> (available
                   2381:                     in a trimmed version for Interix from Interop
                   2382:                     Systems as the <a href=
                   2383:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2384:                     target="_top">Interop X Server</a>), and the
                   2385:                     free X11 server included with <a href=
1.52      tv       2386:                     "http://x.cygwin.com/" target=
                   2387:                     "_top">Cygwin</a>.</p>
                   2388: 
                   2389:                     <p>Also, StarNet Communications has graciously
                   2390:                     provided a free version of their X-Win32
                   2391:                     product that accepts connections only from
                   2392:                     localhost: <a href=
                   2393:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2394:                     target="_top">X-Win32 LX</a>, recommended by
                   2395:                     the maintainer of Interix pkgsrc support.</p>
                   2396:                   </li>
                   2397: 
                   2398:                   <li>
1.57      minskim  2399:                     <p><span class="strong"><strong>X11
1.54      tv       2400:                     acceleration:</strong></span></p>
1.52      tv       2401: 
                   2402:                     <p>Because Interix runs in a completely
                   2403:                     different NT subsystem from Win32 applications,
                   2404:                     it does not currently support various X11
                   2405:                     protocol extensions for acceleration (such as
                   2406:                     MIT-SHM or DGA). Most interactive applications
                   2407:                     to a local X server will run reasonably fast,
                   2408:                     but full motion video and other graphics
                   2409:                     intensive applications may require a
                   2410:                     faster-than-expected CPU.</p>
                   2411:                   </li>
                   2412: 
                   2413:                   <li>
1.54      tv       2414:                     <p><span class=
                   2415:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2416: 
                   2417:                     <p>Interix has no native support for audio
1.53      tv       2418:                     output. For audio support, pkgsrc uses the
                   2419:                     <span><strong class=
1.52      tv       2420:                     "command">esound</strong></span> client/server
                   2421:                     audio system on Interix. Unlike on most
                   2422:                     platforms, the <a xmlns=
                   2423:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2424:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2425:                     target="_top"><code xmlns="" class=
                   2426:                     "filename">audio/esound</code></a> package does
                   2427:                     <span class="emphasis"><em>not</em></span>
                   2428:                     contain the <span><strong class=
1.53      tv       2429:                     "command">esd</strong></span> server component.
                   2430:                     To output audio via an Interix host, the
                   2431:                     <a xmlns=
1.52      tv       2432:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2433:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2434:                     target="_top"><code xmlns="" class=
                   2435:                     "filename">emulators/cygwin_esound</code></a>
                   2436:                     package must also be installed.</p>
                   2437:                   </li>
                   2438: 
                   2439:                   <li>
1.54      tv       2440:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2441:                     and SCSI:</strong></span></p>
1.52      tv       2442: 
                   2443:                     <p>Direct device access is not currently
                   2444:                     supported in Interix, so it is not currently
                   2445:                     possible to access CD/DVD drives, USB devices,
                   2446:                     or SCSI devices through non-filesystem means.
                   2447:                     Among other things, this makes it impossible to
                   2448:                     use Interix directly for CD/DVD burning.</p>
                   2449:                   </li>
                   2450: 
                   2451:                   <li>
1.54      tv       2452:                     <p><span class="strong"><strong>Tape
                   2453:                     drives:</strong></span></p>
1.52      tv       2454: 
                   2455:                     <p>Due to the same limitations as for CD-ROMs
                   2456:                     and SCSI devices, tape drives are also not
                   2457:                     directly accessible in Interix. However,
                   2458:                     support is in work to make tape drive access
                   2459:                     possible by using Cygwin as a bridge (similarly
                   2460:                     to audio bridged via Cygwin's esound
                   2461:                     server).</p>
                   2462:                   </li>
                   2463:                 </ul>
                   2464:               </div>
                   2465:             </div>
                   2466: 
1.57      minskim  2467:             <div class="sect3" lang="en">
1.52      tv       2468:               <div class="titlepage">
                   2469:                 <div>
                   2470:                   <div>
                   2471:                     <h4 class="title"><a name=
                   2472:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2473:                     issues for pkgsrc on Interix</h4>
                   2474:                   </div>
                   2475:                 </div>
                   2476:               </div>
                   2477: 
                   2478:               <p>It is not necessary, in general, to have a "root"
                   2479:               user on the Windows system; any member of the local
                   2480:               Administrators group will suffice. However, some
                   2481:               packages currently assume that the user named "root"
                   2482:               is the privileged user. To accommodate these, you may
                   2483:               create such a user; make sure it is in the local
                   2484:               group Administrators (or your language
                   2485:               equivalent).</p>
                   2486: 
                   2487:               <p>"pkg_add" creates directories of mode 0755, not
                   2488:               0775, in $PKG_DBDIR. For the time being, install
                   2489:               packages as the local Administrator (or your language
                   2490:               equivalent), or run the following command after
                   2491:               installing a package to work around the issue:</p>
                   2492:               <pre class="screen">
                   2493: <code class="prompt">#</code> <strong class=
                   2494: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2495: </pre>
                   2496:             </div>
1.1       grant    2497:           </div>
                   2498: 
1.57      minskim  2499:           <div class="sect2" lang="en">
1.1       grant    2500:             <div class="titlepage">
                   2501:               <div>
                   2502:                 <div>
1.57      minskim  2503:                   <h3 class="title"><a name=
1.30      wiz      2504:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2505:                 </div>
                   2506:               </div>
                   2507:             </div>
                   2508: 
                   2509:             <p>You will need a working C compiler, either gcc or
                   2510:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2511:             the <code class="varname">CC</code> environment
                   2512:             variable according to your preference. If you do not
                   2513:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2514:             download a gcc tardist file from <a href=
                   2515:             "http://freeware.sgi.com/" target=
                   2516:             "_top">http://freeware.sgi.com/</a>.</p>
                   2517: 
                   2518:             <p>Please note that you will need IRIX 6.5.17 or
                   2519:             higher, as this is the earliest version of IRIX
1.24      wiz      2520:             providing support for <a href=
                   2521:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2522:             <span class="citerefentry"><span class=
                   2523:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2524:             <a href=
                   2525:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2526:             <span class="citerefentry"><span class=
                   2527:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2528:             etc.</p>
1.1       grant    2529: 
1.27      rillig   2530:             <p>At this point in time, pkgsrc only supports one ABI
                   2531:             at a time. That is, you can not switch between the old
                   2532:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2533:             you start out using "abi=n32", that's what all your
                   2534:             packages will be built with.</p>
1.1       grant    2535: 
                   2536:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2537:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2538:             environment or the <code xmlns=
                   2539:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2540:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2541:             that you do not try to link n32 object files with lib64
1.45      wiz      2542:             or vice versa. Check your <code xmlns=
                   2543:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2544:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2545: 
                   2546:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2547:             from a different host, please make sure to set
1.14      xtraeme  2548:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2549:             directory, as it appears that IRIX linker occasionally
1.47      reed     2550:             runs into issues when trying to link over a
                   2551:             network-mounted file system.</p>
1.1       grant    2552: 
                   2553:             <p>The bootstrapping process should set all the right
                   2554:             options for programs such as imake(1), but you may want
                   2555:             to set some options depending on your local setup.
1.45      wiz      2556:             Please see <code xmlns=
                   2557:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2558:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2559:             course, your compiler's man pages for details.</p>
1.22      tv       2560: 
                   2561:             <p>If you are using SGI's MIPSPro compiler, please
                   2562:             set</p>
                   2563:             <pre class="programlisting">
1.51      rillig   2564:     PKGSRC_COMPILER=        mipspro
1.22      tv       2565: </pre>
                   2566: 
1.45      wiz      2567:             <p>in <code xmlns=
                   2568:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2569:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2570:             assume you are using gcc and may end up passing invalid
                   2571:             flags to the compiler. Note that bootstrap should
                   2572:             create an appropriate <code xmlns=
                   2573:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2574:             "filename">mk.conf.example</code> by default.</p>
                   2575: 
                   2576:             <p>If you have both the MIPSPro compiler chain
                   2577:             installed as well as gcc, but want to make sure that
                   2578:             MIPRPro is used, please set your <code class=
                   2579:             "varname">PATH</code> to <span class=
                   2580:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2581:             gcc (often <code xmlns=
                   2582:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2583:             "filename">/usr/freeware/bin</code>), and (important)
                   2584:             pass the '--preserve-path' flag.</p>
1.1       grant    2585:           </div>
                   2586: 
1.57      minskim  2587:           <div class="sect2" lang="en">
1.1       grant    2588:             <div class="titlepage">
                   2589:               <div>
                   2590:                 <div>
1.57      minskim  2591:                   <h3 class="title"><a name=
1.30      wiz      2592:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2593:                 </div>
                   2594:               </div>
                   2595:             </div>
                   2596: 
                   2597:             <p>Some versions of Linux (for example Debian
                   2598:             GNU/Linux) need either libtermcap or libcurses
                   2599:             (libncurses). Installing the distributions
                   2600:             libncurses-dev package (or equivalent) should fix the
                   2601:             problem.</p>
                   2602: 
                   2603:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2604:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2605:             8.0 and 8.1 on i386 have been tested.</p>
                   2606: 
                   2607:             <p>To bootstrap using icc, assuming the default icc
                   2608:             installation directory:</p>
                   2609:             <pre class="programlisting">
1.51      rillig   2610:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2611:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2612: </pre>
                   2613: 
                   2614:             <div class="note" style=
                   2615:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2616:               <h3 class="title">Note</h3>
                   2617: 
                   2618:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2619:               -static-libcxa.</p>
                   2620:             </div>
                   2621: 
                   2622:             <p>icc supports __attribute__, but the GNU configure
                   2623:             test uses a nested function, which icc does not
                   2624:             support. #undef'ing __attribute__ has the unfortunate
                   2625:             side-effect of breaking many of the Linux header files,
                   2626:             which cannot be compiled properly without
                   2627:             __attribute__. The test must be overridden so that
                   2628:             __attribute__ is assumed supported by the compiler.</p>
                   2629: 
                   2630:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2631:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2632:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2633:             "filename">/etc/mk.conf</code>:</p>
                   2634:             <pre class="programlisting">
1.51      rillig   2635:     PKGSRC_COMPILER=        icc
1.22      tv       2636: </pre>
                   2637: 
                   2638:             <p>The default installation directory for icc is
1.45      wiz      2639:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2640:             class="filename">/opt/intel_cc_80</code>, which is also
                   2641:             the pkgsrc default. If you have installed it into a
                   2642:             different directory, set <code class=
                   2643:             "varname">ICCBASE</code> in <code xmlns=
                   2644:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2645:             "filename">/etc/mk.conf</code>:</p>
                   2646:             <pre class="programlisting">
1.51      rillig   2647:     ICCBASE=                /opt/icc
1.22      tv       2648: </pre>
                   2649: 
                   2650:             <p>pkgsrc uses the static linking method of the runtime
                   2651:             libraries provided by icc, so binaries can be run on
                   2652:             other systems which do not have the shared libraries
                   2653:             installed.</p>
                   2654: 
                   2655:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2656:             the <a href=
                   2657:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2658:             <span class="citerefentry"><span class=
                   2659:             "refentrytitle">ld</span>(1)</span></a> command run
                   2660:             when linking a C++ shared library and records it,
                   2661:             throwing away the -Bstatic and -Bdynamic options
                   2662:             interspersed between the libraries. This means that
                   2663:             libtool-linked C++ shared libraries will have a runtime
                   2664:             dependency on the icc libraries until this is fixed in
                   2665:             libtool.</p>
1.22      tv       2666:           </div>
                   2667: 
1.57      minskim  2668:           <div class="sect2" lang="en">
1.22      tv       2669:             <div class="titlepage">
                   2670:               <div>
                   2671:                 <div>
1.57      minskim  2672:                   <h3 class="title"><a name=
1.30      wiz      2673:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2674:                 </div>
                   2675:               </div>
                   2676:             </div>
                   2677: 
                   2678:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2679: 
                   2680:             <p>Care should be taken so that the tools that this kit
                   2681:             installs do not conflict with the OpenBSD userland
                   2682:             tools. There are several steps:</p>
                   2683: 
                   2684:             <div class="orderedlist">
                   2685:               <ol type="1">
                   2686:                 <li>
                   2687:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2688:                   <code xmlns=
                   2689:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2690:                   "filename">/var/db/pkg</code>. It is therefore
                   2691:                   recommended that you choose a different location
                   2692:                   (e.g. <code xmlns=
                   2693:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2694:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2695:                   --pkgdbdir option to the bootstrap script.</p>
                   2696:                 </li>
                   2697: 
                   2698:                 <li>
                   2699:                   <p>If you do not intend to use the OpenBSD ports
                   2700:                   tools, it's probably a good idea to move them out
                   2701:                   of the way to avoid confusion, e.g.</p>
                   2702:                   <pre class="screen">
1.14      xtraeme  2703: <code class="prompt">#</code> <strong class=
                   2704: "userinput"><code>cd /usr/sbin</code></strong>
                   2705: <code class="prompt">#</code> <strong class=
                   2706: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2707: <code class="prompt">#</code> <strong class=
                   2708: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2709: <code class="prompt">#</code> <strong class=
                   2710: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2711: <code class="prompt">#</code> <strong class=
                   2712: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2713: </pre>
                   2714:                 </li>
                   2715: 
                   2716:                 <li>
1.45      wiz      2717:                   <p>An example <code xmlns=
                   2718:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2719:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2720:                   placed in <code xmlns=
                   2721:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2722:                   "filename">/etc/mk.conf.example</code> file when
                   2723:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2724:                   program uses <code xmlns=
                   2725:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2726:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2727:                   work around this by enclosing all the
                   2728:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2729:                   <pre class="programlisting">
1.51      rillig   2730:     .ifdef BSD_PKG_MK
                   2731:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2732:     .else
                   2733:     # OpenBSD stuff
                   2734:     .endif
1.1       grant    2735: </pre>
                   2736:                 </li>
                   2737:               </ol>
                   2738:             </div>
                   2739:           </div>
                   2740: 
1.57      minskim  2741:           <div class="sect2" lang="en">
1.1       grant    2742:             <div class="titlepage">
                   2743:               <div>
                   2744:                 <div>
1.57      minskim  2745:                   <h3 class="title"><a name=
1.30      wiz      2746:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2747:                 </div>
                   2748:               </div>
                   2749:             </div>
                   2750: 
                   2751:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2752:             sparc. You will need a working C compiler. Both gcc
                   2753:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2754: 
                   2755:             <p>The following packages are required on Solaris 8 for
                   2756:             the bootstrap process and to build packages.</p>
                   2757: 
                   2758:             <div class="itemizedlist">
                   2759:               <ul type="disc">
                   2760:                 <li>
                   2761:                   <p>SUNWsprot</p>
                   2762:                 </li>
                   2763: 
                   2764:                 <li>
                   2765:                   <p>SUNWarc</p>
                   2766:                 </li>
                   2767: 
                   2768:                 <li>
                   2769:                   <p>SUNWbtool</p>
                   2770:                 </li>
                   2771: 
                   2772:                 <li>
                   2773:                   <p>SUNWtoo</p>
                   2774:                 </li>
                   2775: 
                   2776:                 <li>
                   2777:                   <p>SUNWlibm</p>
                   2778:                 </li>
                   2779:               </ul>
                   2780:             </div>
                   2781: 
                   2782:             <p>Please note the use of GNU binutils on Solaris is
                   2783:             <span class="emphasis"><em>not</em></span>
                   2784:             supported.</p>
                   2785: 
1.57      minskim  2786:             <div class="sect3" lang="en">
1.1       grant    2787:               <div class="titlepage">
                   2788:                 <div>
                   2789:                   <div>
1.57      minskim  2790:                     <h4 class="title"><a name=
                   2791:                     "solaris-gcc-note"></a>3.2.7.1.&nbsp;If you are
                   2792:                     using gcc</h4>
1.1       grant    2793:                   </div>
                   2794:                 </div>
                   2795:               </div>
                   2796: 
                   2797:               <p>It makes life much simpler if you only use the
                   2798:               same gcc consistently for building all packages.</p>
                   2799: 
                   2800:               <p>It is recommended that an external gcc be used
                   2801:               only for bootstrapping, then either build gcc from
                   2802:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2803:               href=
                   2804:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2805:               target="_top"><code xmlns="" class=
                   2806:               "filename">lang/gcc</code></a> or install a binary
                   2807:               gcc package, then remove gcc used during
1.20      ben      2808:               bootstrapping.</p>
1.1       grant    2809: 
                   2810:               <p>Binary packages of gcc can be found through
                   2811:               <a href=
                   2812:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2813:               target=
                   2814:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2815:             </div>
                   2816: 
1.57      minskim  2817:             <div class="sect3" lang="en">
1.1       grant    2818:               <div class="titlepage">
                   2819:                 <div>
                   2820:                   <div>
1.30      wiz      2821:                     <h4 class="title"><a name=
                   2822:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2823:                     you are using Sun WorkShop</h4>
1.1       grant    2824:                   </div>
                   2825:                 </div>
                   2826:               </div>
                   2827: 
                   2828:               <p>You will need at least the following packages
                   2829:               installed (from WorkShop 5.0)</p>
                   2830: 
                   2831:               <div class="itemizedlist">
                   2832:                 <ul type="disc">
                   2833:                   <li>
                   2834:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2835:                   </li>
                   2836: 
                   2837:                   <li>
                   2838:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2839:                   </li>
                   2840: 
                   2841:                   <li>
                   2842:                     <p>SPROild - Sun WorkShop Incremental
                   2843:                     Linker</p>
                   2844:                   </li>
                   2845: 
                   2846:                   <li>
                   2847:                     <p>SPROlang - Sun WorkShop Compilers common
                   2848:                     components</p>
                   2849:                   </li>
                   2850:                 </ul>
                   2851:               </div>
                   2852: 
1.14      xtraeme  2853:               <p>You should set <code class="varname">CC</code>,
                   2854:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2855:               <code class="varname">CPP</code> in <code xmlns=
                   2856:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2857:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2858:               <pre class="programlisting">
1.51      rillig   2859:     CC=     cc
                   2860:     CXX=    CC
                   2861:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2862: </pre>
                   2863: 
                   2864:               <p>You may also want to build 64-bit binaries,
1.47      reed     2865:               e.g.:</p>
1.1       grant    2866:               <pre class="programlisting">
1.51      rillig   2867:     CFLAGS= -xtarget=ultra -xarch=v9
1.1       grant    2868: </pre>
                   2869: 
                   2870:               <p>Whichever compiler you use, please ensure the
                   2871:               compiler tools and your $prefix are in your
1.14      xtraeme  2872:               <code class="varname">PATH</code>. This includes
1.45      wiz      2873:               <code xmlns=
                   2874:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2875:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2876:               <code xmlns=
                   2877:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2878:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2879:             </div>
                   2880:           </div>
                   2881:         </div>
                   2882:       </div>
                   2883: 
1.57      minskim  2884:       <div class="chapter" lang="en">
1.1       grant    2885:         <div class="titlepage">
                   2886:           <div>
                   2887:             <div>
1.57      minskim  2888:               <h2 class="title"><a name=
1.1       grant    2889:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2890:             </div>
                   2891:           </div>
                   2892:         </div>
                   2893: 
                   2894:         <div class="toc">
                   2895:           <p><b>Table of Contents</b></p>
                   2896: 
                   2897:           <dl>
                   2898:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2899:             Working with binary packages</a></span></dt>
                   2900: 
                   2901:             <dd>
                   2902:               <dl>
1.30      wiz      2903:                 <dt><span class="sect2"><a href=
                   2904:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2905:                 binary packages</a></span></dt>
1.1       grant    2906: 
1.30      wiz      2907:                 <dt><span class="sect2"><a href=
                   2908:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2909:                 binary packages</a></span></dt>
1.1       grant    2910: 
1.30      wiz      2911:                 <dt><span class="sect2"><a href=
                   2912:                 "#a-word-of-warning">4.1.3. A word of
                   2913:                 warning</a></span></dt>
1.1       grant    2914:               </dl>
                   2915:             </dd>
                   2916: 
1.30      wiz      2917:             <dt><span class="sect1"><a href=
                   2918:             "#building-packages-from-source">4.2. Building packages
                   2919:             from source</a></span></dt>
1.1       grant    2920: 
                   2921:             <dd>
                   2922:               <dl>
1.30      wiz      2923:                 <dt><span class="sect2"><a href=
                   2924:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2925: 
1.30      wiz      2926:                 <dt><span class="sect2"><a href=
                   2927:                 "#fetching-distfiles">4.2.2. Fetching
                   2928:                 distfiles</a></span></dt>
1.1       grant    2929: 
1.30      wiz      2930:                 <dt><span class="sect2"><a href=
                   2931:                 "#how-to-build-and-install">4.2.3. How to build and
                   2932:                 install</a></span></dt>
1.1       grant    2933: 
1.30      wiz      2934:                 <dt><span class="sect2"><a href=
                   2935:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2936:                 compiler</a></span></dt>
1.1       grant    2937:               </dl>
                   2938:             </dd>
                   2939:           </dl>
                   2940:         </div>
                   2941: 
1.57      minskim  2942:         <div class="sect1" lang="en">
1.1       grant    2943:           <div class="titlepage">
                   2944:             <div>
                   2945:               <div>
                   2946:                 <h2 class="title" style="clear: both"><a name=
                   2947:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2948:                 packages</h2>
                   2949:               </div>
                   2950:             </div>
                   2951:           </div>
                   2952: 
                   2953:           <p>This section describes how to find, retrieve and
                   2954:           install a precompiled binary package that someone else
                   2955:           already prepared for your type of machine.</p>
                   2956: 
1.57      minskim  2957:           <div class="sect2" lang="en">
1.1       grant    2958:             <div class="titlepage">
                   2959:               <div>
                   2960:                 <div>
1.30      wiz      2961:                   <h3 class="title"><a name=
                   2962:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   2963:                   to get binary packages</h3>
1.1       grant    2964:                 </div>
                   2965:               </div>
                   2966:             </div>
                   2967: 
                   2968:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      2969:             and its mirrors in the directory <code xmlns=
                   2970:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   2971:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   2972:             for anonymous FTP access. <code class=
                   2973:             "varname">OSVERSION</code> is the NetBSD version
                   2974:             (<span><strong class="command">uname
                   2975:             -r</strong></span>), <code class="varname">ARCH</code>
                   2976:             is the architecture (<span><strong class=
                   2977:             "command">uname -p</strong></span>). In that directory,
                   2978:             there is a subdirectory for each category plus a
1.45      wiz      2979:             subdirectory <code xmlns=
                   2980:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2981:             "filename">All</code> which includes the actual
                   2982:             binaries in <code xmlns=
                   2983:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   2984:             "filename">.tgz</code> files. The category
                   2985:             subdirectories use symbolic links to those files (this
1.45      wiz      2986:             is the same directory layout as in <code xmlns=
                   2987:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2988:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2989: 
1.47      reed     2990:             <p>This same directory layout applies for CD-ROM
1.1       grant    2991:             distributions, only that the directory may be rooted
1.45      wiz      2992:             somewhere else, probably somewhere below <code xmlns=
                   2993:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2994:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    2995:             documentation for the exact location.</p>
                   2996:           </div>
                   2997: 
1.57      minskim  2998:           <div class="sect2" lang="en">
1.1       grant    2999:             <div class="titlepage">
                   3000:               <div>
                   3001:                 <div>
1.30      wiz      3002:                   <h3 class="title"><a name=
                   3003:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   3004:                   to use binary packages</h3>
1.1       grant    3005:                 </div>
                   3006:               </div>
                   3007:             </div>
                   3008: 
1.47      reed     3009:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3010:             to your hard disk, you can install them with the
1.27      rillig   3011:             following command (be sure to <span><strong class=
1.14      xtraeme  3012:             "command">su</strong></span> to root first):</p>
1.1       grant    3013:             <pre class="screen">
1.14      xtraeme  3014: <code class="prompt">#</code> <strong class=
                   3015: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3016: </pre>
                   3017: 
                   3018:             <p>If you have FTP access and you don't want to
                   3019:             download the packages via FTP prior to installation,
1.14      xtraeme  3020:             you can do this automatically by giving
                   3021:             <span><strong class="command">pkg_add</strong></span>
                   3022:             an FTP URL:</p>
1.1       grant    3023:             <pre class="screen">
1.14      xtraeme  3024: <code class="prompt">#</code> <strong class=
1.27      rillig   3025: "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    3026: </pre>
                   3027: 
1.27      rillig   3028:             <p>Note that any prerequisite packages needed to run
                   3029:             the package in question will be installed, too,
1.1       grant    3030:             assuming they are present where you install from.</p>
                   3031: 
1.23      wiz      3032:             <p>To save some typing, you can set the <code class=
                   3033:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3034:             semicolon-separated list of paths (including remote
1.23      wiz      3035:             URLs); trailing slashes are not allowed.</p>
                   3036: 
1.45      wiz      3037:             <p>Additionally to the <code xmlns=
                   3038:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3039:             "filename">All</code> directory there exists a
1.45      wiz      3040:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3041:             class="filename">vulnerable</code> directory to which
                   3042:             binary packages with known vulnerabilities are moved,
                   3043:             since removing them could cause missing dependencies.
                   3044:             To use these packages, add the <code xmlns=
                   3045:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3046:             "filename">vulnerable</code> directory to your
                   3047:             <code class="varname">PKG_PATH</code>. However, you
                   3048:             should run <a xmlns=
1.23      wiz      3049:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3050:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3051:             target="_top"><code xmlns="" class=
                   3052:             "filename">security/audit-packages</code></a>
1.47      reed     3053:             regularly, especially after installing new packages,
                   3054:             and verify that the vulnerabilities are acceptable for
                   3055:             your configuration. An example <code class=
                   3056:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3057:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3058:             "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      3059:             Please note that semicolon (';') is a shell
                   3060:             meta-character, so you'll probably have to quote
                   3061:             it.</p>
                   3062: 
1.1       grant    3063:             <p>After you've installed packages, be sure to have
1.45      wiz      3064:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3065:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3066:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3067:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3068:             "varname">PATH</code> so you can actually start the
                   3069:             just installed program.</p>
1.1       grant    3070:           </div>
                   3071: 
1.57      minskim  3072:           <div class="sect2" lang="en">
1.1       grant    3073:             <div class="titlepage">
                   3074:               <div>
                   3075:                 <div>
1.57      minskim  3076:                   <h3 class="title"><a name=
1.30      wiz      3077:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3078:                   warning</h3>
                   3079:                 </div>
                   3080:               </div>
                   3081:             </div>
                   3082: 
                   3083:             <p>Please pay very careful attention to the warnings
                   3084:             expressed in the <a href=
                   3085:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3086:             <span class="citerefentry"><span class=
                   3087:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3088:             page about the inherent dangers of installing binary
                   3089:             packages which you did not create yourself, and the
                   3090:             security holes that can be introduced onto your system
                   3091:             by indiscriminate adding of such files.</p>
                   3092:           </div>
                   3093:         </div>
                   3094: 
1.57      minskim  3095:         <div class="sect1" lang="en">
1.1       grant    3096:           <div class="titlepage">
                   3097:             <div>
                   3098:               <div>
                   3099:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3100:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3101:                 packages from source</h2>
                   3102:               </div>
                   3103:             </div>
                   3104:           </div>
                   3105: 
                   3106:           <p>This assumes that the package is already in pkgsrc. If
                   3107:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3108:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3109:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3110:           instructions how to create your own packages.</p>
1.1       grant    3111: 
1.57      minskim  3112:           <div class="sect2" lang="en">
1.1       grant    3113:             <div class="titlepage">
                   3114:               <div>
                   3115:                 <div>
1.57      minskim  3116:                   <h3 class="title"><a name=
1.30      wiz      3117:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3118:                 </div>
                   3119:               </div>
                   3120:             </div>
                   3121: 
                   3122:             <p>To build packages from source on a NetBSD system the
                   3123:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3124:             &#8220;<span class="quote">text</span>&#8221;
                   3125:             distribution sets must be installed. If you want to
1.47      reed     3126:             build X11-related packages the &#8220;<span class=
1.1       grant    3127:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3128:             "quote">xcomp</span>&#8221; distribution sets are
                   3129:             required, too.</p>
                   3130:           </div>
                   3131: 
1.57      minskim  3132:           <div class="sect2" lang="en">
1.1       grant    3133:             <div class="titlepage">
                   3134:               <div>
                   3135:                 <div>
1.57      minskim  3136:                   <h3 class="title"><a name=
                   3137:                   "fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3138:                   distfiles</h3>
                   3139:                 </div>
                   3140:               </div>
                   3141:             </div>
                   3142: 
1.27      rillig   3143:             <p>The first step for building a package is downloading
                   3144:             the distfiles (i.e. the unmodified source). If they
                   3145:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3146:             automatically.</p>
                   3147: 
                   3148:             <p>You can overwrite some of the major distribution
                   3149:             sites to fit to sites that are close to your own. Have
1.45      wiz      3150:             a look at <code xmlns=
                   3151:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3152:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3153:             some examples &#8212; in particular, look for the
1.14      xtraeme  3154:             <code class="varname">MASTER_SORT</code>, <code class=
                   3155:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3156:             "varname">INET_COUNTRY</code> definitions. This may
                   3157:             save some of your bandwidth and time.</p>
1.1       grant    3158: 
                   3159:             <p>You can change these settings either in your shell's
                   3160:             environment, or, if you want to keep the settings, by
1.45      wiz      3161:             editing the <code xmlns=
                   3162:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3163:             "filename">/etc/mk.conf</code> file, and adding the
                   3164:             definitions there.</p>
1.1       grant    3165: 
                   3166:             <p>If you don't have a permanent Internet connection
                   3167:             and you want to know which files to download,
1.14      xtraeme  3168:             <span><strong class="command">make
                   3169:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3170:             need. Put these distfiles into <code xmlns=
                   3171:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3172:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3173:           </div>
                   3174: 
1.57      minskim  3175:           <div class="sect2" lang="en">
1.1       grant    3176:             <div class="titlepage">
                   3177:               <div>
                   3178:                 <div>
1.30      wiz      3179:                   <h3 class="title"><a name=
                   3180:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3181:                   build and install</h3>
1.1       grant    3182:                 </div>
                   3183:               </div>
                   3184:             </div>
                   3185: 
                   3186:             <p>Assuming that the distfile has been fetched (see
                   3187:             previous section), become root and change into the
1.47      reed     3188:             relevant directory and run <span><strong class=
                   3189:             "command">make</strong></span>.</p>
                   3190: 
                   3191:             <div class="note" style=
                   3192:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3193:               <h3 class="title">Note</h3>
                   3194: 
                   3195:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3196:               system, use the pkgsrc <span><strong class=
                   3197:               "command">bmake</strong></span> command instead of
                   3198:               &#8220;<span class="quote">make</span>&#8221; in the
                   3199:               examples in this guide.</p>
                   3200:             </div>
                   3201: 
                   3202:             <p>For example, type</p>
1.1       grant    3203:             <pre class="screen">
1.14      xtraeme  3204: <code class="prompt">%</code> <strong class=
                   3205: "userinput"><code>cd misc/figlet</code></strong>
                   3206: <code class="prompt">%</code> <strong class=
                   3207: "userinput"><code>make</code></strong>
1.1       grant    3208: </pre>
                   3209: 
                   3210:             <p>at the shell prompt to build the various components
                   3211:             of the package, and</p>
                   3212:             <pre class="screen">
1.14      xtraeme  3213: <code class="prompt">#</code> <strong class=
                   3214: "userinput"><code>make install</code></strong>
1.1       grant    3215: </pre>
                   3216: 
                   3217:             <p>to install the various components into the correct
                   3218:             places on your system. Installing the package on your
                   3219:             system requires you to be root. However, pkgsrc has a
                   3220:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3221:             feature, which allows you to only become root for the
                   3222:             actual installation step</p>
                   3223: 
                   3224:             <p>Taking the figlet utility as an example, we can
                   3225:             install it on our system by building as shown in
                   3226:             <a href="#logs" title=
1.57      minskim  3227:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix&nbsp;B,
                   3228:             <i>Build logs</i></a>.</p>
1.1       grant    3229: 
                   3230:             <p>The program is installed under the default root of
1.45      wiz      3231:             the packages tree - <code xmlns=
                   3232:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3233:             "filename">/usr/pkg</code>. Should this not conform to
                   3234:             your tastes, set the <code class=
                   3235:             "varname">LOCALBASE</code> variable in your
1.1       grant    3236:             environment, and it will use that value as the root of
1.45      wiz      3237:             your packages tree. So, to use <code xmlns=
                   3238:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3239:             "filename">/usr/local</code>, set <code class=
                   3240:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3241:             environment. Please note that you should use a
                   3242:             directory which is dedicated to packages and not shared
1.47      reed     3243:             with other programs (i.e., do not try and use
1.14      xtraeme  3244:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3245:             should not try to add any of your own files or
1.45      wiz      3246:             directories (such as <code xmlns=
                   3247:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3248:             "filename">src/</code>, <code xmlns=
                   3249:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3250:             "filename">obj/</code>, or <code xmlns=
                   3251:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3252:             "filename">pkgsrc/</code>) below the <code class=
                   3253:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3254:             possible conflicts between programs and other files
                   3255:             installed by the package system and whatever else may
                   3256:             have been installed there.</p>
                   3257: 
1.45      wiz      3258:             <p>Some packages look in <code xmlns=
                   3259:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3260:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3261:             configuration options at build time. Have a look at
1.45      wiz      3262:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3263:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3264:             get an overview of what will be set there by default.
1.14      xtraeme  3265:             Environment variables such as <code class=
1.45      wiz      3266:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3267:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3268:             "filename">/etc/mk.conf</code> to save having to
                   3269:             remember to set them each time you want to use
                   3270:             pkgsrc.</p>
1.1       grant    3271: 
                   3272:             <p>Occasionally, people want to &#8220;<span class=
                   3273:             "quote">look under the covers</span>&#8221; to see what
                   3274:             is going on when a package is building or being
                   3275:             installed. This may be for debugging purposes, or out
                   3276:             of simple curiosity. A number of utility values have
                   3277:             been added to help with this.</p>
                   3278: 
                   3279:             <div class="orderedlist">
                   3280:               <ol type="1">
                   3281:                 <li>
                   3282:                   <p>If you invoke the <a href=
                   3283:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3284:                   <span class="citerefentry"><span class=
                   3285:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3286:                   with <code class=
                   3287:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3288:                   amount of information will be displayed. For
                   3289:                   example,</p>
1.1       grant    3290:                   <pre class="screen">
1.14      xtraeme  3291: <strong class=
                   3292: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3293: </pre>
                   3294: 
                   3295:                   <p>will show all the commands that are invoked,
                   3296:                   up to and including the &#8220;<span class=
                   3297:                   "quote">patch</span>&#8221; stage.</p>
                   3298:                 </li>
                   3299: 
                   3300:                 <li>
                   3301:                   <p>If you want to know the value of a certain
1.22      tv       3302:                   <a href=
                   3303:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3304:                   <span class="citerefentry"><span class=
                   3305:                   "refentrytitle">make</span>(1)</span></a>
                   3306:                   definition, then the <code class=
1.14      xtraeme  3307:                   "varname">VARNAME</code> definition should be
                   3308:                   used, in conjunction with the show-var target.
                   3309:                   e.g. to show the expansion of the <a href=
1.1       grant    3310:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3311:                   <span class="citerefentry"><span class=
                   3312:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3313:                   variable <code class=
1.22      tv       3314:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3315:                   <pre class="screen">
1.14      xtraeme  3316: <code class="prompt">%</code> <strong class=
                   3317: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3318: /usr/pkg
1.14      xtraeme  3319: <code class="prompt">%</code>
1.1       grant    3320:           
                   3321: </pre>
                   3322:                 </li>
                   3323:               </ol>
                   3324:             </div>
                   3325: 
                   3326:             <p>If you want to install a binary package that you've
                   3327:             either created yourself (see next section), that you
                   3328:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3329:             a remote FTP server, you can use the "bin-install"
1.1       grant    3330:             target. This target will install a binary package - if
                   3331:             available - via <a href=
                   3332:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3333:             <span class="citerefentry"><span class=
                   3334:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3335:             <span><strong class="command">make
                   3336:             package</strong></span>. The list of remote FTP sites
                   3337:             searched is kept in the variable <code class=
                   3338:             "varname">BINPKG_SITES</code>, which defaults to
                   3339:             ftp.NetBSD.org. Any flags that should be added to
                   3340:             <a href=
1.1       grant    3341:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3342:             <span class="citerefentry"><span class=
                   3343:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3344:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3345:             See <code xmlns=
                   3346:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3347:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3348:             details.</p>
1.1       grant    3349: 
1.47      reed     3350:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3351:             has a non-standard setting for <code class=
                   3352:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3353:             any packages are installed, as you can not use several
                   3354:             directories for the same purpose. Doing so will result
                   3355:             in pkgsrc not being able to properly detect your
                   3356:             installed packages, and fail miserably. Note also that
                   3357:             precompiled binary packages are usually built with the
1.14      xtraeme  3358:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3359:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3360:             class="filename">/usr/pkg</code>, and that you should
                   3361:             <span class="emphasis"><em>not</em></span> install any
                   3362:             if you use a non-standard <code class=
1.14      xtraeme  3363:             "varname">LOCALBASE</code>.</p>
1.1       grant    3364:           </div>
                   3365: 
1.57      minskim  3366:           <div class="sect2" lang="en">
1.1       grant    3367:             <div class="titlepage">
                   3368:               <div>
                   3369:                 <div>
1.30      wiz      3370:                   <h3 class="title"><a name=
                   3371:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3372:                   the compiler</h3>
1.1       grant    3373:                 </div>
                   3374:               </div>
                   3375:             </div>
                   3376: 
                   3377:             <p>By default, pkgsrc will use GCC to build packages.
                   3378:             This may be overridden by setting the following
                   3379:             variables in /etc/mk.conf:</p>
                   3380: 
                   3381:             <div class="variablelist">
                   3382:               <dl>
1.14      xtraeme  3383:                 <dt><span class="term"><code class=
                   3384:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3385: 
                   3386:                 <dd>
                   3387:                   <p>This is a list of values specifying the chain
                   3388:                   of compilers to invoke when building packages.
                   3389:                   Valid values are:</p>
                   3390: 
                   3391:                   <div class="itemizedlist">
                   3392:                     <ul type="disc">
                   3393:                       <li>
1.14      xtraeme  3394:                         <p><code class="varname">distcc</code>:
1.1       grant    3395:                         distributed C/C++ (chainable)</p>
                   3396:                       </li>
                   3397: 
                   3398:                       <li>
1.14      xtraeme  3399:                         <p><code class="varname">ccache</code>:
1.1       grant    3400:                         compiler cache (chainable)</p>
                   3401:                       </li>
                   3402: 
                   3403:                       <li>
1.14      xtraeme  3404:                         <p><code class="varname">gcc</code>: GNU
                   3405:                         C/C++ Compiler</p>
1.1       grant    3406:                       </li>
                   3407: 
                   3408:                       <li>
1.14      xtraeme  3409:                         <p><code class="varname">mipspro</code>:
1.1       grant    3410:                         Silicon Graphics, Inc. MIPSpro
                   3411:                         (n32/n64)</p>
                   3412:                       </li>
                   3413: 
                   3414:                       <li>
1.14      xtraeme  3415:                         <p><code class="varname">mipspro</code>:
1.1       grant    3416:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3417:                       </li>
                   3418: 
                   3419:                       <li>
1.14      xtraeme  3420:                         <p><code class="varname">sunpro</code>:
1.1       grant    3421:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3422:                         Studio</p>
                   3423:                       </li>
                   3424:                     </ul>
                   3425:                   </div>
                   3426: 
                   3427:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3428:                   "quote"><code class=
                   3429:                   "varname">gcc</code></span>&#8221;. You can use
                   3430:                   <code class="varname">ccache</code> and/or
                   3431:                   <code class="varname">distcc</code> with an
                   3432:                   appropriate <code class=
                   3433:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3434:                   &#8220;<span class="quote"><code class=
                   3435:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3436:                   variable should always be terminated with a value
                   3437:                   for a real compiler.</p>
                   3438:                 </dd>
                   3439: 
1.14      xtraeme  3440:                 <dt><span class="term"><code class=
                   3441:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3442: 
                   3443:                 <dd>
                   3444:                   <p>This specifies the minimum version of GCC to
                   3445:                   use when building packages. If the system GCC
                   3446:                   doesn't satisfy this requirement, then pkgsrc
                   3447:                   will build and install one of the GCC packages to
                   3448:                   use instead.</p>
                   3449:                 </dd>
                   3450:               </dl>
                   3451:             </div>
                   3452:           </div>
                   3453:         </div>
                   3454:       </div>
                   3455: 
1.57      minskim  3456:       <div class="chapter" lang="en">
1.1       grant    3457:         <div class="titlepage">
                   3458:           <div>
                   3459:             <div>
1.57      minskim  3460:               <h2 class="title"><a name=
1.38      dillo    3461:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3462:               pkgsrc</h2>
                   3463:             </div>
                   3464:           </div>
                   3465:         </div>
                   3466: 
                   3467:         <div class="toc">
                   3468:           <p><b>Table of Contents</b></p>
                   3469: 
                   3470:           <dl>
                   3471:             <dt><span class="sect1"><a href=
1.45      wiz      3472:             "#general-configuration">5.1. General
                   3473:             configuration</a></span></dt>
                   3474: 
                   3475:             <dt><span class="sect1"><a href=
                   3476:             "#variables-affecting-build">5.2. Variables affecting
                   3477:             the build process</a></span></dt>
                   3478: 
                   3479:             <dt><span class="sect1"><a href=
                   3480:             "#developer-advanced-settings">5.3. Developer/advanced
                   3481:             settings</a></span></dt>
                   3482: 
                   3483:             <dt><span class="sect1"><a href=
                   3484:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3485:             Options</a></span></dt>
1.38      dillo    3486:           </dl>
                   3487:         </div>
                   3488: 
1.57      minskim  3489:         <div class="sect1" lang="en">
1.38      dillo    3490:           <div class="titlepage">
                   3491:             <div>
                   3492:               <div>
                   3493:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3494:                 "general-configuration"></a>5.1.&nbsp;General
                   3495:                 configuration</h2>
                   3496:               </div>
                   3497:             </div>
                   3498:           </div>
                   3499: 
1.47      reed     3500:           <p>In this section, you can find some variables that
                   3501:           apply to all pkgsrc packages. The preferred method of
                   3502:           setting these variables is by setting them in
                   3503:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3504:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3505: 
                   3506:           <div class="itemizedlist">
                   3507:             <ul type="disc">
                   3508:               <li>
                   3509:                 <p><code class="varname">LOCALBASE</code>: Where
                   3510:                 packages will be installed. The default is
                   3511:                 <code xmlns=
                   3512:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3513:                 "filename">/usr/pkg</code>. Do not mix binary
                   3514:                 packages with different <code class=
                   3515:                 "varname">LOCALBASE</code>s!</p>
                   3516:               </li>
                   3517: 
                   3518:               <li>
                   3519:                 <p><code class="varname">CROSSBASE</code>: Where
                   3520:                 &#8220;<span class="quote">cross</span>&#8221;
                   3521:                 category packages will be installed. The default is
                   3522:                 <code xmlns=
                   3523:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3524:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3525:               </li>
                   3526: 
                   3527:               <li>
                   3528:                 <p><code class="varname">X11BASE</code>: Where X11
                   3529:                 is installed on the system. The default is
                   3530:                 <code xmlns=
                   3531:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3532:                 "filename">/usr/X11R6</code>.</p>
                   3533:               </li>
                   3534: 
                   3535:               <li>
                   3536:                 <p><code class="varname">DISTDIR</code>: Where to
                   3537:                 store the downloaded copies of the original source
                   3538:                 distributions used for building pkgsrc packages.
                   3539:                 The default is <code xmlns=
                   3540:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3541:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3542:               </li>
                   3543: 
                   3544:               <li>
                   3545:                 <p><code class=
                   3546:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3547:                 override the packages' <code class=
                   3548:                 "varname">MASTER_SITES</code> with this value.</p>
                   3549:               </li>
                   3550: 
                   3551:               <li>
                   3552:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3553:                 Backup location(s) for distribution files and patch
                   3554:                 files if not found locally or in <code xmlns=
                   3555:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3556:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3557:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3558:                 "filename">${PATCH_SITES}</code> respectively. The
                   3559:                 defaults are <code xmlns=
                   3560:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3561:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3562:                 and <code xmlns=
                   3563:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3564:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3565:               </li>
                   3566: 
                   3567:               <li>
                   3568:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3569:                 of sites carrying binary pkgs.</p>
                   3570:               </li>
                   3571:             </ul>
                   3572:           </div>
                   3573:         </div>
                   3574: 
1.57      minskim  3575:         <div class="sect1" lang="en">
1.45      wiz      3576:           <div class="titlepage">
                   3577:             <div>
                   3578:               <div>
                   3579:                 <h2 class="title" style="clear: both"><a name=
                   3580:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3581:                 affecting the build process</h2>
                   3582:               </div>
                   3583:             </div>
                   3584:           </div>
                   3585: 
                   3586:           <p>XXX</p>
                   3587: 
                   3588:           <div class="itemizedlist">
                   3589:             <ul type="disc">
                   3590:               <li>
                   3591:                 <p><code class="varname">PACKAGES</code>: The top
                   3592:                 level directory for the binary packages. The
                   3593:                 default is <code xmlns=
                   3594:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3595:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3596:               </li>
                   3597: 
                   3598:               <li>
                   3599:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3600:                 level directory where, if defined, the separate
                   3601:                 working directories will get created, and
                   3602:                 symbolically linked to from <code xmlns=
                   3603:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3604:                 "filename">${WRKDIR}</code> (see below). This is
                   3605:                 useful for building packages on several
                   3606:                 architectures, then <code xmlns=
                   3607:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3608:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3609:                 while <code xmlns=
                   3610:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3611:                 "filename">${WRKOBJDIR}</code> is local to every
                   3612:                 architecture. (It should be noted that <code class=
                   3613:                 "varname">PKGSRCDIR</code> should not be set by the
                   3614:                 user &#8212; it is an internal definition which
                   3615:                 refers to the root of the pkgsrc tree. It is
                   3616:                 possible to have many pkgsrc tree instances.)</p>
                   3617:               </li>
                   3618: 
                   3619:               <li>
                   3620:                 <p><code class="varname">LOCALPATCHES</code>:
                   3621:                 Directory for local patches that aren't part of
                   3622:                 pkgsrc. See <a href="#components.patches" title=
                   3623:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3624:                 &#8220;patches/*&#8221;</a> for more information.
                   3625:                 <em class="replaceable"><code>rel</code></em> and
                   3626:                 <em class="replaceable"><code>arch</code></em> are
                   3627:                 replaced with OS release (&#8220;<span class=
                   3628:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3629:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3630:                 etc.).</p>
                   3631:               </li>
                   3632: 
                   3633:               <li>
                   3634:                 <p><code class="varname">PKGMAKECONF</code>:
                   3635:                 Location of the <code xmlns=
                   3636:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3637:                 "filename">mk.conf</code> file used by a package's
                   3638:                 BSD-style Makefile. If this is not set,
                   3639:                 <code class="varname">MAKECONF</code> is set to
                   3640:                 <code xmlns=
                   3641:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3642:                 "filename">/dev/null</code> to avoid picking up
                   3643:                 settings used by builds in <code xmlns=
                   3644:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3645:                 "filename">/usr/src</code>.</p>
                   3646:               </li>
                   3647:             </ul>
                   3648:           </div>
                   3649:         </div>
                   3650: 
1.57      minskim  3651:         <div class="sect1" lang="en">
1.45      wiz      3652:           <div class="titlepage">
                   3653:             <div>
                   3654:               <div>
                   3655:                 <h2 class="title" style="clear: both"><a name=
                   3656:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3657:                 settings</h2>
                   3658:               </div>
                   3659:             </div>
                   3660:           </div>
                   3661: 
                   3662:           <p>XXX</p>
                   3663: 
                   3664:           <div class="itemizedlist">
                   3665:             <ul type="disc">
                   3666:               <li>
                   3667:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3668:                 some sanity checks that package developers
                   3669:                 want:</p>
                   3670: 
                   3671:                 <div class="itemizedlist">
                   3672:                   <ul type="circle">
                   3673:                     <li>
                   3674:                       <p>make sure patches apply with zero fuzz</p>
                   3675:                     </li>
                   3676: 
                   3677:                     <li>
                   3678:                       <p>run check-shlibs to see that all binaries
                   3679:                       will find their shared libs.</p>
                   3680:                     </li>
                   3681:                   </ul>
                   3682:                 </div>
                   3683:               </li>
                   3684: 
                   3685:               <li>
                   3686:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3687:                 The level of debugging output which is displayed
                   3688:                 whilst making and installing the package. The
                   3689:                 default value for this is 0, which will not display
                   3690:                 the commands as they are executed (normal, default,
                   3691:                 quiet operation); the value 1 will display all
                   3692:                 shell commands before their invocation, and the
                   3693:                 value 2 will display both the shell commands before
                   3694:                 their invocation, and their actual execution
                   3695:                 progress with <span><strong class="command">set
                   3696:                 -x</strong></span> will be displayed.</p>
                   3697:               </li>
1.58    ! erh      3698: 
        !          3699:               <li>
        !          3700:                 <p><code class=
        !          3701:                 "varname">ALLOW_VULNERABILITIES.<em class=
        !          3702:                 "replaceable"><code>pkgbase</code></em></code>: A
        !          3703:                 space separated list of vulnerability IDs that may
        !          3704:                 be ignored when performing the automated security
        !          3705:                 checks. These IDs are listed in the
        !          3706:                 pkg-vulnerabilities file and are displayed by
        !          3707:                 <span><strong class=
        !          3708:                 "command">audit-packages</strong></span> when it
        !          3709:                 finds a vulnerable package.</p>
        !          3710:               </li>
        !          3711: 
        !          3712:               <li>
        !          3713:                 <p><code class=
        !          3714:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
        !          3715:                 set to &#8220;<span class=
        !          3716:                 "quote">yes</span>&#8221;, the automated security
        !          3717:                 checks (which use the <a xmlns=
        !          3718:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          3719:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
        !          3720:                 target="_top"><code xmlns="" class=
        !          3721:                 "filename">security/audit-packages</code></a>
        !          3722:                 package) will be <span class=
        !          3723:                 "strong"><strong>entirely</strong></span> skipped
        !          3724:                 for <span class=
        !          3725:                 "strong"><strong>all</strong></span> packages
        !          3726:                 built. Normally you'll want to use
        !          3727:                 ALLOW_VULNERABILITIES instead of this.</p>
        !          3728:               </li>
1.45      wiz      3729:             </ul>
                   3730:           </div>
                   3731:         </div>
                   3732: 
1.57      minskim  3733:         <div class="sect1" lang="en">
1.45      wiz      3734:           <div class="titlepage">
                   3735:             <div>
                   3736:               <div>
                   3737:                 <h2 class="title" style="clear: both"><a name=
                   3738:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3739:                 Build Options</h2>
1.38      dillo    3740:               </div>
                   3741:             </div>
                   3742:           </div>
                   3743: 
                   3744:           <p>Some packages have build time options, usually to
                   3745:           select between different dependencies, enable optional
                   3746:           support for big dependencies or enable experimental
                   3747:           features.</p>
                   3748: 
                   3749:           <p>To see which options, if any, a package supports, and
                   3750:           which options are mutually exclusive, run
                   3751:           <span><strong class="command">make
                   3752:           show-options</strong></span>, for example:</p>
                   3753:           <pre class="programlisting">
1.51      rillig   3754:     The following options are supported by this package:
                   3755:     ssl      Enable SSL support.
                   3756:     Exactly one of the following gecko options is required:
                   3757:     firefox  Use firefox as gecko rendering engine.
                   3758:     mozilla  Use mozilla as gecko rendering engine.
                   3759:     At most one of the following database options may be selected:
                   3760:     mysql    Enable support for MySQL database.
                   3761:     pgsql    Enable support for PostgreSQL database.
                   3762: 
                   3763:     These options are enabled by default: firefox
                   3764:     These options are currently enabled: mozilla ssl
1.38      dillo    3765: </pre>
                   3766: 
1.45      wiz      3767:           <p>The following variables can be defined in <code xmlns=
                   3768:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3769:           "filename">/etc/mk.conf</code> to select which options to
                   3770:           enable for a package: <code class=
                   3771:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3772:           to select or disable options for all packages that
                   3773:           support them, and <code class=
                   3774:           "varname">PKG_OPTIONS.<em class=
                   3775:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3776:           be used to select or disable options specifically for
                   3777:           package <em class=
                   3778:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3779:           in these variables are selected, options preceded by
                   3780:           &#8220;<span class="quote">-</span>&#8221; are
                   3781:           disabled.</p>
                   3782: 
1.39      dillo    3783:           <p>The following settings are consulted in the order
                   3784:           given, and the last setting that selects or disables an
                   3785:           option is used:</p>
1.38      dillo    3786: 
                   3787:           <div class="orderedlist">
                   3788:             <ol type="1">
                   3789:               <li>
                   3790:                 <p>the default options as suggested by the package
                   3791:                 maintainer</p>
                   3792:               </li>
                   3793: 
                   3794:               <li>
                   3795:                 <p>the options implied by the settings of legacy
                   3796:                 variables (see below)</p>
                   3797:               </li>
                   3798: 
                   3799:               <li>
                   3800:                 <p><code class=
                   3801:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3802:               </li>
                   3803: 
                   3804:               <li>
                   3805:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3806:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3807:               </li>
                   3808:             </ol>
                   3809:           </div>
                   3810: 
                   3811:           <p>For groups of mutually exclusive options, the last
                   3812:           option selected is used, all others are automatically
                   3813:           disabled. If an option of the group is explicitly
                   3814:           disabled, the previously selected option, if any, is
                   3815:           used. It is an error if no option from a required group
                   3816:           of options is selected, and building the package will
                   3817:           fail.</p>
                   3818: 
                   3819:           <p>Before the options framework was introduced, build
                   3820:           options were selected by setting a variable in
1.45      wiz      3821:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3822:           class="filename">/etc/mk.conf</code> for each option. To
                   3823:           ease transition to the options framework for the user,
                   3824:           these legacy variables are converted to the appropriate
                   3825:           options setting automatically. A warning is issued to
                   3826:           prompt the user to update <code xmlns=
                   3827:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3828:           "filename">/etc/mk.conf</code> to use the options
                   3829:           framework directly. Support for these legacy variables
                   3830:           will be removed eventually.</p>
                   3831:         </div>
                   3832:       </div>
                   3833: 
1.57      minskim  3834:       <div class="chapter" lang="en">
1.38      dillo    3835:         <div class="titlepage">
                   3836:           <div>
                   3837:             <div>
1.57      minskim  3838:               <h2 class="title"><a name=
1.38      dillo    3839:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3840:               packages</h2>
                   3841:             </div>
                   3842:           </div>
                   3843:         </div>
                   3844: 
                   3845:         <div class="toc">
                   3846:           <p><b>Table of Contents</b></p>
                   3847: 
                   3848:           <dl>
1.30      wiz      3849:             <dt><span class="sect1"><a href=
1.38      dillo    3850:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3851:             single binary package</a></span></dt>
1.1       grant    3852: 
1.30      wiz      3853:             <dt><span class="sect1"><a href=
1.38      dillo    3854:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3855:             Settings for creation of binary
                   3856:             packages</a></span></dt>
                   3857: 
1.38      dillo    3858:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3859:             a bulk build of all packages</a></span></dt>
                   3860: 
                   3861:             <dd>
                   3862:               <dl>
                   3863:                 <dt><span class="sect2"><a href=
1.38      dillo    3864:                 "#binary.configuration">6.3.1.
1.1       grant    3865:                 Configuration</a></span></dt>
                   3866: 
1.30      wiz      3867:                 <dt><span class="sect2"><a href=
1.38      dillo    3868:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3869:                 environmental considerations</a></span></dt>
1.1       grant    3870: 
1.38      dillo    3871:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3872:                 Operation</a></span></dt>
                   3873: 
1.30      wiz      3874:                 <dt><span class="sect2"><a href=
1.38      dillo    3875:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3876: 
1.30      wiz      3877:                 <dt><span class="sect2"><a href=
1.38      dillo    3878:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3879:                 requirements</a></span></dt>
1.1       grant    3880: 
1.30      wiz      3881:                 <dt><span class="sect2"><a href=
1.38      dillo    3882:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3883:                 for chrooted builds</a></span></dt>
1.1       grant    3884: 
1.30      wiz      3885:                 <dt><span class="sect2"><a href=
1.38      dillo    3886:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3887:                 set of packages</a></span></dt>
1.13      hubertf  3888: 
                   3889:                 <dt><span class="sect2"><a href=
1.38      dillo    3890:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3891:                 build</a></span></dt>
1.1       grant    3892:               </dl>
                   3893:             </dd>
                   3894: 
1.38      dillo    3895:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3896:             Creating a multiple CD-ROM packages
                   3897:             collection</a></span></dt>
                   3898: 
                   3899:             <dd>
                   3900:               <dl>
1.30      wiz      3901:                 <dt><span class="sect2"><a href=
1.38      dillo    3902:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3903:                 cdpack</a></span></dt>
1.1       grant    3904:               </dl>
                   3905:             </dd>
                   3906:           </dl>
                   3907:         </div>
                   3908: 
1.57      minskim  3909:         <div class="sect1" lang="en">
1.1       grant    3910:           <div class="titlepage">
                   3911:             <div>
                   3912:               <div>
                   3913:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3914:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3915:                 a single binary package</h2>
1.1       grant    3916:               </div>
                   3917:             </div>
                   3918:           </div>
                   3919: 
                   3920:           <p>Once you have built and installed a package, you can
                   3921:           create a <span class="emphasis"><em>binary
                   3922:           package</em></span> which can be installed on another
                   3923:           system with <a href=
                   3924:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3925:           <span class="citerefentry"><span class=
1.47      reed     3926:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    3927:           having to build the same package on a group of hosts and
                   3928:           wasting CPU time. It also provides a simple means for
                   3929:           others to install your package, should you distribute
                   3930:           it.</p>
                   3931: 
                   3932:           <p>To create a binary package, change into the
1.14      xtraeme  3933:           appropriate directory in pkgsrc, and run
                   3934:           <span><strong class="command">make
                   3935:           package</strong></span>:</p>
1.1       grant    3936:           <pre class="screen">
1.14      xtraeme  3937: <code class="prompt">#</code> <strong class=
                   3938: "userinput"><code>cd misc/figlet</code></strong>
                   3939: <code class="prompt">#</code> <strong class=
                   3940: "userinput"><code>make package</code></strong>
1.1       grant    3941: </pre>
                   3942: 
                   3943:           <p>This will build and install your package (if not
                   3944:           already done), and then build a binary package from what
1.14      xtraeme  3945:           was installed. You can then use the <span><strong class=
                   3946:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      3947:           Binary packages are created by default in <code xmlns=
                   3948:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3949:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3950:           gzipped tar file. See <a href="#logs.package" title=
1.57      minskim  3951:           "B.2.&nbsp;Packaging figlet">Section&nbsp;B.2,
1.1       grant    3952:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3953:           the above <a xmlns=
                   3954:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3955:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      3956:           target="_top"><code xmlns="" class=
                   3957:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    3958: 
                   3959:           <p>See <a href="#submit" title=
1.57      minskim  3960:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
                   3961:           <i>Submitting and Committing</i></a> for information on
                   3962:           how to submit such a binary package.</p>
1.1       grant    3963:         </div>
                   3964: 
1.57      minskim  3965:         <div class="sect1" lang="en">
1.1       grant    3966:           <div class="titlepage">
                   3967:             <div>
                   3968:               <div>
                   3969:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3970:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    3971:                 for creation of binary packages</h2>
                   3972:               </div>
                   3973:             </div>
                   3974:           </div>
                   3975: 
                   3976:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   3977:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    3978:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3979:         </div>
                   3980: 
1.57      minskim  3981:         <div class="sect1" lang="en">
1.1       grant    3982:           <div class="titlepage">
                   3983:             <div>
                   3984:               <div>
                   3985:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  3986:                 "bulkbuild"></a>6.3.&nbsp;Doing a bulk build of all
                   3987:                 packages</h2>
1.1       grant    3988:               </div>
                   3989:             </div>
                   3990:           </div>
                   3991: 
                   3992:           <p>If you want to get a full set of precompiled binary
                   3993:           packages, this section describes how to get them. Beware
                   3994:           that the bulk build will remove all currently installed
1.23      wiz      3995:           packages from your system! Having an FTP server
                   3996:           configured either on the machine doing the bulk builds or
                   3997:           on a nearby NFS server can help to make the packages
                   3998:           available to everyone. See <a href=
1.1       grant    3999:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4000:           <span class="citerefentry"><span class=
                   4001:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4002:           information. If you use a remote NFS server's storage, be
                   4003:           sure to not actually compile on NFS storage, as this
                   4004:           slows things down a lot.</p>
                   4005: 
1.57      minskim  4006:           <div class="sect2" lang="en">
1.1       grant    4007:             <div class="titlepage">
                   4008:               <div>
                   4009:                 <div>
1.57      minskim  4010:                   <h3 class="title"><a name=
1.38      dillo    4011:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4012:                 </div>
                   4013:               </div>
                   4014:             </div>
                   4015: 
1.57      minskim  4016:             <div class="sect3" lang="en">
1.1       grant    4017:               <div class="titlepage">
                   4018:                 <div>
                   4019:                   <div>
1.57      minskim  4020:                     <h4 class="title"><a name=
1.38      dillo    4021:                     "binary.mk.conf"></a>6.3.1.1.&nbsp;/etc/mk.conf</h4>
1.1       grant    4022:                   </div>
                   4023:                 </div>
                   4024:               </div>
                   4025: 
1.45      wiz      4026:               <p>You may want to set variables in <code xmlns=
                   4027:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4028:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4029:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4030:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4031:               details of the default settings. You will want to
1.14      xtraeme  4032:               ensure that <code class=
                   4033:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4034:               policy. As used in this example, <code class=
                   4035:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4036:               "emphasis"><em>all</em></span> licenses.</p>
                   4037:               <pre class="programlisting">
1.51      rillig   4038:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4039:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4040:     BSDSRCDIR=      /usr/src
                   4041:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4042:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4043:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4044:     PKG_DEVELOPER?= yes
                   4045:     _ACCEPTABLE=    yes
1.1       grant    4046: </pre>
                   4047:             </div>
                   4048: 
1.57      minskim  4049:             <div class="sect3" lang="en">
1.1       grant    4050:               <div class="titlepage">
                   4051:                 <div>
                   4052:                   <div>
1.57      minskim  4053:                     <h4 class="title"><a name=
1.45      wiz      4054:                     "build.conf"></a>6.3.1.2.&nbsp;<code xmlns=
                   4055:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4056:                     class="filename">build.conf</code></h4>
1.1       grant    4057:                   </div>
                   4058:                 </div>
                   4059:               </div>
                   4060: 
1.45      wiz      4061:               <p>In <code xmlns=
                   4062:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4063:               "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
                   4064:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4065:               "filename">build.conf-example</code> to <code xmlns=
                   4066:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4067:               "filename">build.conf</code> and edit it, following
                   4068:               the comments in that file. This is the config file
                   4069:               that determines where log files are generated after
                   4070:               the build, where to mail the build report to, where
                   4071:               your pkgsrc tree is located and the user to which
                   4072:               user to <a href=
1.1       grant    4073:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   4074:               <span class="citerefentry"><span class=
1.23      wiz      4075:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  4076:               <span><strong class="command">cvs
                   4077:               update</strong></span>.</p>
1.1       grant    4078:             </div>
                   4079: 
1.57      minskim  4080:             <div class="sect3" lang="en">
1.1       grant    4081:               <div class="titlepage">
                   4082:                 <div>
                   4083:                   <div>
1.57      minskim  4084:                     <h4 class="title"><a name=
1.45      wiz      4085:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4086:                     class="filename">pre-build.local</code></h4>
1.1       grant    4087:                   </div>
                   4088:                 </div>
                   4089:               </div>
                   4090: 
                   4091:               <p>It is possible to configure the bulk build to
1.47      reed     4092:               perform certain site-specific tasks at the end of the
1.45      wiz      4093:               pre-build stage. If the file <code xmlns=
                   4094:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4095:               "filename">pre-build.local</code> exists in
1.45      wiz      4096:               <code xmlns=
                   4097:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4098:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4099:               executed (as a <a href=
1.24      wiz      4100:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4101:               <span class="citerefentry"><span class=
                   4102:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4103:               the end of the usual pre-build stage. An example use
1.45      wiz      4104:               of <code xmlns=
                   4105:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4106:               "filename">pre-build.local</code> is to have the
                   4107:               line:</p>
1.1       grant    4108:               <pre class="screen">
1.14      xtraeme  4109: <code class="prompt">#</code> <strong class=
                   4110: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      4111:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    4112: </pre>
                   4113: 
                   4114:               <p>to prevent the system from trying to build a
                   4115:               particular package which requires nearly 3 GB of disk
                   4116:               space.</p>
                   4117:             </div>
                   4118:           </div>
                   4119: 
1.57      minskim  4120:           <div class="sect2" lang="en">
1.1       grant    4121:             <div class="titlepage">
                   4122:               <div>
                   4123:                 <div>
1.30      wiz      4124:                   <h3 class="title"><a name=
1.38      dillo    4125:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4126:                   environmental considerations</h3>
1.1       grant    4127:                 </div>
                   4128:               </div>
                   4129:             </div>
                   4130: 
1.45      wiz      4131:             <p>As <code xmlns=
                   4132:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4133:             "filename">/usr/pkg</code> will be completely deleted
                   4134:             at the start of bulk builds, make sure your login shell
                   4135:             is placed somewhere else. Either drop it into
                   4136:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4137:             class="filename">/usr/local/bin</code> (and adjust your
                   4138:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4139:             <a href=
1.1       grant    4140:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4141:             <span class="citerefentry"><span class=
                   4142:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4143:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4144:             class="filename">/etc/rc.local</code>, so you can login
                   4145:             after a reboot (remember that your current process
                   4146:             won't die if the package is removed, you just can't
                   4147:             start any new instances of the shell any more). Also,
                   4148:             if you use NetBSD earlier than 1.5, or you still want
                   4149:             to use the pkgsrc version of ssh for some reason, be
                   4150:             sure to install ssh before starting it from
                   4151:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4152:             class="filename">rc.local</code>:</p>
1.1       grant    4153:             <pre class="programlisting">
1.51      rillig   4154:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4155:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4156:         /usr/pkg/etc/rc.d/sshd
                   4157:     fi
1.1       grant    4158: </pre>
                   4159: 
                   4160:             <p>Not doing so will result in you being not able to
                   4161:             log in via ssh after the bulk build is finished or if
                   4162:             the machine gets rebooted or crashes. You have been
                   4163:             warned! :)</p>
                   4164:           </div>
                   4165: 
1.57      minskim  4166:           <div class="sect2" lang="en">
1.1       grant    4167:             <div class="titlepage">
                   4168:               <div>
                   4169:                 <div>
1.57      minskim  4170:                   <h3 class="title"><a name=
1.38      dillo    4171:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4172:                 </div>
                   4173:               </div>
                   4174:             </div>
                   4175: 
                   4176:             <p>Make sure you don't need any of the packages still
                   4177:             installed.</p>
                   4178: 
                   4179:             <div class="warning" style=
                   4180:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4181:               <h3 class="title">Warning</h3>
                   4182: 
                   4183:               <p>During the bulk build, <span class=
                   4184:               "emphasis"><em>all packages will be
                   4185:               removed!</em></span></p>
                   4186:             </div>
                   4187: 
                   4188:             <p>Be sure to remove all other things that might
                   4189:             interfere with builds, like some libs installed in
1.45      wiz      4190:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4191:             class="filename">/usr/local</code>, etc. then become
                   4192:             root and type:</p>
1.1       grant    4193:             <pre class="screen">
1.14      xtraeme  4194: <code class="prompt">#</code> <strong class=
                   4195: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4196: <code class="prompt">#</code> <strong class=
                   4197: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4198: </pre>
                   4199: 
                   4200:             <p>If for some reason your last build didn't complete
                   4201:             (power failure, system panic, ...), you can continue it
                   4202:             by running:</p>
                   4203:             <pre class="screen">
1.14      xtraeme  4204: <code class="prompt">#</code> <strong class=
                   4205: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4206: </pre>
                   4207: 
                   4208:             <p>At the end of the bulk build, you will get a summary
                   4209:             via mail, and find build logs in the directory
1.14      xtraeme  4210:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4211:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4212:             class="filename">build.conf</code> file.</p>
1.1       grant    4213:           </div>
                   4214: 
1.57      minskim  4215:           <div class="sect2" lang="en">
1.1       grant    4216:             <div class="titlepage">
                   4217:               <div>
                   4218:                 <div>
1.57      minskim  4219:                   <h3 class="title"><a name=
1.38      dillo    4220:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4221:                 </div>
                   4222:               </div>
                   4223:             </div>
                   4224: 
                   4225:             <p>The bulk builds consist of three steps:</p>
                   4226: 
                   4227:             <div class="variablelist">
                   4228:               <dl>
                   4229:                 <dt><span class="term">1. pre-build</span></dt>
                   4230: 
                   4231:                 <dd>
                   4232:                   <p>The script updates your pkgsrc tree via
                   4233:                   (anon)cvs, then cleans out any broken distfiles,
                   4234:                   and removes all packages installed.</p>
                   4235:                 </dd>
                   4236: 
                   4237:                 <dt><span class="term">2. the bulk
                   4238:                 build</span></dt>
                   4239: 
                   4240:                 <dd>
                   4241:                   <p>This is basically &#8220;<span class=
                   4242:                   "quote">make bulk-package</span>&#8221; with an
                   4243:                   optimised order in which packages will be built.
                   4244:                   Packages that don't require other packages will
                   4245:                   be built first, and packages with many
                   4246:                   dependencies will be built later.</p>
                   4247:                 </dd>
                   4248: 
                   4249:                 <dt><span class="term">3. post-build</span></dt>
                   4250: 
                   4251:                 <dd>
                   4252:                   <p>Generates a report that's placed in the
1.45      wiz      4253:                   directory specified in the <code xmlns=
                   4254:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4255:                   "filename">build.conf</code> file named
1.45      wiz      4256:                   <code xmlns=
                   4257:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4258:                   "filename">broken.html</code>, a short version of
                   4259:                   that report will also be mailed to the build's
                   4260:                   admin.</p>
1.1       grant    4261:                 </dd>
                   4262:               </dl>
                   4263:             </div>
                   4264: 
                   4265:             <p>During the build, a list of broken packages will be
1.45      wiz      4266:             compiled in <code xmlns=
                   4267:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4268:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4269:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4270:             "filename">.../.broken.${MACHINE}</code> if
                   4271:             <code class="varname">OBJMACHINE</code> is set),
                   4272:             individual build logs of broken builds can be found in
                   4273:             the package's directory. These files are used by the
                   4274:             bulk-targets to mark broken builds to not waste time
                   4275:             trying to rebuild them, and they can be used to debug
                   4276:             these broken package builds later.</p>
1.1       grant    4277:           </div>
                   4278: 
1.57      minskim  4279:           <div class="sect2" lang="en">
1.1       grant    4280:             <div class="titlepage">
                   4281:               <div>
                   4282:                 <div>
1.30      wiz      4283:                   <h3 class="title"><a name=
1.38      dillo    4284:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4285:                   space requirements</h3>
1.1       grant    4286:                 </div>
                   4287:               </div>
                   4288:             </div>
                   4289: 
                   4290:             <p>Currently, roughly the following requirements are
                   4291:             valid for NetBSD 2.0/i386:</p>
                   4292: 
                   4293:             <div class="itemizedlist">
                   4294:               <ul type="disc">
                   4295:                 <li>
                   4296:                   <p>10 GB - distfiles (NFS ok)</p>
                   4297:                 </li>
                   4298: 
                   4299:                 <li>
                   4300:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4301:                 </li>
                   4302: 
                   4303:                 <li>
                   4304:                   <p>5 GB - temp space for compiling (local disk
                   4305:                   recommended)</p>
                   4306:                 </li>
                   4307:               </ul>
                   4308:             </div>
                   4309: 
                   4310:             <p>Note that all pkgs will be de-installed as soon as
                   4311:             they are turned into a binary package, and that sources
                   4312:             are removed, so there is no excessively huge demand to
                   4313:             disk space. Afterwards, if the package is needed again,
                   4314:             it will be installed via <a href=
                   4315:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4316:             <span class="citerefentry"><span class=
                   4317:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4318:             building again, so there are no cycles wasted by
                   4319:             recompiling.</p>
                   4320:           </div>
                   4321: 
1.57      minskim  4322:           <div class="sect2" lang="en">
1.1       grant    4323:             <div class="titlepage">
                   4324:               <div>
                   4325:                 <div>
1.57      minskim  4326:                   <h3 class="title"><a name=
                   4327:                   "setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting up
                   4328:                   a sandbox for chrooted builds</h3>
1.1       grant    4329:                 </div>
                   4330:               </div>
                   4331:             </div>
                   4332: 
1.12      agc      4333:             <p>If you don't want all the packages nuked from a
                   4334:             machine (rendering it useless for anything but pkg
1.23      wiz      4335:             compiling), there is the possibility of doing the
                   4336:             package bulk build inside a chroot environment.</p>
1.12      agc      4337: 
                   4338:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4339:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4340:             class="filename">/usr/sandbox</code>. This can be done
                   4341:             by using null mounts, or manually.</p>
1.12      agc      4342: 
1.45      wiz      4343:             <p>There is a shell script called <code xmlns=
                   4344:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4345:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4346:             set up the sandbox environment using null mounts. It
1.45      wiz      4347:             will also create a script called <code xmlns=
                   4348:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4349:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4350:             environment, which will allow the null mounts to be
1.14      xtraeme  4351:             activated using the <span><strong class=
                   4352:             "command">sandbox mount</strong></span> command and
                   4353:             deactivated using the <span><strong class=
                   4354:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4355: 
                   4356:             <p>To set up a sandbox environment by hand, after
                   4357:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4358:             doing a <span><strong class="command">make distribution
1.45      wiz      4359:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4360:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4361:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4362:             items are present and properly configured:</p>
1.1       grant    4363: 
                   4364:             <div class="procedure">
                   4365:               <ol type="1">
                   4366:                 <li>
                   4367:                   <p>Kernel</p>
                   4368:                   <pre class="screen">
1.14      xtraeme  4369: <code class="prompt">#</code> <strong class=
                   4370: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4371: </pre>
                   4372:                 </li>
                   4373: 
                   4374:                 <li>
1.45      wiz      4375:                   <p><code xmlns=
                   4376:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4377:                   "filename">/dev/*</code></p>
1.1       grant    4378:                   <pre class="screen">
1.14      xtraeme  4379: <code class="prompt">#</code> <strong class=
                   4380: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4381: </pre>
                   4382:                 </li>
                   4383: 
                   4384:                 <li>
1.45      wiz      4385:                   <p><code xmlns=
                   4386:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4387:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4388:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4389:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4390:                   target="_top"><code xmlns="" class=
                   4391:                   "filename">security/smtpd</code></a> and
                   4392:                   mail):</p>
1.1       grant    4393:                   <pre class="screen">
1.14      xtraeme  4394: <code class="prompt">#</code> <strong class=
                   4395: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4396: </pre>
                   4397:                 </li>
                   4398: 
                   4399:                 <li>
                   4400:                   <p>Working(!) mail config (hostname,
                   4401:                   sendmail.cf):</p>
                   4402:                   <pre class="screen">
1.14      xtraeme  4403: <code class="prompt">#</code> <strong class=
                   4404: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4405: </pre>
                   4406:                 </li>
                   4407: 
                   4408:                 <li>
1.45      wiz      4409:                   <p><code xmlns=
                   4410:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4411:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4412:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4413:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4414:                   target="_top"><code xmlns="" class=
                   4415:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4416:                   <pre class="screen">
1.14      xtraeme  4417: <code class="prompt">#</code> <strong class=
                   4418: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4419: </pre>
                   4420:                 </li>
                   4421: 
                   4422:                 <li>
1.45      wiz      4423:                   <p><code xmlns=
                   4424:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4425:                   "filename">/usr/src</code> (system sources, for
                   4426:                   <a xmlns=
1.1       grant    4427:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4428:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4429:                   target="_top"><code xmlns="" class=
                   4430:                   "filename">sysutils/aperture</code></a>,
                   4431:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4432:                   href=
1.20      ben      4433:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4434:                   target="_top"><code xmlns="" class=
                   4435:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4436:                   <pre class="screen">
1.14      xtraeme  4437: <code class="prompt">#</code> <strong class=
                   4438: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4439: <code class="prompt">#</code> <strong class=
1.23      wiz      4440: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4441: </pre>
                   4442:                 </li>
                   4443: 
                   4444:                 <li>
1.45      wiz      4445:                   <p>Create <code xmlns=
                   4446:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4447:                   "filename">/var/db/pkg</code> (not part of
                   4448:                   default install):</p>
1.1       grant    4449:                   <pre class="screen">
1.14      xtraeme  4450: <code class="prompt">#</code> <strong class=
                   4451: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4452: </pre>
                   4453:                 </li>
                   4454: 
                   4455:                 <li>
1.45      wiz      4456:                   <p>Create <code xmlns=
                   4457:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4458:                   "filename">/usr/pkg</code> (not part of default
                   4459:                   install):</p>
1.1       grant    4460:                   <pre class="screen">
1.14      xtraeme  4461: <code class="prompt">#</code> <strong class=
                   4462: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4463: </pre>
                   4464:                 </li>
                   4465: 
                   4466:                 <li>
1.45      wiz      4467:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4468:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4469:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4470:                   <pre class="screen">
1.14      xtraeme  4471: <code class="prompt">#</code> <strong class=
                   4472: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4473: <code class="prompt">#</code> <strong class=
                   4474: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4475: </pre>
                   4476: 
                   4477:                   <p>Do not mount/link this to the copy of your
                   4478:                   pkgsrc tree you do development in, as this will
                   4479:                   likely cause problems!</p>
                   4480:                 </li>
                   4481: 
                   4482:                 <li>
1.45      wiz      4483:                   <p>Make <code xmlns=
                   4484:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4485:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4486:                   and <code xmlns=
                   4487:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4488:                   "filename">.../distfiles</code> point somewhere
                   4489:                   appropriate. NFS- and/or nullfs-mounts may come
                   4490:                   in handy!</p>
1.1       grant    4491:                 </li>
                   4492: 
                   4493:                 <li>
1.45      wiz      4494:                   <p>Edit <code xmlns=
                   4495:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4496:                   "filename">/etc/mk.conf</code>, see <a href=
                   4497:                   "#binary.mk.conf" title=
1.38      dillo    4498:                   "6.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.1,
1.1       grant    4499:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4500:                 </li>
                   4501: 
                   4502:                 <li>
1.45      wiz      4503:                   <p>Adjust <code xmlns=
                   4504:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4505:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4506:                   needs.</p>
                   4507:                 </li>
                   4508: 
                   4509:                 <li>
1.14      xtraeme  4510:                   <p>If you have set <code class=
1.45      wiz      4511:                   "varname">CVS_USER</code> in <code xmlns=
                   4512:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4513:                   "filename">build.conf</code>, make sure that
                   4514:                   account exists and can do a <span><strong class=
                   4515:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4516:                   properly!</p>
                   4517:                 </li>
                   4518:               </ol>
                   4519:             </div>
                   4520: 
1.47      reed     4521:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4522:             build with the following steps:</p>
                   4523:             <pre class="screen">
1.14      xtraeme  4524: <code class="prompt">#</code> <strong class=
                   4525: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4526: <code class="prompt">#</code> <strong class=
                   4527: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4528: </pre>
                   4529: 
                   4530:             <p>This will just jump inside the sandbox and start
                   4531:             building. At the end of the build, mail will be sent
                   4532:             with the results of the build. Created binary pkgs will
1.45      wiz      4533:             be in <code xmlns=
                   4534:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4535:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4536:             (wherever that points/mounts to/from).</p>
                   4537:           </div>
                   4538: 
1.57      minskim  4539:           <div class="sect2" lang="en">
1.1       grant    4540:             <div class="titlepage">
                   4541:               <div>
                   4542:                 <div>
1.30      wiz      4543:                   <h3 class="title"><a name=
1.38      dillo    4544:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4545:                   a partial set of packages</h3>
1.1       grant    4546:                 </div>
                   4547:               </div>
                   4548:             </div>
                   4549: 
                   4550:             <p>In addition to building a complete set of all
1.45      wiz      4551:             packages in pkgsrc, the <code xmlns=
                   4552:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4553:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4554:             used to build a subset of the packages contained in
1.47      reed     4555:             pkgsrc. By setting <code class=
1.45      wiz      4556:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4557:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4558:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4559: 
                   4560:             <div class="itemizedlist">
                   4561:               <ul type="disc">
                   4562:                 <li>
                   4563:                   <p>SITE_SPECIFIC_PKGS</p>
                   4564:                 </li>
                   4565: 
                   4566:                 <li>
                   4567:                   <p>HOST_SPECIFIC_PKGS</p>
                   4568:                 </li>
                   4569: 
                   4570:                 <li>
                   4571:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4572:                 </li>
                   4573: 
                   4574:                 <li>
                   4575:                   <p>USER_SPECIFIC_PKGS</p>
                   4576:                 </li>
                   4577:               </ul>
                   4578:             </div>
                   4579: 
                   4580:             <p>will define the set of packages which should be
                   4581:             built. The bulk build code will also include any
                   4582:             packages which are needed as dependencies for the
                   4583:             explicitly listed packages.</p>
                   4584: 
                   4585:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4586:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4587:             sandbox periodically to have a complete set of the
                   4588:             binary packages needed for your site available without
                   4589:             the overhead of building extra packages that are not
                   4590:             needed.</p>
                   4591:           </div>
1.13      hubertf  4592: 
1.57      minskim  4593:           <div class="sect2" lang="en">
1.13      hubertf  4594:             <div class="titlepage">
                   4595:               <div>
                   4596:                 <div>
1.57      minskim  4597:                   <h3 class="title"><a name=
1.38      dillo    4598:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4599:                   of a bulk build</h3>
                   4600:                 </div>
                   4601:               </div>
                   4602:             </div>
                   4603: 
                   4604:             <p>This section describes how pkgsrc developers can
                   4605:             upload binary pkgs built by bulk builds to
                   4606:             ftp.NetBSD.org.</p>
                   4607: 
1.17      sketch   4608:             <p>If you would like to automatically create checksum
                   4609:             files for the binary packages you intend to upload,
                   4610:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4611:             in your <code xmlns=
                   4612:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4613:             "filename">mk/bulk/build.conf</code>.</p>
                   4614: 
                   4615:             <p>If you would like to PGP sign the checksum files
                   4616:             (highly recommended!), remember to set <code class=
                   4617:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4618:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4619:             class="filename">mk/bulk/build.conf</code>. This will
                   4620:             prompt you for your GPG password to sign the files
1.17      sketch   4621:             before uploading everything.</p>
                   4622: 
                   4623:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4624:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4625:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4626:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4627:             adjust it to something like one of the following:</p>
1.13      hubertf  4628:             <pre class="screen">
                   4629: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4630: </pre>
                   4631: 
1.47      reed     4632:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4633:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4634:             ftp.NetBSD.org is different from <code class=
                   4635:             "varname">CVS_USER</code>, write your login directly
                   4636:             into the variable, e.g. my local account is "feyrer",
                   4637:             but for my login "hubertf", I use:</p>
1.13      hubertf  4638:             <pre class="screen">
                   4639: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4640: </pre>
                   4641: 
1.45      wiz      4642:             <p>A separate <code xmlns=
                   4643:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4644:             "filename">upload</code> directory is used here to
                   4645:             allow "closing" the directory during upload. To do so,
                   4646:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4647:             <pre class="screen">
1.14      xtraeme  4648: nbftp% <strong class=
                   4649: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4650: </pre>
                   4651: 
1.45      wiz      4652:             <p>Please note that <code xmlns=
                   4653:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4654:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4655:             appropriate for packages for the NetBSD operating
                   4656:             system. Binary packages for other operating systems
1.45      wiz      4657:             should go into <code xmlns=
                   4658:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4659:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4660: 
                   4661:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4662:             needs to be set up. This example shows how to set up
1.13      hubertf  4663:             temporary keys for the root account <span class=
                   4664:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4665:             that no keys should be present there usually):</p>
                   4666:             <pre class="screen">
1.14      xtraeme  4667: <code class="prompt">#</code> <strong class=
                   4668: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4669: chroot-<code class="prompt">#</code> <strong class=
                   4670: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4671: chroot-<code class="prompt">#</code> <strong class=
                   4672: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4673: chroot-<code class="prompt">#</code> <strong class=
                   4674: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4675: </pre>
                   4676: 
1.45      wiz      4677:             <p>Now take the output of <code xmlns=
                   4678:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4679:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4680:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4681:             class="filename">~/.ssh/authorized_keys</code> file on
                   4682:             ftp.NetBSD.org. You can remove the key after the upload
                   4683:             is done!</p>
1.13      hubertf  4684: 
                   4685:             <p>Next, test if your ssh connection really works:</p>
                   4686:             <pre class="screen">
1.14      xtraeme  4687: chroot-<code class="prompt">#</code> <strong class=
                   4688: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4689: </pre>
                   4690: 
                   4691:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4692: 
                   4693:             <p>Now after all this works, you can exit the sandbox
                   4694:             and start the upload:</p>
                   4695:             <pre class="screen">
1.14      xtraeme  4696: chroot-<code class="prompt">#</code> <strong class=
                   4697: "userinput"><code>exit</code></strong>        
                   4698: <code class="prompt">#</code> <strong class=
                   4699: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4700: <code class="prompt">#</code> <strong class=
                   4701: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4702: </pre>
                   4703: 
                   4704:             <p>The upload process may take quite some time. Use
1.24      wiz      4705:             <a href=
                   4706:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4707:             <span class="citerefentry"><span class=
                   4708:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4709:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4710:             <span class="citerefentry"><span class=
                   4711:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4712:             server to monitor progress of the upload. The upload
                   4713:             script will take care of not uploading restricted
                   4714:             packages and putting vulnerable packages into the
1.45      wiz      4715:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4716:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4717: 
                   4718:             <p>After the upload has ended, first thing is to revoke
                   4719:             ssh access:</p>
                   4720:             <pre class="screen">
1.14      xtraeme  4721: nbftp% <strong class=
                   4722: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4723: Gdd:x! 
                   4724: </pre>
                   4725: 
                   4726:             <p>Use whatever is needed to remove the key you've
                   4727:             entered before! Last, move the uploaded packages out of
1.45      wiz      4728:             the <code xmlns=
                   4729:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4730:             "filename">upload</code> directory to have them
                   4731:             accessible to everyone:</p>
1.13      hubertf  4732:             <pre class="screen">
1.14      xtraeme  4733: nbftp% <strong class=
                   4734: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4735: nbftp% <strong class=
                   4736: "userinput"><code>mv upload/* .</code></strong>
                   4737: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4738: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4739: </pre>
                   4740:           </div>
1.1       grant    4741:         </div>
                   4742: 
1.57      minskim  4743:         <div class="sect1" lang="en">
1.1       grant    4744:           <div class="titlepage">
                   4745:             <div>
                   4746:               <div>
                   4747:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4748:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4749:                 CD-ROM packages collection</h2>
1.1       grant    4750:               </div>
                   4751:             </div>
                   4752:           </div>
                   4753: 
                   4754:           <p>After your pkgsrc bulk-build has completed, you may
                   4755:           wish to create a CD-ROM set of the resulting binary
                   4756:           packages to assist in installing packages on other
                   4757:           machines. The <a xmlns=
                   4758:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4759:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4760:           target="_top"><code xmlns="" class=
                   4761:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4762:           simple tool for creating the ISO 9660 images.
                   4763:           <span><strong class="command">cdpack</strong></span>
                   4764:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4765:           all the dependencies for a given package on the same CD
                   4766:           as that package.</p>
1.1       grant    4767: 
1.57      minskim  4768:           <div class="sect2" lang="en">
1.1       grant    4769:             <div class="titlepage">
                   4770:               <div>
                   4771:                 <div>
1.57      minskim  4772:                   <h3 class="title"><a name=
1.38      dillo    4773:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4774:                   cdpack</h3>
                   4775:                 </div>
                   4776:               </div>
                   4777:             </div>
                   4778: 
                   4779:             <p>Complete documentation for cdpack is found in the
1.47      reed     4780:             cdpack(1) man page. The following short example assumes
1.45      wiz      4781:             that the binary packages are left in <code xmlns=
                   4782:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4783:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4784:             sufficient disk space exists in <code xmlns=
                   4785:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4786:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4787:             <pre class="screen">
1.14      xtraeme  4788: <code class="prompt">#</code> <strong class=
                   4789: "userinput"><code>mkdir /u2/images</code></strong>
                   4790: <code class="prompt">#</code> <strong class=
                   4791: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4792: <code class="prompt">#</code> <strong class=
                   4793: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4794: </pre>
                   4795: 
                   4796:             <p>If you wish to include a common set of files
1.45      wiz      4797:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4798:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4799:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4800:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4801:             collection, then you need to create a directory which
                   4802:             contains these files. e.g.</p>
                   4803:             <pre class="screen">
1.14      xtraeme  4804: <code class="prompt">#</code> <strong class=
                   4805: "userinput"><code>mkdir /tmp/common</code></strong>
                   4806: <code class="prompt">#</code> <strong class=
                   4807: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4808: <code class="prompt">#</code> <strong class=
                   4809: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4810: <code class="prompt">#</code> <strong class=
                   4811: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4812: <code class="prompt">#</code> <strong class=
                   4813: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4814: <code class="prompt">#</code> <strong class=
                   4815: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4816: <code class="prompt">#</code> <strong class=
                   4817: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4818: </pre>
                   4819: 
                   4820:             <p>Now create the images:</p>
                   4821:             <pre class="screen">
1.14      xtraeme  4822: <code class="prompt">#</code> <strong class=
                   4823: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4824: </pre>
                   4825: 
1.45      wiz      4826:             <p>Each image will contain <code xmlns=
                   4827:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4828:             "filename">README</code>, <code xmlns=
                   4829:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4830:             "filename">COPYING</code>, and <code xmlns=
                   4831:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4832:             "filename">bin/myscript</code> in their root
1.1       grant    4833:             directories.</p>
                   4834:           </div>
                   4835:         </div>
                   4836:       </div>
                   4837: 
1.57      minskim  4838:       <div class="chapter" lang="en">
1.1       grant    4839:         <div class="titlepage">
                   4840:           <div>
                   4841:             <div>
1.57      minskim  4842:               <h2 class="title"><a name=
1.38      dillo    4843:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4844:               Questions</h2>
                   4845:             </div>
                   4846:           </div>
                   4847:         </div>
                   4848: 
                   4849:         <div class="toc">
                   4850:           <p><b>Table of Contents</b></p>
                   4851: 
                   4852:           <dl>
1.30      wiz      4853:             <dt><span class="sect1"><a href=
1.38      dillo    4854:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4855:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4856: 
1.38      dillo    4857:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4858:             Where's the pkgviews documentation?</a></span></dt>
                   4859: 
1.38      dillo    4860:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4861:             Utilities for package management
                   4862:             (pkgtools)</a></span></dt>
                   4863: 
1.38      dillo    4864:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4865:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4866: 
1.30      wiz      4867:             <dt><span class="sect1"><a href=
1.38      dillo    4868:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4869:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4870: 
1.30      wiz      4871:             <dt><span class="sect1"><a href=
1.38      dillo    4872:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4873:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4874: 
1.30      wiz      4875:             <dt><span class="sect1"><a href=
1.38      dillo    4876:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4877:             from pkgsrc?</a></span></dt>
1.1       grant    4878: 
1.30      wiz      4879:             <dt><span class="sect1"><a href=
1.38      dillo    4880:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      4881:             behind a firewall</a></span></dt>
1.1       grant    4882: 
1.38      dillo    4883:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  4884:             do I tell <span><strong class="command">make
                   4885:             fetch</strong></span> to do passive
                   4886:             FTP?</a></span></dt>
1.1       grant    4887: 
1.30      wiz      4888:             <dt><span class="sect1"><a href=
1.38      dillo    4889:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      4890:             distfiles at once</a></span></dt>
1.1       grant    4891: 
1.30      wiz      4892:             <dt><span class="sect1"><a href=
1.38      dillo    4893:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      4894:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4895:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4896:             mean?</a></span></dt>
                   4897: 
1.30      wiz      4898:             <dt><span class="sect1"><a href=
1.38      dillo    4899:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      4900:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4901:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4902: 
1.30      wiz      4903:             <dt><span class="sect1"><a href=
1.38      dillo    4904:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      4905:             pkgsrc</a></span></dt>
1.1       grant    4906: 
1.38      dillo    4907:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     4908:             do I change the location of configuration
                   4909:             files?</a></span></dt>
1.1       grant    4910: 
1.38      dillo    4911:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    4912:             Automated security checks</a></span></dt>
                   4913:           </dl>
                   4914:         </div>
                   4915: 
                   4916:         <p>This section contains hints, tips &amp; tricks on
                   4917:         special things in pkgsrc that we didn't find a better place
                   4918:         for in the previous chapters, and it contains items for
                   4919:         both pkgsrc users and developers.</p>
                   4920: 
1.57      minskim  4921:         <div class="sect1" lang="en">
1.1       grant    4922:           <div class="titlepage">
                   4923:             <div>
                   4924:               <div>
                   4925:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4926:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      4927:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    4928:               </div>
                   4929:             </div>
                   4930:           </div>
                   4931: 
1.18      xtraeme  4932:           <p>The following mailing lists may be of interest to
                   4933:           pkgsrc users:</p>
                   4934: 
                   4935:           <div class="itemizedlist">
                   4936:             <ul type="disc">
                   4937:               <li>
                   4938:                 <p><a href=
                   4939:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      4940:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   4941:                 reports related to pkgsrc are sent and
                   4942:                 discussed.</p>
1.18      xtraeme  4943:               </li>
                   4944: 
                   4945:               <li>
                   4946:                 <p><a href=
                   4947:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      4948:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      4949:                 results of pkgsrc bulk builds are sent and
1.34      wiz      4950:                 discussed.</p>
1.18      xtraeme  4951:               </li>
                   4952: 
                   4953:               <li>
                   4954:                 <p><a href=
                   4955:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      4956:                 target="_top">pkgsrc-changes</a>: A list where all
                   4957:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  4958:               </li>
                   4959: 
                   4960:               <li>
                   4961:                 <p><a href=
                   4962:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      4963:                 target="_top">tech-pkg</a>: A general discussion
                   4964:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  4965:               </li>
                   4966:             </ul>
                   4967:           </div>
                   4968: 
                   4969:           <p>To subscribe, do:</p>
1.1       grant    4970:           <pre class="programlisting">
1.51      rillig   4971:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  4972: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    4973: </pre>
                   4974: 
1.18      xtraeme  4975:           <p>Archives for all these mailing lists are available
                   4976:           from <a href="http://mail-index.NetBSD.org/" target=
                   4977:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    4978:         </div>
                   4979: 
1.57      minskim  4980:         <div class="sect1" lang="en">
1.1       grant    4981:           <div class="titlepage">
                   4982:             <div>
                   4983:               <div>
                   4984:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4985:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      4986:                 documentation?</h2>
1.1       grant    4987:               </div>
                   4988:             </div>
                   4989:           </div>
                   4990: 
                   4991:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      4992:           find a pkgviews User's guide in <code xmlns=
                   4993:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4994:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    4995:         </div>
                   4996: 
1.57      minskim  4997:         <div class="sect1" lang="en">
1.1       grant    4998:           <div class="titlepage">
                   4999:             <div>
                   5000:               <div>
                   5001:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5002:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5003:                 management (pkgtools)</h2>
1.1       grant    5004:               </div>
                   5005:             </div>
                   5006:           </div>
                   5007: 
1.45      wiz      5008:           <p>The <code xmlns=
                   5009:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5010:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5011:           contains a number of useful utilities for both users and
                   5012:           developers of pkgsrc. This section attempts only to make
                   5013:           the reader aware of the utilities and when they might be
                   5014:           useful, and not to duplicate the documentation that comes
                   5015:           with each package.</p>
1.1       grant    5016: 
                   5017:           <p>Utilities used by pkgsrc (automatically installed when
                   5018:           needed):</p>
                   5019: 
                   5020:           <div class="itemizedlist">
                   5021:             <ul type="disc">
                   5022:               <li>
                   5023:                 <p><a xmlns=
                   5024:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5025:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5026:                 target="_top"><code xmlns="" class=
                   5027:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5028:                 for use by buildlink.</p>
1.1       grant    5029:               </li>
                   5030:             </ul>
                   5031:           </div>
                   5032: 
                   5033:           <p>OS tool augmentation (automatically installed when
                   5034:           needed):</p>
                   5035: 
                   5036:           <div class="itemizedlist">
                   5037:             <ul type="disc">
                   5038:               <li>
                   5039:                 <p><a xmlns=
                   5040:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5041:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5042:                 target="_top"><code xmlns="" class=
                   5043:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5044:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5045:               </li>
                   5046: 
                   5047:               <li>
                   5048:                 <p><a xmlns=
                   5049:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5050:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5051:                 target="_top"><code xmlns="" class=
                   5052:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5053:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5054:               </li>
                   5055: 
                   5056:               <li>
                   5057:                 <p><a xmlns=
                   5058:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5059:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5060:                 target="_top"><code xmlns="" class=
                   5061:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5062:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5063:               </li>
                   5064: 
                   5065:               <li>
                   5066:                 <p><a xmlns=
                   5067:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5068:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5069:                 target="_top"><code xmlns="" class=
                   5070:                 "filename">pkgtools/pkg_install</code></a>:
                   5071:                 Up-to-date replacement for <code xmlns=
                   5072:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5073:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5074:                 on operating systems where pkg_install is not
                   5075:                 present.</p>
1.1       grant    5076:               </li>
                   5077:             </ul>
                   5078:           </div>
                   5079: 
                   5080:           <p>Utilities used by pkgsrc (not automatically
                   5081:           installed):</p>
                   5082: 
                   5083:           <div class="itemizedlist">
                   5084:             <ul type="disc">
                   5085:               <li>
                   5086:                 <p><a xmlns=
                   5087:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5088:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5089:                 target="_top"><code xmlns="" class=
                   5090:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5091:                 binary package from an already-installed package.
1.34      wiz      5092:                 Used by <span><strong class="command">make
                   5093:                 replace</strong></span> to save the old
                   5094:                 package.</p>
1.1       grant    5095:               </li>
                   5096: 
                   5097:               <li>
                   5098:                 <p><a xmlns=
                   5099:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5100:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5101:                 target="_top"><code xmlns="" class=
                   5102:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5103:                 functionality to pkgsrc, allowing it to fetch
                   5104:                 distfiles from multiple locations. It currently
                   5105:                 supports the following methods: multiple CD-ROMs
                   5106:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5107:               </li>
                   5108: 
                   5109:               <li>
                   5110:                 <p><a xmlns=
                   5111:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5112:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5113:                 target="_top"><code xmlns="" class=
                   5114:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5115:                 packages someplace else (enabled by default).</p>
1.1       grant    5116:               </li>
1.5       hubertf  5117: 
                   5118:               <li>
                   5119:                 <p><a xmlns=
                   5120:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5121:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5122:                 target="_top"><code xmlns="" class=
                   5123:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5124:                 best compiler flags to optimise code for your
1.20      ben      5125:                 current CPU and compiler.</p>
1.5       hubertf  5126:               </li>
1.1       grant    5127:             </ul>
                   5128:           </div>
                   5129: 
                   5130:           <p>Utilities for keeping track of installed packages,
                   5131:           being up to date, etc:</p>
                   5132: 
                   5133:           <div class="itemizedlist">
                   5134:             <ul type="disc">
                   5135:               <li>
                   5136:                 <p><a xmlns=
                   5137:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5138:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5139:                 target="_top"><code xmlns="" class=
                   5140:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5141:                 packages whose installed versions do not match the
1.34      wiz      5142:                 latest pkgsrc entries.</p>
1.1       grant    5143:               </li>
                   5144: 
                   5145:               <li>
                   5146:                 <p><a xmlns=
                   5147:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5148:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5149:                 target="_top"><code xmlns="" class=
                   5150:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5151:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5152:                 strategy for updating.</p>
1.1       grant    5153:               </li>
                   5154: 
                   5155:               <li>
                   5156:                 <p><a xmlns=
                   5157:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5158:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5159:                 target="_top"><code xmlns="" class=
                   5160:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5161:                 graphs from the output of <a xmlns=
                   5162:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5163:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5164:                 target="_top"><code xmlns="" class=
                   5165:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5166:                 graphviz).</p>
1.1       grant    5167:               </li>
                   5168: 
                   5169:               <li>
                   5170:                 <p><a xmlns=
                   5171:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5172:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5173:                 target="_top"><code xmlns="" class=
                   5174:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5175:                 pkglint(1) program checks a pkgsrc entry for
                   5176:                 errors, lintpkgsrc(1) does various checks on the
                   5177:                 complete pkgsrc system.</p>
1.1       grant    5178:               </li>
                   5179: 
                   5180:               <li>
                   5181:                 <p><a xmlns=
                   5182:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5183:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5184:                 target="_top"><code xmlns="" class=
                   5185:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5186:                 what packages you have installed.</p>
1.1       grant    5187:               </li>
                   5188:             </ul>
                   5189:           </div>
                   5190: 
                   5191:           <p>Utilities for people maintaining or creating
                   5192:           individual packages:</p>
                   5193: 
                   5194:           <div class="itemizedlist">
                   5195:             <ul type="disc">
                   5196:               <li>
                   5197:                 <p><a xmlns=
                   5198:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5199:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5200:                 target="_top"><code xmlns="" class=
                   5201:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5202:                 making and maintaining patches for a package
1.34      wiz      5203:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5204:               </li>
                   5205: 
                   5206:               <li>
                   5207:                 <p><a xmlns=
                   5208:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5209:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5210:                 target="_top"><code xmlns="" class=
                   5211:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5212:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5213:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5214:                 target="_top"><code xmlns="" class=
                   5215:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5216:                 converting to pkgsrc.</p>
1.1       grant    5217:               </li>
                   5218: 
                   5219:               <li>
                   5220:                 <p><a xmlns=
                   5221:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5222:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5223:                 target="_top"><code xmlns="" class=
                   5224:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5225:                 pkgsrc to a Solaris package.</p>
1.1       grant    5226:               </li>
                   5227:             </ul>
                   5228:           </div>
                   5229: 
1.47      reed     5230:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5231:           obscure pkg utilities)</p>
                   5232: 
                   5233:           <div class="itemizedlist">
                   5234:             <ul type="disc">
                   5235:               <li>
                   5236:                 <p><a xmlns=
                   5237:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5238:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5239:                 target="_top"><code xmlns="" class=
                   5240:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5241:                 packages in a chrooted area.</p>
1.1       grant    5242:               </li>
                   5243: 
                   5244:               <li>
                   5245:                 <p><a xmlns=
                   5246:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5247:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5248:                 target="_top"><code xmlns="" class=
                   5249:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5250:                 kernel version for chrooted cross builds.</p>
1.1       grant    5251:               </li>
                   5252:             </ul>
                   5253:           </div>
                   5254:         </div>
                   5255: 
1.57      minskim  5256:         <div class="sect1" lang="en">
1.1       grant    5257:           <div class="titlepage">
                   5258:             <div>
                   5259:               <div>
                   5260:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5261:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5262:                 as non-root</h2>
1.1       grant    5263:               </div>
                   5264:             </div>
                   5265:           </div>
                   5266: 
                   5267:           <p>If you want to use pkgsrc as non-root user, you can
                   5268:           set some variables to make pkgsrc work under these
1.33      jmmv     5269:           conditions. At the very least, you need to set
                   5270:           <code class="varname">UNPRIVILEGED</code> to
                   5271:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5272:           turn on unprivileged mode and set multiple related
                   5273:           variables to allow installation of packages as
                   5274:           non-root.</p>
                   5275: 
                   5276:           <p>In case the defaults are not enough, you may want to
                   5277:           tune some other variables used. For example, if the
                   5278:           automatic user/group detection leads to incorrect values
                   5279:           (or not the ones you would like to use), you can change
                   5280:           them by setting <code class=
                   5281:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5282:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5283: 
                   5284:           <p>As regards bootstrapping, please note that the
                   5285:           <span><strong class="command">bootstrap</strong></span>
                   5286:           script will ease non-root configuration when given the
                   5287:           &#8220;<span class=
                   5288:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5289:           will choose and use multiple default directories under
1.45      wiz      5290:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5291:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5292:           targets. These directories can be overriden by the
                   5293:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5294:           provided by the script, as well as some others that allow
                   5295:           finer tuning of the tree layout.</p>
1.14      xtraeme  5296:         </div>
                   5297: 
1.57      minskim  5298:         <div class="sect1" lang="en">
1.14      xtraeme  5299:           <div class="titlepage">
                   5300:             <div>
                   5301:               <div>
                   5302:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5303:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5304:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5305:               </div>
                   5306:             </div>
                   5307:           </div>
                   5308: 
1.47      reed     5309:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5310:           but you can enable this feature by adding the option
                   5311:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5312:           into <code xmlns=
                   5313:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5314:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5315:           an incomplete distfile is found, pkgsrc will try to
                   5316:           resume it.</p>
1.15      xtraeme  5317: 
                   5318:           <p>You can also use a different program than the default
1.24      wiz      5319:           <a href=
                   5320:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5321:           <span class="citerefentry"><span class=
                   5322:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5323:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5324:           forget to set <code class=
                   5325:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5326:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5327:           default values.</p>
1.14      xtraeme  5328: 
1.45      wiz      5329:           <p>For example, if you want to use <code xmlns=
                   5330:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5331:           "filename">wget</code> to resume downloads, you'll have
                   5332:           to use something like:</p>
                   5333:           <pre class="programlisting">
1.51      rillig   5334:     FETCH_CMD=             wget
                   5335:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5336:     FETCH_RESUME_ARGS=     -c
                   5337:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5338: </pre>
1.1       grant    5339:         </div>
                   5340: 
1.57      minskim  5341:         <div class="sect1" lang="en">
1.1       grant    5342:           <div class="titlepage">
                   5343:             <div>
                   5344:               <div>
                   5345:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5346:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5347:                 install/use XFree86 from pkgsrc?</h2>
                   5348:               </div>
                   5349:             </div>
                   5350:           </div>
                   5351: 
                   5352:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5353:           system's own X11 (<code xmlns=
                   5354:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5355:           "filename">/usr/X11R6</code>, <code xmlns=
                   5356:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5357:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5358:           add the following line into <code xmlns=
                   5359:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5360:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5361:           <pre class="programlisting">
1.51      rillig   5362:     X11_TYPE=XFree86
1.1       grant    5363: </pre>
                   5364:         </div>
                   5365: 
1.57      minskim  5366:         <div class="sect1" lang="en">
1.1       grant    5367:           <div class="titlepage">
                   5368:             <div>
                   5369:               <div>
                   5370:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5371:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5372:                 install/use X.org from pkgsrc?</h2>
                   5373:               </div>
                   5374:             </div>
                   5375:           </div>
                   5376: 
                   5377:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5378:           system's own X11 (<code xmlns=
                   5379:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5380:           "filename">/usr/X11R6</code>, <code xmlns=
                   5381:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5382:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5383:           the following line into <code xmlns=
                   5384:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5385:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5386:           <pre class="programlisting">
1.51      rillig   5387:     X11_TYPE=xorg
1.1       grant    5388: </pre>
                   5389:         </div>
                   5390: 
1.57      minskim  5391:         <div class="sect1" lang="en">
1.1       grant    5392:           <div class="titlepage">
                   5393:             <div>
                   5394:               <div>
                   5395:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5396:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5397:                 files from behind a firewall</h2>
1.1       grant    5398:               </div>
                   5399:             </div>
                   5400:           </div>
                   5401: 
                   5402:           <p>If you are sitting behind a firewall which does not
                   5403:           allow direct connections to Internet hosts (i.e.
                   5404:           non-NAT), you may specify the relevant proxy hosts. This
                   5405:           is done using an environment variable in the form of a
1.47      reed     5406:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5407:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5408:           firewalls, and it uses port 80 as the proxy port number.
                   5409:           So the proxy environment variables are:</p>
                   5410:           <pre class="programlisting">
1.51      rillig   5411:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5412:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5413: </pre>
                   5414:         </div>
                   5415: 
1.57      minskim  5416:         <div class="sect1" lang="en">
1.1       grant    5417:           <div class="titlepage">
                   5418:             <div>
                   5419:               <div>
                   5420:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  5421:                 "passive-ftp"></a>7.9.&nbsp;How do I tell
                   5422:                 <span><strong class="command">make
1.14      xtraeme  5423:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5424:               </div>
                   5425:             </div>
                   5426:           </div>
                   5427: 
                   5428:           <p>This depends on which utility is used to retrieve
1.45      wiz      5429:           distfiles. From <code xmlns=
                   5430:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5431:           "filename">bsd.pkg.mk</code>, <code class=
                   5432:           "varname">FETCH_CMD</code> is assigned the first
                   5433:           available command from the following list:</p>
1.34      wiz      5434: 
                   5435:           <div class="itemizedlist">
                   5436:             <ul type="disc">
                   5437:               <li>
1.45      wiz      5438:                 <p><code xmlns=
                   5439:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5440:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5441:               </li>
                   5442: 
                   5443:               <li>
1.45      wiz      5444:                 <p><code xmlns=
                   5445:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5446:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5447:               </li>
                   5448:             </ul>
                   5449:           </div>
1.1       grant    5450: 
                   5451:           <p>On a default NetBSD installation, this will be
1.45      wiz      5452:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5453:           class="filename">/usr/bin/ftp</code>, which automatically
                   5454:           tries passive connections first, and falls back to active
                   5455:           connections if the server refuses to do passive. For the
                   5456:           other tools, add the following to your <code xmlns=
                   5457:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5458:           "filename">/etc/mk.conf</code> file: <code class=
                   5459:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5460: 
1.45      wiz      5461:           <p>Having that option present will prevent <code xmlns=
                   5462:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5463:           "filename">/usr/bin/ftp</code> from falling back to
                   5464:           active transfers.</p>
1.1       grant    5465:         </div>
                   5466: 
1.57      minskim  5467:         <div class="sect1" lang="en">
1.1       grant    5468:           <div class="titlepage">
                   5469:             <div>
                   5470:               <div>
                   5471:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5472:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5473:                 fetch all distfiles at once</h2>
                   5474:               </div>
                   5475:             </div>
                   5476:           </div>
                   5477: 
                   5478:           <p>You would like to download all the distfiles in a
                   5479:           single batch from work or university, where you can't run
1.14      xtraeme  5480:           a <span><strong class="command">make
                   5481:           fetch</strong></span>. There is an archive of distfiles
                   5482:           on <a href=
1.1       grant    5483:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5484:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5485:           entire directory may not be appropriate.</p>
                   5486: 
1.14      xtraeme  5487:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5488:           "command">make fetch-list</strong></span> in <code xmlns=
                   5489:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5490:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5491:           subdirectories, carry the resulting list to your machine
1.23      wiz      5492:           at work/school and use it there. If you don't have a
1.24      wiz      5493:           NetBSD-compatible <a href=
                   5494:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5495:           <span class="citerefentry"><span class=
                   5496:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5497:           at work, don't forget to set <code class=
                   5498:           "varname">FETCH_CMD</code> to something that fetches a
                   5499:           URL:</p>
1.1       grant    5500: 
                   5501:           <p>At home:</p>
                   5502:           <pre class="screen">
1.14      xtraeme  5503: <code class="prompt">%</code> <strong class=
                   5504: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5505: <code class="prompt">%</code> <strong class=
                   5506: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5507: <code class="prompt">%</code> <strong class=
                   5508: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5509: </pre>
                   5510: 
                   5511:           <p>At work:</p>
                   5512:           <pre class="screen">
1.14      xtraeme  5513: <code class="prompt">%</code> <strong class=
                   5514: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5515: </pre>
                   5516: 
1.45      wiz      5517:           <p>then tar up <code xmlns=
                   5518:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5519:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5520: 
                   5521:           <p>If you have a machine running NetBSD, and you want to
                   5522:           get <span class="emphasis"><em>all</em></span> distfiles
                   5523:           (even ones that aren't for your machine architecture),
                   5524:           you can do so by using the above-mentioned
1.14      xtraeme  5525:           <span><strong class="command">make
                   5526:           fetch-list</strong></span> approach, or fetch the
                   5527:           distfiles directly by running:</p>
1.1       grant    5528:           <pre class="screen">
1.14      xtraeme  5529: <code class="prompt">%</code> <strong class=
                   5530: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5531: </pre>
                   5532: 
1.14      xtraeme  5533:           <p>If you even decide to ignore <code class=
                   5534:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5535:           can get everything by running:</p>
1.1       grant    5536:           <pre class="screen">
1.14      xtraeme  5537: <code class="prompt">%</code> <strong class=
                   5538: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5539: </pre>
                   5540:         </div>
                   5541: 
1.57      minskim  5542:         <div class="sect1" lang="en">
1.1       grant    5543:           <div class="titlepage">
                   5544:             <div>
                   5545:               <div>
                   5546:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5547:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5548:                 &#8220;<span class="quote">Don't know how to make
                   5549:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5550:               </div>
                   5551:             </div>
                   5552:           </div>
                   5553: 
                   5554:           <p>When compiling the <a xmlns=
                   5555:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5556:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5557:           target="_top"><code xmlns="" class=
                   5558:           "filename">pkgtools/pkg_install</code></a> package, you
                   5559:           get the error from make that it doesn't know how to make
                   5560:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5561:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5562:           indicates that you don't have installed the
1.23      wiz      5563:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5564:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5565:           It is recommended to do that to format man pages.</p>
1.1       grant    5566: 
                   5567:           <p>In the case of the <a xmlns=
                   5568:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5569:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5570:           target="_top"><code xmlns="" class=
                   5571:           "filename">pkgtools/pkg_install</code></a> package, you
                   5572:           can get away with setting <code class=
1.20      ben      5573:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5574:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5575:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5576:         </div>
                   5577: 
1.57      minskim  5578:         <div class="sect1" lang="en">
1.1       grant    5579:           <div class="titlepage">
                   5580:             <div>
                   5581:               <div>
                   5582:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5583:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5584:                 &#8220;<span class="quote">Could not find
                   5585:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5586:               </div>
                   5587:             </div>
                   5588:           </div>
                   5589: 
1.45      wiz      5590:           <p>You didn't install the compiler set, <code xmlns=
                   5591:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5592:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5593:           NetBSD machine. Please get and install it, by extracting
                   5594:           it in <code xmlns=
1.45      wiz      5595:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5596:           "filename">/</code>:</p>
1.1       grant    5597:           <pre class="screen">
1.14      xtraeme  5598: <code class="prompt">#</code> <strong class=
                   5599: "userinput"><code>cd /</code></strong>
                   5600: <code class="prompt">#</code> <strong class=
                   5601: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5602: </pre>
                   5603: 
1.45      wiz      5604:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5605:           class="filename">comp.tgz</code> is part of every NetBSD
                   5606:           release. Get the one that corresponds to your release
                   5607:           (determine via <span><strong class="command">uname
                   5608:           -r</strong></span>).</p>
1.1       grant    5609:         </div>
                   5610: 
1.57      minskim  5611:         <div class="sect1" lang="en">
1.1       grant    5612:           <div class="titlepage">
                   5613:             <div>
                   5614:               <div>
                   5615:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5616:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5617:                 'sudo' with pkgsrc</h2>
                   5618:               </div>
                   5619:             </div>
                   5620:           </div>
                   5621: 
                   5622:           <p>When installing packages as non-root user and using
1.24      wiz      5623:           the just-in-time <a href=
                   5624:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5625:           <span class="citerefentry"><span class=
                   5626:           "refentrytitle">su</span>(1)</span></a> feature of
                   5627:           pkgsrc, it can become annoying to type in the root
                   5628:           password for each required package installed. To avoid
                   5629:           this, the sudo package can be used, which does password
                   5630:           caching over a limited time. To use it, install sudo
                   5631:           (either as binary package or from <a xmlns=
                   5632:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5633:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5634:           target="_top"><code xmlns="" class=
                   5635:           "filename">security/sudo</code></a>) and then put the
                   5636:           following into your <code xmlns=
                   5637:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5638:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5639:           <pre class="programlisting">
1.51      rillig   5640:     .if exists(${LOCALBASE}/bin/sudo)
                   5641:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   5642:     .endif
1.1       grant    5643: </pre>
                   5644:         </div>
                   5645: 
1.57      minskim  5646:         <div class="sect1" lang="en">
1.1       grant    5647:           <div class="titlepage">
                   5648:             <div>
                   5649:               <div>
                   5650:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  5651:                 "faq.conf"></a>7.14.&nbsp;How do I change the
                   5652:                 location of configuration files?</h2>
1.1       grant    5653:               </div>
                   5654:             </div>
                   5655:           </div>
                   5656: 
1.35      jmmv     5657:           <p>As the system administrator, you can choose where
                   5658:           configuration files are installed. The default settings
1.45      wiz      5659:           make all these files go into <code xmlns=
                   5660:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5661:           "filename">${PREFIX}/etc</code> or some of its
                   5662:           subdirectories; this may be suboptimal depending on your
                   5663:           expectations (e.g., a read-only, NFS-exported
                   5664:           <code class="varname">PREFIX</code> with a need of
                   5665:           per-machine configuration of the provided packages).</p>
                   5666: 
                   5667:           <p>In order to change the defaults, you can modify the
                   5668:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5669:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5670:           class="filename">/etc/mk.conf</code>) to point to your
                   5671:           preferred configuration directory; some common examples
                   5672:           include <code xmlns=
                   5673:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5674:           "filename">/etc</code> or <code xmlns=
                   5675:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5676:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5677: 
                   5678:           <p>Furthermore, you can change this value on a
                   5679:           per-package basis by setting the <code class=
                   5680:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5681:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5682:           value usually matches the name of the package you would
                   5683:           like to modify, that is, the contents of <code class=
                   5684:           "varname">PKGBASE</code>.</p>
1.1       grant    5685: 
1.47      reed     5686:           <p>Note that after changing these settings, you must
1.35      jmmv     5687:           rebuild and reinstall any affected packages.</p>
1.1       grant    5688:         </div>
                   5689: 
1.57      minskim  5690:         <div class="sect1" lang="en">
1.1       grant    5691:           <div class="titlepage">
                   5692:             <div>
                   5693:               <div>
                   5694:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5695:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5696:                 checks</h2>
                   5697:               </div>
                   5698:             </div>
                   5699:           </div>
                   5700: 
                   5701:           <p>Please be aware that there can often be bugs in
                   5702:           third-party software, and some of these bugs can leave a
                   5703:           machine vulnerable to exploitation by attackers. In an
                   5704:           effort to lessen the exposure, the NetBSD packages team
                   5705:           maintains a database of known-exploits to packages which
                   5706:           have at one time been included in pkgsrc. The database
                   5707:           can be downloaded automatically, and a security audit of
                   5708:           all packages installed on a system can take place. To do
                   5709:           this, install the <a xmlns=
                   5710:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5711:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5712:           target="_top"><code xmlns="" class=
                   5713:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5714:           has two components:</p>
1.1       grant    5715: 
                   5716:           <div class="orderedlist">
                   5717:             <ol type="1">
                   5718:               <li>
1.34      wiz      5719:                 <p><span><strong class=
                   5720:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5721:                 an easy way to download a list of the security
                   5722:                 vulnerabilities information. This list is kept up
                   5723:                 to date by the NetBSD security officer and the
                   5724:                 NetBSD packages team, and is distributed from the
                   5725:                 NetBSD ftp server:</p>
                   5726: 
                   5727:                 <p><a href=
                   5728:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5729:                 target=
                   5730:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5731:               </li>
                   5732: 
                   5733:               <li>
1.34      wiz      5734:                 <p><span><strong class=
                   5735:                 "command">audit-packages</strong></span>, an easy
                   5736:                 way to audit the current machine, checking each
1.1       grant    5737:                 vulnerability which is known. If a vulnerable
                   5738:                 package is installed, it will be shown by output to
                   5739:                 stdout, including a description of the type of
                   5740:                 vulnerability, and a URL containing more
                   5741:                 information.</p>
                   5742:               </li>
                   5743:             </ol>
                   5744:           </div>
                   5745: 
1.23      wiz      5746:           <p>Use of the <a xmlns=
                   5747:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5748:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5749:           target="_top"><code xmlns="" class=
                   5750:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5751:           strongly recommended! After &#8220;<span class=
                   5752:           "quote">audit-packages</span>&#8221; is installed, please
                   5753:           read the package's message, which you can get by running
                   5754:           <strong class="userinput"><code>pkg_info -D
                   5755:           audit-package</code></strong>.</p>
1.58    ! erh      5756: 
        !          5757:           <p>If this package is installed, pkgsrc builds will use
        !          5758:           it to perform a security check before building any
        !          5759:           package. See <a href="#variables-affecting-build" title=
        !          5760:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
        !          5761:           &#8220;Variables affecting the build process&#8221;</a>
        !          5762:           for way to control this check.</p>
1.1       grant    5763:         </div>
                   5764:       </div>
                   5765:     </div>
                   5766: 
1.57      minskim  5767:     <div class="part" lang="en">
1.1       grant    5768:       <div class="titlepage">
                   5769:         <div>
                   5770:           <div>
1.57      minskim  5771:             <h1 class="title"><a name=
1.48      dillo    5772:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5773:             developer's guide</h1>
1.1       grant    5774:           </div>
                   5775:         </div>
                   5776:       </div>
                   5777: 
                   5778:       <div class="toc">
                   5779:         <p><b>Table of Contents</b></p>
                   5780: 
                   5781:         <dl>
1.38      dillo    5782:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5783:           Package components - files, directories and
                   5784:           contents</a></span></dt>
                   5785: 
                   5786:           <dd>
                   5787:             <dl>
                   5788:               <dt><span class="sect1"><a href=
1.45      wiz      5789:               "#components.Makefile">8.1. <code xmlns=
                   5790:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5791:               "filename">Makefile</code></a></span></dt>
                   5792: 
                   5793:               <dt><span class="sect1"><a href=
1.45      wiz      5794:               "#components.distinfo">8.2. <code xmlns=
                   5795:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5796:               "filename">distinfo</code></a></span></dt>
                   5797: 
                   5798:               <dt><span class="sect1"><a href=
1.38      dillo    5799:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5800: 
1.30      wiz      5801:               <dt><span class="sect1"><a href=
1.38      dillo    5802:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5803:               files</a></span></dt>
1.27      rillig   5804: 
                   5805:               <dt><span class="sect1"><a href=
1.38      dillo    5806:               "#components.optional">8.5. Optional
1.27      rillig   5807:               files</a></span></dt>
                   5808: 
1.38      dillo    5809:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5810:               <code xmlns=
                   5811:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5812:               "filename">work*</code></a></span></dt>
1.27      rillig   5813: 
1.38      dillo    5814:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5815:               <code xmlns=
                   5816:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5817:               "filename">files/*</code></a></span></dt>
1.27      rillig   5818:             </dl>
                   5819:           </dd>
                   5820: 
1.38      dillo    5821:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      5822:           Programming in <code xmlns=
                   5823:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5824:           "filename">Makefile</code>s</a></span></dt>
                   5825: 
                   5826:           <dd>
                   5827:             <dl>
                   5828:               <dt><span class="sect1"><a href=
1.45      wiz      5829:               "#makefile.variables">9.1. <code xmlns=
                   5830:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5831:               "filename">Makefile</code> variables</a></span></dt>
                   5832: 
1.27      rillig   5833:               <dd>
                   5834:                 <dl>
                   5835:                   <dt><span class="sect2"><a href=
1.38      dillo    5836:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5837:                   conventions</a></span></dt>
                   5838:                 </dl>
                   5839:               </dd>
                   5840: 
1.38      dillo    5841:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5842:               Code snippets</a></span></dt>
                   5843: 
                   5844:               <dd>
                   5845:                 <dl>
                   5846:                   <dt><span class="sect2"><a href=
1.38      dillo    5847:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5848:                   list</a></span></dt>
                   5849: 
                   5850:                   <dt><span class="sect2"><a href=
1.38      dillo    5851:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5852:                   Converting an internal list into an external
                   5853:                   list</a></span></dt>
1.25      rillig   5854: 
                   5855:                   <dt><span class="sect2"><a href=
1.38      dillo    5856:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5857:                   variables to a shell command</a></span></dt>
1.27      rillig   5858: 
                   5859:                   <dt><span class="sect2"><a href=
1.38      dillo    5860:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5861:                   guideline</a></span></dt>
                   5862: 
                   5863:                   <dt><span class="sect2"><a href=
1.38      dillo    5864:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5865:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5866:                 </dl>
                   5867:               </dd>
                   5868:             </dl>
                   5869:           </dd>
                   5870: 
1.38      dillo    5871:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5872:           issues</a></span></dt>
                   5873: 
                   5874:           <dd>
                   5875:             <dl>
1.38      dillo    5876:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5877:               ID</a></span></dt>
                   5878: 
1.30      wiz      5879:               <dt><span class="sect1"><a href=
1.38      dillo    5880:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      5881:               <code xmlns=
                   5882:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5883:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    5884: 
1.38      dillo    5885:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  5886:               Tweaking output of <span><strong class="command">make
                   5887:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5888: 
1.38      dillo    5889:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    5890:               Variable substitution in PLIST</a></span></dt>
                   5891: 
1.30      wiz      5892:               <dt><span class="sect1"><a href=
1.48      dillo    5893:               "#manpage-compression">10.5. Man page
                   5894:               compression</a></span></dt>
1.1       grant    5895: 
1.30      wiz      5896:               <dt><span class="sect1"><a href=
1.38      dillo    5897:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      5898:               <code class=
1.14      xtraeme  5899:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5900: 
1.30      wiz      5901:               <dt><span class="sect1"><a href=
1.47      reed     5902:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    5903:               and differing PLISTs</a></span></dt>
1.1       grant    5904: 
                   5905:               <dt><span class="sect1"><a href=
1.38      dillo    5906:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    5907:               packages</a></span></dt>
                   5908:             </dl>
                   5909:           </dd>
                   5910: 
1.38      dillo    5911:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    5912:           Buildlink methodology</a></span></dt>
                   5913: 
                   5914:           <dd>
                   5915:             <dl>
1.30      wiz      5916:               <dt><span class="sect1"><a href=
1.38      dillo    5917:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      5918:               to use buildlink3</a></span></dt>
1.1       grant    5919: 
1.30      wiz      5920:               <dt><span class="sect1"><a href=
1.45      wiz      5921:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   5922:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5923:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    5924: 
                   5925:               <dd>
                   5926:                 <dl>
                   5927:                   <dt><span class="sect2"><a href=
1.38      dillo    5928:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      5929:                   buildlink3.mk file</a></span></dt>
1.1       grant    5930: 
                   5931:                   <dt><span class="sect2"><a href=
1.38      dillo    5932:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      5933:                   <code class=
1.57      minskim  5934:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5935:                   in <code xmlns=
1.45      wiz      5936:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5937:                   "filename">buildlink3.mk</code>
1.1       grant    5938:                   files</a></span></dt>
                   5939:                 </dl>
                   5940:               </dd>
                   5941: 
1.30      wiz      5942:               <dt><span class="sect1"><a href=
1.45      wiz      5943:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   5944:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5945:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    5946: 
                   5947:               <dd>
                   5948:                 <dl>
                   5949:                   <dt><span class="sect2"><a href=
1.38      dillo    5950:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      5951:                   <code xmlns=
                   5952:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   5953:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5954: 
                   5955:                   <dt><span class="sect2"><a href=
1.38      dillo    5956:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      5957:                   preferences for native or pkgsrc
                   5958:                   software</a></span></dt>
1.1       grant    5959:                 </dl>
                   5960:               </dd>
                   5961:             </dl>
                   5962:           </dd>
                   5963: 
1.38      dillo    5964:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     5965:           pkginstall framework</a></span></dt>
                   5966: 
                   5967:           <dd>
                   5968:             <dl>
                   5969:               <dt><span class="sect1"><a href=
1.38      dillo    5970:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     5971:               directories outside the installation
                   5972:               prefix</a></span></dt>
                   5973: 
                   5974:               <dd>
                   5975:                 <dl>
                   5976:                   <dt><span class="sect2"><a href=
1.38      dillo    5977:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     5978:                   manipulation</a></span></dt>
                   5979: 
                   5980:                   <dt><span class="sect2"><a href=
1.38      dillo    5981:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     5982:                   manipulation</a></span></dt>
                   5983:                 </dl>
                   5984:               </dd>
                   5985: 
1.38      dillo    5986:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     5987:               Configuration files</a></span></dt>
                   5988: 
                   5989:               <dd>
                   5990:                 <dl>
                   5991:                   <dt><span class="sect2"><a href=
1.38      dillo    5992:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     5993:                   "varname">PKG_SYSCONFDIR</code> is
                   5994:                   set</a></span></dt>
                   5995: 
                   5996:                   <dt><span class="sect2"><a href=
1.38      dillo    5997:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     5998:                   software where configuration files
1.35      jmmv     5999:                   are</a></span></dt>
                   6000: 
                   6001:                   <dt><span class="sect2"><a href=
1.38      dillo    6002:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6003:                   installations</a></span></dt>
                   6004: 
                   6005:                   <dt><span class="sect2"><a href=
1.38      dillo    6006:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6007:                   of configuration files</a></span></dt>
                   6008:                 </dl>
                   6009:               </dd>
                   6010: 
1.38      dillo    6011:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6012:               System startup scripts</a></span></dt>
                   6013: 
                   6014:               <dd>
                   6015:                 <dl>
                   6016:                   <dt><span class="sect2"><a href=
1.38      dillo    6017:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6018:                   of system startup scripts</a></span></dt>
                   6019:                 </dl>
                   6020:               </dd>
                   6021: 
                   6022:               <dt><span class="sect1"><a href=
1.38      dillo    6023:               "#users-and-groups">12.4. System users and
1.35      jmmv     6024:               groups</a></span></dt>
                   6025: 
1.38      dillo    6026:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6027:               System shells</a></span></dt>
                   6028: 
                   6029:               <dd>
                   6030:                 <dl>
                   6031:                   <dt><span class="sect2"><a href=
1.38      dillo    6032:                   "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     6033:                   configuration files</a></span></dt>
                   6034:                 </dl>
                   6035:               </dd>
                   6036:             </dl>
                   6037:           </dd>
                   6038: 
1.38      dillo    6039:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6040:           handling</a></span></dt>
                   6041: 
                   6042:           <dd>
                   6043:             <dl>
1.30      wiz      6044:               <dt><span class="sect1"><a href=
1.38      dillo    6045:               "#global-default-options">13.1. Global default
1.30      wiz      6046:               options</a></span></dt>
1.1       grant    6047: 
1.30      wiz      6048:               <dt><span class="sect1"><a href=
1.38      dillo    6049:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6050:               use <code xmlns=
                   6051:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6052:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6053: 
                   6054:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6055:               Option Names</a></span></dt>
1.1       grant    6056:             </dl>
                   6057:           </dd>
                   6058: 
1.38      dillo    6059:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6060:           process</a></span></dt>
                   6061: 
                   6062:           <dd>
                   6063:             <dl>
1.56      rillig   6064:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6065:               Introduction</a></span></dt>
                   6066: 
                   6067:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6068:               Program location</a></span></dt>
                   6069: 
1.56      rillig   6070:               <dt><span class="sect1"><a href=
                   6071:               "#build.builddirs">14.3. Directories used during the
                   6072:               build process</a></span></dt>
1.1       grant    6073: 
                   6074:               <dt><span class="sect1"><a href=
1.56      rillig   6075:               "#build.running">14.4. Running a
                   6076:               phase</a></span></dt>
                   6077: 
                   6078:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6079:               The <span class="emphasis"><em>fetch</em></span>
                   6080:               phase</a></span></dt>
                   6081: 
                   6082:               <dt><span class="sect1"><a href=
                   6083:               "#build.checksum">14.6. The <span class=
                   6084:               "emphasis"><em>checksum</em></span>
                   6085:               phase</a></span></dt>
                   6086: 
                   6087:               <dt><span class="sect1"><a href=
                   6088:               "#build.extract">14.7. The <span class=
                   6089:               "emphasis"><em>extract</em></span>
                   6090:               phase</a></span></dt>
                   6091: 
                   6092:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6093:               The <span class="emphasis"><em>patch</em></span>
                   6094:               phase</a></span></dt>
                   6095: 
                   6096:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6097:               The <span class="emphasis"><em>tools</em></span>
                   6098:               phase</a></span></dt>
                   6099: 
                   6100:               <dt><span class="sect1"><a href=
                   6101:               "#build.wrapper">14.10. The <span class=
                   6102:               "emphasis"><em>wrapper</em></span>
                   6103:               phase</a></span></dt>
                   6104: 
                   6105:               <dt><span class="sect1"><a href=
                   6106:               "#build.configure">14.11. The <span class=
                   6107:               "emphasis"><em>configure</em></span>
                   6108:               phase</a></span></dt>
                   6109: 
                   6110:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6111:               The <span class="emphasis"><em>build</em></span>
                   6112:               phase</a></span></dt>
                   6113: 
                   6114:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6115:               The <span class="emphasis"><em>test</em></span>
                   6116:               phase</a></span></dt>
                   6117: 
                   6118:               <dt><span class="sect1"><a href=
                   6119:               "#build.install">14.14. The <span class=
                   6120:               "emphasis"><em>install</em></span>
                   6121:               phase</a></span></dt>
                   6122: 
                   6123:               <dt><span class="sect1"><a href=
                   6124:               "#build.package">14.15. The <span class=
                   6125:               "emphasis"><em>package</em></span>
                   6126:               phase</a></span></dt>
                   6127: 
                   6128:               <dt><span class="sect1"><a href=
                   6129:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6130:               targets</a></span></dt>
                   6131:             </dl>
                   6132:           </dd>
                   6133: 
1.55      rillig   6134:           <dt><span class="chapter"><a href="#fixes">15. Making
                   6135:           your package work</a></span></dt>
1.1       grant    6136: 
                   6137:           <dd>
                   6138:             <dl>
1.30      wiz      6139:               <dt><span class="sect1"><a href=
1.38      dillo    6140:               "#general-operation">15.1. General
1.30      wiz      6141:               operation</a></span></dt>
1.1       grant    6142: 
                   6143:               <dd>
                   6144:                 <dl>
                   6145:                   <dt><span class="sect2"><a href=
1.38      dillo    6146:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      6147:                   pull in variables from
                   6148:                   /etc/mk.conf</a></span></dt>
1.1       grant    6149: 
                   6150:                   <dt><span class="sect2"><a href=
1.38      dillo    6151:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      6152:                   to install documentation</a></span></dt>
                   6153: 
                   6154:                   <dt><span class="sect2"><a href=
1.38      dillo    6155:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    6156:                   packages</a></span></dt>
                   6157: 
                   6158:                   <dt><span class="sect2"><a href=
1.38      dillo    6159:                   "#dependencies">15.1.4. Handling
1.1       grant    6160:                   dependencies</a></span></dt>
                   6161: 
                   6162:                   <dt><span class="sect2"><a href=
1.38      dillo    6163:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    6164:                   other packages</a></span></dt>
                   6165: 
                   6166:                   <dt><span class="sect2"><a href=
1.38      dillo    6167:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      6168:                   cannot or should not be built</a></span></dt>
1.1       grant    6169: 
                   6170:                   <dt><span class="sect2"><a href=
1.38      dillo    6171:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      6172:                   should not be deleted, once
                   6173:                   installed</a></span></dt>
1.1       grant    6174: 
                   6175:                   <dt><span class="sect2"><a href=
1.38      dillo    6176:                   "#security-handling">15.1.8. Handling packages
1.1       grant    6177:                   with security problems</a></span></dt>
                   6178: 
                   6179:                   <dt><span class="sect2"><a href=
1.38      dillo    6180:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    6181:                   bugs</a></span></dt>
                   6182: 
                   6183:                   <dt><span class="sect2"><a href=
1.38      dillo    6184:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      6185:                   incrementing versions when fixing an existing
1.1       grant    6186:                   package</a></span></dt>
                   6187: 
                   6188:                   <dt><span class="sect2"><a href=
1.38      dillo    6189:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      6190:                   of packages</a></span></dt>
1.1       grant    6191:                 </dl>
                   6192:               </dd>
                   6193: 
1.30      wiz      6194:               <dt><span class="sect1"><a href=
1.38      dillo    6195:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      6196:               issues</a></span></dt>
1.1       grant    6197: 
                   6198:               <dd>
                   6199:                 <dl>
                   6200:                   <dt><span class="sect2"><a href=
1.38      dillo    6201:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      6202:                   distfiles aren't available for plain
1.1       grant    6203:                   downloading</a></span></dt>
                   6204: 
                   6205:                   <dt><span class="sect2"><a href=
1.38      dillo    6206:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      6207:                   handle modified distfiles with the 'old'
                   6208:                   name</a></span></dt>
1.1       grant    6209:                 </dl>
                   6210:               </dd>
                   6211: 
1.30      wiz      6212:               <dt><span class="sect1"><a href=
1.38      dillo    6213:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      6214:               gotchas</a></span></dt>
1.1       grant    6215: 
                   6216:               <dd>
                   6217:                 <dl>
                   6218:                   <dt><span class="sect2"><a href=
1.38      dillo    6219:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    6220:                   libtool</a></span></dt>
                   6221: 
                   6222:                   <dt><span class="sect2"><a href=
1.38      dillo    6223:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    6224:                   packages that already support
                   6225:                   libtool</a></span></dt>
                   6226: 
                   6227:                   <dt><span class="sect2"><a href=
1.38      dillo    6228:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    6229:                   Autoconf/Automake</a></span></dt>
                   6230:                 </dl>
                   6231:               </dd>
                   6232: 
1.55      rillig   6233:               <dt><span class="sect1"><a href="#fixes-build">15.4.
                   6234:               Building the package</a></span></dt>
1.1       grant    6235: 
                   6236:               <dd>
                   6237:                 <dl>
                   6238:                   <dt><span class="sect2"><a href=
1.38      dillo    6239:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      6240:                   defines</a></span></dt>
1.51      rillig   6241: 
                   6242:                   <dt><span class="sect2"><a href=
                   6243:                   "#cpp-list">15.4.2. Getting a list of CPP
                   6244:                   defines</a></span></dt>
1.1       grant    6245:                 </dl>
                   6246:               </dd>
                   6247: 
1.30      wiz      6248:               <dt><span class="sect1"><a href=
1.38      dillo    6249:               "#package-specific-actions">15.5. Package specific
1.30      wiz      6250:               actions</a></span></dt>
1.1       grant    6251: 
                   6252:               <dd>
                   6253:                 <dl>
                   6254:                   <dt><span class="sect2"><a href=
1.38      dillo    6255:                   "#user-interaction">15.5.1. User
1.2       hubertf  6256:                   interaction</a></span></dt>
1.1       grant    6257: 
                   6258:                   <dt><span class="sect2"><a href=
1.38      dillo    6259:                   "#handling-licenses">15.5.2. Handling
1.1       grant    6260:                   licenses</a></span></dt>
                   6261: 
                   6262:                   <dt><span class="sect2"><a href=
1.38      dillo    6263:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      6264:                   score files</a></span></dt>
1.1       grant    6265: 
                   6266:                   <dt><span class="sect2"><a href=
1.38      dillo    6267:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    6268:                   scripts</a></span></dt>
                   6269: 
                   6270:                   <dt><span class="sect2"><a href=
1.38      dillo    6271:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      6272:                   hardcoded paths to other
                   6273:                   interpreters</a></span></dt>
1.1       grant    6274: 
                   6275:                   <dt><span class="sect2"><a href=
1.38      dillo    6276:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    6277:                   modules</a></span></dt>
                   6278: 
                   6279:                   <dt><span class="sect2"><a href=
1.38      dillo    6280:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    6281:                   info files</a></span></dt>
                   6282: 
                   6283:                   <dt><span class="sect2"><a href=
1.57      minskim  6284:                   "#manpages">15.5.8. Packages installing man
                   6285:                   pages</a></span></dt>
                   6286: 
                   6287:                   <dt><span class="sect2"><a href=
                   6288:                   "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      6289:                   GConf2 data files</a></span></dt>
1.1       grant    6290: 
                   6291:                   <dt><span class="sect2"><a href=
1.57      minskim  6292:                   "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      6293:                   installing scrollkeeper data
                   6294:                   files</a></span></dt>
1.1       grant    6295: 
                   6296:                   <dt><span class="sect2"><a href=
1.57      minskim  6297:                   "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    6298:                   fonts</a></span></dt>
                   6299: 
                   6300:                   <dt><span class="sect2"><a href=
1.57      minskim  6301:                   "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    6302:                   modules</a></span></dt>
                   6303: 
                   6304:                   <dt><span class="sect2"><a href=
1.57      minskim  6305:                   "#sgml-xml-data">15.5.13. Packages installing
1.30      wiz      6306:                   SGML or XML data</a></span></dt>
1.1       grant    6307: 
                   6308:                   <dt><span class="sect2"><a href=
1.57      minskim  6309:                   "#mime-database">15.5.14. Packages installing
1.1       grant    6310:                   extensions to the MIME database</a></span></dt>
                   6311: 
                   6312:                   <dt><span class="sect2"><a href=
1.57      minskim  6313:                   "#intltool">15.5.15. Packages using
1.1       grant    6314:                   intltool</a></span></dt>
1.18      xtraeme  6315: 
                   6316:                   <dt><span class="sect2"><a href=
1.57      minskim  6317:                   "#startup-scripts">15.5.16. Packages installing
1.30      wiz      6318:                   startup scripts</a></span></dt>
1.57      minskim  6319: 
                   6320:                   <dt><span class="sect2"><a href=
                   6321:                   "#tex-packages">15.5.17. Packages installing TeX
                   6322:                   modules</a></span></dt>
1.1       grant    6323:                 </dl>
                   6324:               </dd>
                   6325: 
1.30      wiz      6326:               <dt><span class="sect1"><a href=
1.38      dillo    6327:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6328:               author</a></span></dt>
1.1       grant    6329:             </dl>
                   6330:           </dd>
                   6331: 
1.38      dillo    6332:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6333:           Debugging</a></span></dt>
                   6334: 
1.38      dillo    6335:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6336:           Submitting and Committing</a></span></dt>
                   6337: 
                   6338:           <dd>
                   6339:             <dl>
1.30      wiz      6340:               <dt><span class="sect1"><a href=
1.38      dillo    6341:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6342:               packages</a></span></dt>
1.1       grant    6343: 
1.30      wiz      6344:               <dt><span class="sect1"><a href=
1.41      wiz      6345:               "#general-notes-for-changes">17.2. General notes when
                   6346:               adding, updating, or removing
                   6347:               packages</a></span></dt>
                   6348: 
                   6349:               <dt><span class="sect1"><a href=
                   6350:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6351:               package into CVS</a></span></dt>
1.1       grant    6352: 
1.30      wiz      6353:               <dt><span class="sect1"><a href=
1.41      wiz      6354:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6355:               newer version</a></span></dt>
1.1       grant    6356: 
1.30      wiz      6357:               <dt><span class="sect1"><a href=
1.41      wiz      6358:               "#moving-package">17.5. Moving a package in
1.30      wiz      6359:               pkgsrc</a></span></dt>
1.1       grant    6360:             </dl>
                   6361:           </dd>
                   6362:         </dl>
                   6363:       </div>
                   6364: 
1.57      minskim  6365:       <div class="chapter" lang="en">
1.1       grant    6366:         <div class="titlepage">
                   6367:           <div>
                   6368:             <div>
1.57      minskim  6369:               <h2 class="title"><a name=
1.38      dillo    6370:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6371:               components - files, directories and contents</h2>
1.25      rillig   6372:             </div>
                   6373:           </div>
                   6374:         </div>
                   6375: 
                   6376:         <div class="toc">
                   6377:           <p><b>Table of Contents</b></p>
                   6378: 
                   6379:           <dl>
                   6380:             <dt><span class="sect1"><a href=
1.45      wiz      6381:             "#components.Makefile">8.1. <code xmlns=
                   6382:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6383:             "filename">Makefile</code></a></span></dt>
                   6384: 
                   6385:             <dt><span class="sect1"><a href=
1.45      wiz      6386:             "#components.distinfo">8.2. <code xmlns=
                   6387:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6388:             "filename">distinfo</code></a></span></dt>
                   6389: 
                   6390:             <dt><span class="sect1"><a href=
1.38      dillo    6391:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6392: 
1.30      wiz      6393:             <dt><span class="sect1"><a href=
1.38      dillo    6394:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6395:             files</a></span></dt>
1.25      rillig   6396: 
1.27      rillig   6397:             <dt><span class="sect1"><a href=
1.38      dillo    6398:             "#components.optional">8.5. Optional
1.27      rillig   6399:             files</a></span></dt>
1.25      rillig   6400: 
1.38      dillo    6401:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6402:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6403:             class="filename">work*</code></a></span></dt>
1.25      rillig   6404: 
1.38      dillo    6405:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6406:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6407:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6408:           </dl>
                   6409:         </div>
                   6410: 
1.27      rillig   6411:         <p>Whenever you're preparing a package, there are a number
                   6412:         of files involved which are described in the following
                   6413:         sections.</p>
1.25      rillig   6414: 
1.57      minskim  6415:         <div class="sect1" lang="en">
1.25      rillig   6416:           <div class="titlepage">
                   6417:             <div>
                   6418:               <div>
                   6419:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6420:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6421:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6422:                 "filename">Makefile</code></h2>
1.25      rillig   6423:               </div>
                   6424:             </div>
                   6425:           </div>
                   6426: 
1.27      rillig   6427:           <p>Building, installation and creation of a binary
1.45      wiz      6428:           package are all controlled by the package's <code xmlns=
                   6429:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6430:           "filename">Makefile</code>. The <code xmlns=
                   6431:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6432:           "filename">Makefile</code> describes various things about
                   6433:           a package, for example from where to get it, how to
                   6434:           configure, build, and install it.</p>
                   6435: 
1.45      wiz      6436:           <p>A package <code xmlns=
                   6437:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6438:           "filename">Makefile</code> contains several sections that
                   6439:           describe the package.</p>
1.25      rillig   6440: 
1.27      rillig   6441:           <p>In the first section there are the following
                   6442:           variables, which should appear exactly in the order given
                   6443:           here.</p>
1.25      rillig   6444: 
                   6445:           <div class="itemizedlist">
                   6446:             <ul type="disc">
                   6447:               <li>
1.27      rillig   6448:                 <p><code class="varname">DISTNAME</code> is the
                   6449:                 basename of the distribution file to be downloaded
                   6450:                 from the package's website.</p>
                   6451:               </li>
                   6452: 
                   6453:               <li>
                   6454:                 <p><code class="varname">PKGNAME</code> is the name
                   6455:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6456:                 provide it if it differs from <code class=
                   6457:                 "varname">DISTNAME</code>. Usually it is the
                   6458:                 directory name together with the version number. It
                   6459:                 must match the regular expression <code class=
1.27      rillig   6460:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6461:                 that is, it starts with a letter or digit, and
                   6462:                 contains only letters, digits, dashes, underscores,
                   6463:                 dots and plus signs.</p>
1.25      rillig   6464:               </li>
                   6465: 
                   6466:               <li>
1.27      rillig   6467:                 <p><code class="varname">CATEGORIES</code> is a
                   6468:                 list of categories which the package fits in. You
                   6469:                 can choose any of the top-level directories of
                   6470:                 pkgsrc for it.</p>
1.45      wiz      6471: 
                   6472:                 <p>Currently the following values are available for
                   6473:                 <code class="varname">CATEGORIES</code>. If more
                   6474:                 than one is used, they need to be separated by
                   6475:                 spaces:</p>
                   6476:                 <pre class="programlisting">
1.51      rillig   6477:     archivers     cross         geography     meta-pkgs     security
                   6478:     audio         databases     graphics      misc          shells
                   6479:     benchmarks    devel         ham           multimedia    sysutils
                   6480:     biology       editors       inputmethod   net           textproc
                   6481:     cad           emulators     lang          news          time
                   6482:     chat          finance       mail          parallel      wm
                   6483:     comms         fonts         math          pkgtools      www
                   6484:     converters    games         mbone         print         x11
1.45      wiz      6485: </pre>
1.25      rillig   6486:               </li>
                   6487: 
                   6488:               <li>
1.27      rillig   6489:                 <p><code class="varname">MASTER_SITES</code> is a
                   6490:                 list of URLs where the distribution files can be
                   6491:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6492: 
                   6493:                 <p>The <code class="varname">MASTER_SITES</code>
                   6494:                 may make use of the following predefined sites:</p>
                   6495:                 <pre class="programlisting">
1.51      rillig   6496:     ${MASTER_SITE_APACHE}
                   6497:     ${MASTER_SITE_BACKUP}
                   6498:     ${MASTER_SITE_CYGWIN}
                   6499:     ${MASTER_SITE_DEBIAN}
                   6500:     ${MASTER_SITE_FREEBSD}
                   6501:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6502:     ${MASTER_SITE_GNOME}
                   6503:     ${MASTER_SITE_GNU}
                   6504:     ${MASTER_SITE_GNUSTEP}
                   6505:     ${MASTER_SITE_IFARCHIVE}
                   6506:     ${MASTER_SITE_MOZILLA}
                   6507:     ${MASTER_SITE_OPENOFFICE}
                   6508:     ${MASTER_SITE_PERL_CPAN}
                   6509:     ${MASTER_SITE_R_CRAN}
                   6510:     ${MASTER_SITE_SOURCEFORGE}
                   6511:     ${MASTER_SITE_SUNSITE}
                   6512:     ${MASTER_SITE_SUSE}
                   6513:     ${MASTER_SITE_TEX_CTAN}
                   6514:     ${MASTER_SITE_XCONTRIB}
                   6515:     ${MASTER_SITE_XEMACS}
1.45      wiz      6516: </pre>
                   6517: 
                   6518:                 <p>If one of these predefined sites is chosen, you
                   6519:                 may want to specify a subdirectory of that site.
                   6520:                 Since these macros may expand to more than one
                   6521:                 actual site, you <span class=
                   6522:                 "emphasis"><em>must</em></span> use the following
                   6523:                 construct to specify a subdirectory:</p>
                   6524:                 <pre class="programlisting">
1.51      rillig   6525:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   6526:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      6527: </pre>
                   6528: 
                   6529:                 <p>Note the trailing slash after the subdirectory
                   6530:                 name.</p>
                   6531: 
                   6532:                 <p>If the package has multiple <code class=
                   6533:                 "varname">DISTFILES</code> or multiple <code class=
                   6534:                 "varname">PATCHFILES</code> from different sites,
                   6535:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6536:                 list of URIs where file &#8220;<span class=
1.45      wiz      6537:                 "quote">foo</span>&#8221; may be found.
                   6538:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6539:                 includes the suffix, e.g.:</p>
1.45      wiz      6540:                 <pre class="programlisting">
1.51      rillig   6541:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6542:     DISTFILES+=     foo-file.tar.gz
                   6543:     SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6544:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      6545: </pre>
                   6546:               </li>
                   6547: 
                   6548:               <li>
                   6549:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6550:                 of archive file(s) containing distribution. The
                   6551:                 default is <code xmlns=
                   6552:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6553:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6554:                 Should only be set if you have more than one
                   6555:                 distfile.</p>
                   6556: 
                   6557:                 <p>Note that the normal default setting of
                   6558:                 <code class="varname">DISTFILES</code> must be made
                   6559:                 explicit if you want to add to it (rather than
                   6560:                 replace it), as you usually would.</p>
                   6561:               </li>
                   6562: 
                   6563:               <li>
                   6564:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6565:                 Suffix of the distribution file, will be appended
                   6566:                 to <code class="varname">DISTNAME</code>. Defaults
                   6567:                 to <code xmlns=
                   6568:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6569:                 "filename">.tar.gz</code>.</p>
                   6570:               </li>
                   6571:             </ul>
                   6572:           </div>
                   6573: 
                   6574:           <p>The second section contains information about
                   6575:           separately downloaded patches, if any.</p>
                   6576: 
                   6577:           <div class="itemizedlist">
                   6578:             <ul type="disc">
                   6579:               <li>
1.47      reed     6580:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6581:                 of additional files that contain distribution
                   6582:                 patches. There is no default. pkgsrc will look for
                   6583:                 them at <code class="varname">PATCH_SITES</code>.
                   6584:                 They will automatically be uncompressed before
                   6585:                 patching if the names end with <code xmlns=
                   6586:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6587:                 "filename">.gz</code> or <code xmlns=
                   6588:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6589:                 "filename">.Z</code>.</p>
                   6590:               </li>
                   6591: 
                   6592:               <li>
                   6593:                 <p><code class="varname">PATCH_SITES</code>:
                   6594:                 Primary location(s) for distribution patch files
                   6595:                 (see <code class="varname">PATCHFILES</code> below)
                   6596:                 if not found locally.</p>
1.25      rillig   6597:               </li>
                   6598:             </ul>
                   6599:           </div>
                   6600: 
1.45      wiz      6601:           <p>The third section contains the following
1.27      rillig   6602:           variables.</p>
1.25      rillig   6603: 
1.27      rillig   6604:           <div class="itemizedlist">
                   6605:             <ul type="disc">
                   6606:               <li>
                   6607:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   6608:                 email address of the person who feels responsible
                   6609:                 for this package, and who is most likely to look at
                   6610:                 problems or questions regarding this package which
                   6611:                 have been reported with <a href=
1.45      wiz      6612:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6613:                 <span class="citerefentry"><span class=
1.50      rillig   6614:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   6615:                 developers should contact the <code class=
                   6616:                 "varname">MAINTAINER</code> before making major
                   6617:                 changes to the package. When packaging a new
                   6618:                 program, set <code class=
                   6619:                 "varname">MAINTAINER</code> to yourself. If you
                   6620:                 really can't maintain the package for future
                   6621:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6622:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6623:               </li>
1.25      rillig   6624: 
1.27      rillig   6625:               <li>
                   6626:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6627:                 where users can find more information about the
1.23      wiz      6628:                 package.</p>
                   6629:               </li>
1.1       grant    6630: 
1.23      wiz      6631:               <li>
                   6632:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6633:                 one-line description of the package (should not
                   6634:                 include the package name).</p>
1.23      wiz      6635:               </li>
                   6636:             </ul>
                   6637:           </div>
1.1       grant    6638: 
1.45      wiz      6639:           <p>Other variables that affect the build:</p>
1.1       grant    6640: 
1.45      wiz      6641:           <div class="itemizedlist">
                   6642:             <ul type="disc">
                   6643:               <li>
                   6644:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   6645:                 directory where the interesting distribution files
                   6646:                 of the package are found. The default is
                   6647:                 <code xmlns=
                   6648:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6649:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   6650:                 works for most packages.</p>
                   6651: 
                   6652:                 <p>If a package doesn't create a subdirectory for
                   6653:                 itself (most GNU software does, for instance), but
                   6654:                 extracts itself in the current directory, you
                   6655:                 should set <code class="varname">WRKSRC=
                   6656:                 ${WRKDIR}</code>.</p>
                   6657: 
                   6658:                 <p>If a package doesn't create a subdirectory with
                   6659:                 the name of <code class="varname">DISTNAME</code>
                   6660:                 but some different name, set <code class=
                   6661:                 "varname">WRKSRC</code> to point to the proper name
                   6662:                 in <code xmlns=
                   6663:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6664:                 "filename">${WRKDIR}</code>, for example
                   6665:                 <code class="varname">WRKSRC=
                   6666:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   6667:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6668:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   6669:                 target="_top"><code xmlns="" class=
                   6670:                 "filename">lang/tcl</code></a> and <a xmlns=
                   6671:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6672:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   6673:                 target="_top"><code xmlns="" class=
                   6674:                 "filename">x11/tk</code></a> for other
                   6675:                 examples.</p>
                   6676: 
                   6677:                 <p>The name of the working directory created by
                   6678:                 pkgsrc is taken from the <code class=
                   6679:                 "varname">WRKDIR_BASENAME</code> variable. By
                   6680:                 default, its value is <code xmlns=
                   6681:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6682:                 "filename">work</code>. If you want to use the same
                   6683:                 pkgsrc tree for building different kinds of binary
                   6684:                 packages, you can change the variable according to
                   6685:                 your needs. Two other variables handle common cases
                   6686:                 of setting <code class=
                   6687:                 "varname">WRKDIR_BASENAME</code> individually. If
                   6688:                 <code class="varname">OBJHOSTNAME</code> is defined
                   6689:                 in <code xmlns=
1.45      wiz      6690:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6691:                 "filename">/etc/mk.conf</code>, the first component
                   6692:                 of the host's name is attached to the directory
                   6693:                 name. If <code class="varname">OBJMACHINE</code> is
                   6694:                 defined, the platform name is attached, which might
                   6695:                 look like <code xmlns=
                   6696:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6697:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6698:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6699:                 "filename">work.sparc</code>.</p>
1.45      wiz      6700:               </li>
                   6701:             </ul>
1.1       grant    6702:           </div>
                   6703: 
                   6704:           <p>Please pay attention to the following gotchas:</p>
                   6705: 
                   6706:           <div class="itemizedlist">
                   6707:             <ul type="disc">
                   6708:               <li>
1.14      xtraeme  6709:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6710:                 if man pages are installed in compressed form by
                   6711:                 the package; see comment in <code xmlns=
1.45      wiz      6712:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6713:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6714:               </li>
                   6715: 
                   6716:               <li>
1.45      wiz      6717:                 <p>Replace <code xmlns=
                   6718:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6719:                 "filename">/usr/local</code> with
                   6720:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6721:                 in all files (see patches, below).</p>
1.1       grant    6722:               </li>
                   6723: 
                   6724:               <li>
                   6725:                 <p>If the package installs any info files, see
                   6726:                 <a href="#faq.info-files" title=
1.45      wiz      6727:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6728:                 &#8220;Packages installing info
1.1       grant    6729:                 files&#8221;</a>.</p>
                   6730:               </li>
                   6731:             </ul>
                   6732:           </div>
                   6733:         </div>
                   6734: 
1.57      minskim  6735:         <div class="sect1" lang="en">
1.1       grant    6736:           <div class="titlepage">
                   6737:             <div>
                   6738:               <div>
                   6739:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6740:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6741:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6742:                 "filename">distinfo</code></h2>
1.1       grant    6743:               </div>
                   6744:             </div>
                   6745:           </div>
                   6746: 
1.50      rillig   6747:           <p>The <code xmlns=
                   6748:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6749:           "filename">distinfo</code> file contains the message
                   6750:           digest, or checksum, of each distfile needed for the
                   6751:           package. This ensures that the distfiles retrieved from
                   6752:           the Internet have not been corrupted during transfer or
                   6753:           altered by a malign force to introduce a security hole.
                   6754:           Due to recent rumor about weaknesses of digest
                   6755:           algorithms, all distfiles are protected using both SHA1
                   6756:           and RMD160 message digests, as well as the file size.</p>
                   6757: 
                   6758:           <p>The <code xmlns=
                   6759:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6760:           "filename">distinfo</code> file also contains the
                   6761:           checksums for all the patches found in the <code xmlns=
                   6762:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6763:           "filename">patches</code> directory (see <a href=
                   6764:           "#components.patches" title=
                   6765:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   6766:           &#8220;patches/*&#8221;</a>).</p>
                   6767: 
                   6768:           <p>To regenerate the <code xmlns=
                   6769:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6770:           "filename">distinfo</code> file, use the
1.14      xtraeme  6771:           <span><strong class="command">make
1.50      rillig   6772:           makedistinfo</strong></span> or <span><strong class=
                   6773:           "command">make mdi</strong></span> command.</p>
1.1       grant    6774: 
1.50      rillig   6775:           <p>Some packages have different sets of distfiles
                   6776:           depending on the platform, for example <a xmlns=
1.1       grant    6777:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6778:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6779:           target="_top"><code xmlns="" class=
                   6780:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   6781:           the same <code xmlns=
1.45      wiz      6782:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   6783:           "filename">distinfo</code> file and care should be taken
                   6784:           when upgrading such a package to ensure distfile
                   6785:           information is not lost.</p>
1.1       grant    6786:         </div>
                   6787: 
1.57      minskim  6788:         <div class="sect1" lang="en">
1.1       grant    6789:           <div class="titlepage">
                   6790:             <div>
                   6791:               <div>
                   6792:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6793:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6794:               </div>
                   6795:             </div>
                   6796:           </div>
                   6797: 
                   6798:           <p>This directory contains files that are used by the
                   6799:           <a href=
                   6800:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6801:           <span class="citerefentry"><span class=
                   6802:           "refentrytitle">patch</span>(1)</span></a> command to
                   6803:           modify the sources as distributed in the distribution
                   6804:           file into a form that will compile and run perfectly on
                   6805:           NetBSD. The files are applied successively in alphabetic
                   6806:           order (as returned by a shell &#8220;<span class=
                   6807:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6808:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6809:           class="filename">patch-aa</code> is applied before
                   6810:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6811:           class="filename">patch-ab</code>, etc.</p>
                   6812: 
                   6813:           <p>The <code xmlns=
                   6814:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6815:           "filename">patch-*</code> files should be in
                   6816:           <span><strong class="command">diff -bu</strong></span>
                   6817:           format, and apply without a fuzz to avoid problems. (To
                   6818:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6819:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6820:           not put changes for more than one file into a single
1.47      reed     6821:           patch file, as this will make future modifications more
1.1       grant    6822:           difficult.</p>
                   6823: 
                   6824:           <p>Similar, a file should be patched at most once, not
                   6825:           several times by several different patches. If a file
                   6826:           needs several patches, they should be combined into one
                   6827:           file.</p>
                   6828: 
                   6829:           <p>One important thing to mention is to pay attention
                   6830:           that no RCS IDs get stored in the patch files, as these
                   6831:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6832:           CVS tree. Use the <span><strong class=
                   6833:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6834:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6835:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6836:           target="_top"><code xmlns="" class=
                   6837:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6838:           these problems.</p>
1.1       grant    6839: 
                   6840:           <p>For even more automation, we recommend using
1.14      xtraeme  6841:           <span><strong class="command">mkpatches</strong></span>
                   6842:           from the same package to make a whole set of patches. You
                   6843:           just have to backup files before you edit them to
1.45      wiz      6844:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6845:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6846:           <span><strong class="command">cp -p filename
                   6847:           filename.orig</strong></span> or, easier, by using
                   6848:           <span><strong class="command">pkgvi</strong></span> again
                   6849:           from the same package. If you upgrade a package this way,
                   6850:           you can easily compare the new set of patches with the
                   6851:           previously existing one with <span><strong class=
                   6852:           "command">patchdiff</strong></span>.</p>
1.1       grant    6853: 
                   6854:           <p>When you have finished a package, remember to generate
                   6855:           the checksums for the patch files by using the
1.14      xtraeme  6856:           <span><strong class="command">make
                   6857:           makepatchsum</strong></span> command, see <a href=
                   6858:           "#components.distinfo" title=
1.38      dillo    6859:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6860:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6861:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6862: 
1.46      gdt      6863:           <p>When adding a patch that corrects a problem in the
                   6864:           distfile (rather than e.g. enforcing pkgsrc's view of
                   6865:           where man pages should go), send the patch as a bug
                   6866:           report to the maintainer. This benefits non-pkgsrc users
                   6867:           of the package, and usually enables removing the patch in
                   6868:           future version.</p>
                   6869: 
1.1       grant    6870:           <p>Patch files that are distributed by the author or
1.14      xtraeme  6871:           other maintainers can be listed in <code class=
                   6872:           "varname">$PATCHFILES</code>.</p>
1.1       grant    6873: 
                   6874:           <p>If it is desired to store any patches that should not
                   6875:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      6876:           pkgsrc tree in the <code xmlns=
                   6877:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6878:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    6879:           tree there is expected to have the same
                   6880:           &#8220;<span class="quote">category/package</span>&#8221;
                   6881:           structure as pkgsrc, and patches are expected to be
1.45      wiz      6882:           stored inside these dirs (also known as <code xmlns=
                   6883:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     6884:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   6885:           if you want to keep a private patch for <code xmlns=
1.45      wiz      6886:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6887:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      6888:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6889:           class=
1.14      xtraeme  6890:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   6891:           files in the named directory are expected to be patch
1.1       grant    6892:           files, and <span class="emphasis"><em>they are applied
                   6893:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   6894:         </div>
                   6895: 
1.57      minskim  6896:         <div class="sect1" lang="en">
1.27      rillig   6897:           <div class="titlepage">
                   6898:             <div>
                   6899:               <div>
                   6900:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6901:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   6902:                 mandatory files</h2>
                   6903:               </div>
                   6904:             </div>
                   6905:           </div>
                   6906: 
                   6907:           <div class="variablelist">
                   6908:             <dl>
1.45      wiz      6909:               <dt><span class="term"><code xmlns=
                   6910:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6911:               "filename">DESCR</code></span></dt>
                   6912: 
                   6913:               <dd>
                   6914:                 <p>A multi-line description of the piece of
                   6915:                 software. This should include any credits where
                   6916:                 they are due. Please bear in mind that others do
                   6917:                 not share your sense of humour (or spelling
                   6918:                 idiosyncrasies), and that others will read
                   6919:                 everything that you write here.</p>
                   6920:               </dd>
                   6921: 
1.45      wiz      6922:               <dt><span class="term"><code xmlns=
                   6923:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6924:               "filename">PLIST</code></span></dt>
                   6925: 
                   6926:               <dd>
                   6927:                 <p>This file governs the files that are installed
                   6928:                 on your system: all the binaries, manual pages,
                   6929:                 etc. There are other directives which may be
                   6930:                 entered in this file, to control the creation and
                   6931:                 deletion of directories, and the location of
                   6932:                 inserted files. See <a href="#plist" title=
1.38      dillo    6933:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   6934:                 <i>PLIST issues</i></a> for more information.</p>
                   6935:               </dd>
                   6936:             </dl>
                   6937:           </div>
                   6938:         </div>
                   6939: 
1.57      minskim  6940:         <div class="sect1" lang="en">
1.27      rillig   6941:           <div class="titlepage">
                   6942:             <div>
                   6943:               <div>
                   6944:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6945:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   6946:                 files</h2>
                   6947:               </div>
                   6948:             </div>
                   6949:           </div>
                   6950: 
                   6951:           <div class="variablelist">
                   6952:             <dl>
1.45      wiz      6953:               <dt><span class="term"><code xmlns=
                   6954:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6955:               "filename">INSTALL</code></span></dt>
                   6956: 
                   6957:               <dd>
                   6958:                 <p>This shell script is invoked twice by <a href=
                   6959:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6960:                 <span class="citerefentry"><span class=
                   6961:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   6962:                 time after package extraction and before files are
                   6963:                 moved in place, the second time after the files to
                   6964:                 install are moved in place. This can be used to do
                   6965:                 any custom procedures not possible with @exec
1.45      wiz      6966:                 commands in <code xmlns=
                   6967:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6968:                 "filename">PLIST</code>. See <a href=
1.27      rillig   6969:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6970:                 <span class="citerefentry"><span class=
                   6971:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   6972:                 <a href=
                   6973:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6974:                 <span class="citerefentry"><span class=
                   6975:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6976:                 more information.</p>
                   6977:               </dd>
                   6978: 
1.45      wiz      6979:               <dt><span class="term"><code xmlns=
                   6980:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6981:               "filename">DEINSTALL</code></span></dt>
                   6982: 
                   6983:               <dd>
                   6984:                 <p>This script is executed before and after any
                   6985:                 files are removed. It is this script's
                   6986:                 responsibility to clean up any additional messy
                   6987:                 details around the package's installation, since
                   6988:                 all pkg_delete knows is how to delete the files
                   6989:                 created in the original distribution. See <a href=
                   6990:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   6991:                 <span class="citerefentry"><span class=
                   6992:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   6993:                 <a href=
                   6994:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6995:                 <span class="citerefentry"><span class=
                   6996:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6997:                 more information.</p>
                   6998:               </dd>
                   6999: 
1.45      wiz      7000:               <dt><span class="term"><code xmlns=
                   7001:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7002:               "filename">MESSAGE</code></span></dt>
                   7003: 
                   7004:               <dd>
1.50      rillig   7005:                 <p>This file is displayed after installation of the
1.27      rillig   7006:                 package. Useful for things like legal notices on
                   7007:                 almost-free software and hints for updating config
                   7008:                 files after installing modules for apache, PHP etc.
                   7009:                 Please note that you can modify variables in it
                   7010:                 easily by using <code class=
                   7011:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7012:                 <code xmlns=
                   7013:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7014:                 "filename">Makefile</code>:</p>
1.27      rillig   7015:                 <pre class="programlisting">
1.51      rillig   7016:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7017: </pre>
                   7018: 
                   7019:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7020:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7021:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7022:                 "filename">MESSAGE</code>.</p>
                   7023:               </dd>
                   7024:             </dl>
                   7025:           </div>
                   7026:         </div>
                   7027: 
1.57      minskim  7028:         <div class="sect1" lang="en">
1.27      rillig   7029:           <div class="titlepage">
                   7030:             <div>
                   7031:               <div>
                   7032:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  7033:                 "work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7034:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7035:                 "filename">work*</code></h2>
                   7036:               </div>
                   7037:             </div>
                   7038:           </div>
                   7039: 
                   7040:           <p>When you type <span><strong class=
1.47      reed     7041:           "command">make</strong></span>, the distribution files
                   7042:           are unpacked into the directory denoted by <code class=
1.45      wiz      7043:           "varname">WRKDIR</code>. It can be removed by running
                   7044:           <span><strong class="command">make clean</strong></span>.
                   7045:           Besides the sources, this directory is also used to keep
                   7046:           various timestamp files. The directory gets <span class=
                   7047:           "emphasis"><em>removed completely</em></span> on clean.
                   7048:           The default is <code xmlns=
                   7049:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7050:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7051:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7052:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7053:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7054:         </div>
                   7055: 
1.57      minskim  7056:         <div class="sect1" lang="en">
1.27      rillig   7057:           <div class="titlepage">
                   7058:             <div>
                   7059:               <div>
                   7060:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7061:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7062:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7063:                 "filename">files/*</code></h2>
                   7064:               </div>
                   7065:             </div>
                   7066:           </div>
                   7067: 
                   7068:           <p>If you have any files that you wish to be placed in
                   7069:           the package prior to configuration or building, you could
                   7070:           place these files here and use a &#8220;<span class=
                   7071:           "quote">${CP}</span>&#8221; command in the
                   7072:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7073:           target to achieve this. Alternatively, you could simply
1.45      wiz      7074:           diff the file against <code xmlns=
                   7075:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7076:           "filename">/dev/null</code> and use the patch mechanism
                   7077:           to manage the creation of this file.</p>
                   7078:         </div>
                   7079:       </div>
                   7080: 
1.57      minskim  7081:       <div class="chapter" lang="en">
1.27      rillig   7082:         <div class="titlepage">
                   7083:           <div>
                   7084:             <div>
1.57      minskim  7085:               <h2 class="title"><a name=
1.38      dillo    7086:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7087:               <code xmlns=
                   7088:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7089:               "filename">Makefile</code>s</h2>
1.27      rillig   7090:             </div>
                   7091:           </div>
                   7092:         </div>
                   7093: 
                   7094:         <div class="toc">
                   7095:           <p><b>Table of Contents</b></p>
                   7096: 
                   7097:           <dl>
                   7098:             <dt><span class="sect1"><a href=
1.45      wiz      7099:             "#makefile.variables">9.1. <code xmlns=
                   7100:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7101:             "filename">Makefile</code> variables</a></span></dt>
                   7102: 
                   7103:             <dd>
                   7104:               <dl>
                   7105:                 <dt><span class="sect2"><a href=
1.38      dillo    7106:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7107:                 conventions</a></span></dt>
                   7108:               </dl>
                   7109:             </dd>
                   7110: 
1.38      dillo    7111:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7112:             Code snippets</a></span></dt>
                   7113: 
                   7114:             <dd>
                   7115:               <dl>
1.30      wiz      7116:                 <dt><span class="sect2"><a href=
1.38      dillo    7117:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7118:                 list</a></span></dt>
1.27      rillig   7119: 
1.30      wiz      7120:                 <dt><span class="sect2"><a href=
1.38      dillo    7121:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7122:                 Converting an internal list into an external
                   7123:                 list</a></span></dt>
                   7124: 
1.30      wiz      7125:                 <dt><span class="sect2"><a href=
1.38      dillo    7126:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7127:                 variables to a shell command</a></span></dt>
1.27      rillig   7128: 
1.30      wiz      7129:                 <dt><span class="sect2"><a href=
1.38      dillo    7130:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7131:                 guideline</a></span></dt>
1.27      rillig   7132: 
1.30      wiz      7133:                 <dt><span class="sect2"><a href=
1.38      dillo    7134:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7135:                 bug in BSD Make</a></span></dt>
1.27      rillig   7136:               </dl>
                   7137:             </dd>
                   7138:           </dl>
                   7139:         </div>
                   7140: 
1.45      wiz      7141:         <p>Pkgsrc consists of many <code xmlns=
                   7142:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7143:         "filename">Makefile</code> fragments, each of which forms a
                   7144:         well-defined part of the pkgsrc system. Using the <a href=
                   7145:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7146:         <span class="citerefentry"><span class=
                   7147:         "refentrytitle">make</span>(1)</span></a> system as a
                   7148:         programming language for a big system like pkgsrc requires
                   7149:         some discipline to keep the code correct and
                   7150:         understandable.</p>
                   7151: 
1.45      wiz      7152:         <p>The basic ingredients for <code xmlns=
                   7153:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7154:         "filename">Makefile</code> programming are variables (which
                   7155:         are actually macros) and shell commands. Among these shell
                   7156:         commands may even be more complex ones like <a href=
                   7157:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7158:         <span class="citerefentry"><span class=
                   7159:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7160:         sure that every shell command runs as intended it is
                   7161:         necessary to quote all variables correctly when they are
                   7162:         used.</p>
                   7163: 
                   7164:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7165:         often in <code xmlns=
                   7166:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7167:         "filename">Makefile</code>s, including the pitfalls that
                   7168:         come along with them.</p>
1.27      rillig   7169: 
1.57      minskim  7170:         <div class="sect1" lang="en">
1.27      rillig   7171:           <div class="titlepage">
                   7172:             <div>
                   7173:               <div>
                   7174:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7175:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7176:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7177:                 "filename">Makefile</code> variables</h2>
                   7178:               </div>
                   7179:             </div>
                   7180:           </div>
                   7181: 
1.45      wiz      7182:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7183:           class="filename">Makefile</code> variables contain
                   7184:           strings that can be processed using the five operators
                   7185:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7186:           described in the <a href=
1.27      rillig   7187:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7188:           <span class="citerefentry"><span class=
                   7189:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7190: 
1.45      wiz      7191:           <p>When a variable's value is parsed from a <code xmlns=
                   7192:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7193:           "filename">Makefile</code>, the hash character ``#'' and
                   7194:           the backslash character ``\'' are handled specially. If a
                   7195:           backslash is followed by a newline, any whitespace
                   7196:           immediately in front of the backslash, the backslash, the
                   7197:           newline, and any whitespace immediately behind the
                   7198:           newline are replaced with a single space. A backspace
                   7199:           character and an immediately following hash character are
1.47      reed     7200:           replaced with a single hash character. Otherwise, the
1.27      rillig   7201:           backslash is passed as is. In a variable assignment, any
                   7202:           hash character that is not preceded by a backslash starts
                   7203:           a comment that continues upto the end of the logical
                   7204:           line.</p>
                   7205: 
                   7206:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7207:           of this parsing algorithm the only way to create a
                   7208:           variable consisting of a single backslash is using the
                   7209:           ``!='' operator, for example: <code class=
                   7210:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7211: 
                   7212:           <p>So far for defining variables. The other thing you can
                   7213:           do with variables is evaluating them. A variable is
                   7214:           evaluated when it is part of the right side of the ``:=''
                   7215:           or the ``!='' operator, or directly before executing a
                   7216:           shell command which the variable is part of. In all other
1.47      reed     7217:           cases, <a href=
1.27      rillig   7218:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7219:           <span class="citerefentry"><span class=
                   7220:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7221:           evaluation, that is, variables are not evaluated until
                   7222:           there's no other way. The ``modifiers'' mentioned in the
                   7223:           man page also evaluate the variable.</p>
                   7224: 
                   7225:           <p>Some of the modifiers split the string into words and
                   7226:           then operate on the words, others operate on the string
1.47      reed     7227:           as a whole. When a string is split into words, it is
                   7228:           split as you would expect it from <a href=
1.27      rillig   7229:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7230:           <span class="citerefentry"><span class=
                   7231:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7232: 
                   7233:           <p>No rule without exception&#8212;the
                   7234:           <span><strong class="command">.for</strong></span> loop
                   7235:           does not follow the shell quoting rules but splits at
                   7236:           sequences of whitespace.</p>
                   7237: 
                   7238:           <p>There are several types of variables that should be
                   7239:           handled differently. Strings and two types of lists.</p>
                   7240: 
                   7241:           <div class="itemizedlist">
                   7242:             <ul type="disc">
                   7243:               <li>
                   7244:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7245:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7246:                 should restrict yourself to only using printable
                   7247:                 characters. Examples are <code class=
                   7248:                 "varname">PREFIX</code> and <code class=
                   7249:                 "varname">COMMENT</code>.</p>
                   7250:               </li>
                   7251: 
                   7252:               <li>
                   7253:                 <p><span class="emphasis"><em>Internal
                   7254:                 lists</em></span> are lists that are never exported
                   7255:                 to any shell command. Their elements are separated
1.47      reed     7256:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7257:                 cannot have embedded whitespace. Any other
                   7258:                 characters are allowed. Internal lists can be used
                   7259:                 in <span><strong class=
                   7260:                 "command">.for</strong></span> loops. Examples are
                   7261:                 <code class="varname">DEPENDS</code> and
                   7262:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7263:               </li>
                   7264: 
                   7265:               <li>
                   7266:                 <p><span class="emphasis"><em>External
                   7267:                 lists</em></span> are lists that may be exported to
                   7268:                 a shell command. Their elements can contain any
                   7269:                 characters, including whitespace. That's why they
                   7270:                 cannot be used in <span><strong class=
                   7271:                 "command">.for</strong></span> loops. Examples are
                   7272:                 <code class="varname">DISTFILES</code> and
                   7273:                 <code class="varname">MASTER_SITES</code>.</p>
                   7274:               </li>
                   7275:             </ul>
                   7276:           </div>
                   7277: 
1.57      minskim  7278:           <div class="sect2" lang="en">
1.27      rillig   7279:             <div class="titlepage">
                   7280:               <div>
                   7281:                 <div>
                   7282:                   <h3 class="title"><a name=
1.38      dillo    7283:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7284:                   conventions</h3>
                   7285:                 </div>
                   7286:               </div>
                   7287:             </div>
                   7288: 
                   7289:             <div class="itemizedlist">
                   7290:               <ul type="disc">
                   7291:                 <li>
                   7292:                   <p>All variable names starting with an underscore
                   7293:                   are reserved for use by the pkgsrc
                   7294:                   infrastructure. They shall not be used by package
1.45      wiz      7295:                   <code xmlns=
                   7296:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7297:                   "filename">Makefile</code>s.</p>
1.27      rillig   7298:                 </li>
                   7299: 
                   7300:                 <li>
                   7301:                   <p>In <span><strong class=
                   7302:                   "command">.for</strong></span> loops you should
                   7303:                   use lowercase variable names for the iteration
                   7304:                   variables.</p>
                   7305:                 </li>
                   7306: 
                   7307:                 <li>
                   7308:                   <p>All list variables should have a ``plural''
                   7309:                   name, e.g. <code class=
                   7310:                   "varname">PKG_OPTIONS</code> or <code class=
                   7311:                   "varname">DISTFILES</code>.</p>
                   7312:                 </li>
                   7313:               </ul>
                   7314:             </div>
                   7315:           </div>
                   7316:         </div>
                   7317: 
1.57      minskim  7318:         <div class="sect1" lang="en">
1.27      rillig   7319:           <div class="titlepage">
                   7320:             <div>
                   7321:               <div>
                   7322:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7323:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7324:               </div>
                   7325:             </div>
                   7326:           </div>
                   7327: 
                   7328:           <p>This section presents you with some code snippets you
                   7329:           should use in your own code. If you don't find anything
                   7330:           appropriate here, you should test your code and add it
                   7331:           here.</p>
                   7332: 
1.57      minskim  7333:           <div class="sect2" lang="en">
1.27      rillig   7334:             <div class="titlepage">
                   7335:               <div>
                   7336:                 <div>
1.57      minskim  7337:                   <h3 class="title"><a name=
1.38      dillo    7338:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7339:                   a list</h3>
1.27      rillig   7340:                 </div>
                   7341:               </div>
                   7342:             </div>
                   7343:             <pre class="programlisting">
1.51      rillig   7344:     STRING=                 foo * bar `date`
                   7345:     INT_LIST=               # empty
                   7346:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7347:     EXT_LIST=               # empty
                   7348:     ANOTHER_EXT_LIST=       a=b c=d
                   7349: 
                   7350:     INT_LIST+=              ${STRING}               # 1
                   7351:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7352:     EXT_LIST+=              ${STRING:Q}             # 3
                   7353:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7354: </pre>
                   7355: 
                   7356:             <p>When you add a string to an external list (example
                   7357:             3), it must be quoted. In all other cases, you must not
                   7358:             add a quoting level. You must not merge internal and
                   7359:             external lists, unless you are sure that all entries
                   7360:             are correctly interpreted in both lists.</p>
                   7361:           </div>
                   7362: 
1.57      minskim  7363:           <div class="sect2" lang="en">
1.27      rillig   7364:             <div class="titlepage">
                   7365:               <div>
                   7366:                 <div>
1.30      wiz      7367:                   <h3 class="title"><a name=
1.38      dillo    7368:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7369:                   an internal list into an external list</h3>
1.27      rillig   7370:                 </div>
                   7371:               </div>
                   7372:             </div>
                   7373:             <pre class="programlisting">
1.51      rillig   7374:     EXT_LIST=       # empty
                   7375:     .for i in ${INT_LIST}
                   7376:     EXT_LIST+=      ${i:Q}""
                   7377:     .endfor
1.27      rillig   7378: </pre>
                   7379: 
                   7380:             <p>This code converts the internal list <code class=
                   7381:             "varname">INT_LIST</code> into the external list
                   7382:             <code class="varname">EXT_LIST</code>. As the elements
                   7383:             of an internal list are unquoted they must be quoted
                   7384:             here. The reason for appending <code class=
                   7385:             "varname">""</code> is explained below.</p>
                   7386:           </div>
1.1       grant    7387: 
1.57      minskim  7388:           <div class="sect2" lang="en">
1.27      rillig   7389:             <div class="titlepage">
1.1       grant    7390:               <div>
1.27      rillig   7391:                 <div>
1.30      wiz      7392:                   <h3 class="title"><a name=
1.38      dillo    7393:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7394:                   variables to a shell command</h3>
1.27      rillig   7395:                 </div>
1.1       grant    7396:               </div>
                   7397:             </div>
1.27      rillig   7398:             <pre class="programlisting">
1.51      rillig   7399:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7400:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7401: 
1.51      rillig   7402:     all:
                   7403:             echo ${STRING}                  # 1
                   7404:             echo "${STRING}"                # 2
                   7405:             echo "${STRING:Q}"              # 3
                   7406:             echo ${STRING:Q}                # 4
                   7407:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7408:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7409: </pre>
                   7410: 
                   7411:             <p>Example 1 leads to a syntax error in the shell, as
                   7412:             the characters are just copied.</p>
                   7413: 
                   7414:             <p>Example 2 leads to a syntax error too, and if you
                   7415:             leave out the last " character from <code class=
                   7416:             "varname">${STRING}</code>, <a href=
                   7417:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7418:             <span class="citerefentry"><span class=
                   7419:             "refentrytitle">date</span>(1)</span></a> will be
                   7420:             executed. The <code class="varname">$HOME</code> shell
                   7421:             variable would be evaluated, too.</p>
                   7422: 
                   7423:             <p>Example 3 outputs each space character preceded by a
                   7424:             backslash (or not), depending on the implementation of
                   7425:             the <a href=
                   7426:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7427:             <span class="citerefentry"><span class=
                   7428:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7429: 
1.27      rillig   7430:             <p>Example 4 handles correctly every string that does
                   7431:             not start with a dash. In that case, the result depends
                   7432:             on the implementation of the <a href=
                   7433:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7434:             <span class="citerefentry"><span class=
                   7435:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7436:             long as you can guarantee that your input does not
1.47      reed     7437:             start with a dash, this form is appropriate.</p>
1.1       grant    7438: 
1.27      rillig   7439:             <p>Example 5 handles even the case of a leading dash
                   7440:             correctly.</p>
1.1       grant    7441: 
1.27      rillig   7442:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7443:             need to be quoted because the quoting has already been
1.27      rillig   7444:             done when adding elements to the list.</p>
1.1       grant    7445: 
1.27      rillig   7446:             <p>As internal lists shall not be passed to the shell,
                   7447:             there is no example for it.</p>
1.1       grant    7448:           </div>
                   7449: 
1.57      minskim  7450:           <div class="sect2" lang="en">
1.27      rillig   7451:             <div class="titlepage">
1.1       grant    7452:               <div>
1.27      rillig   7453:                 <div>
1.57      minskim  7454:                   <h3 class="title"><a name=
1.38      dillo    7455:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7456:                   guideline</h3>
                   7457:                 </div>
1.1       grant    7458:               </div>
                   7459:             </div>
                   7460: 
1.27      rillig   7461:             <p>There are many possible sources of wrongly quoted
                   7462:             variables. This section lists some of the commonly
                   7463:             known ones.</p>
1.1       grant    7464: 
1.27      rillig   7465:             <div class="itemizedlist">
                   7466:               <ul type="disc">
                   7467:                 <li>
                   7468:                   <p>Whenever you use the value of a list, think
                   7469:                   about what happens to leading or trailing
                   7470:                   whitespace. If the list is a well-formed shell
1.47      reed     7471:                   expression, you can apply the <code class=
1.27      rillig   7472:                   "varname">:M*</code> modifier to strip leading
                   7473:                   and trailing whitespace from each word. The
                   7474:                   <code class="varname">:M</code> operator first
                   7475:                   splits its argument according to the rules of the
                   7476:                   shell, and then creates a new list consisting of
                   7477:                   all words that match the shell glob expression
                   7478:                   <code class="varname">*</code>, that is: all. One
                   7479:                   class of situations where this is needed is when
                   7480:                   adding a variable like <code class=
                   7481:                   "varname">CPPFLAGS</code> to <code class=
                   7482:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7483:                   script invokes other configure scripts, it strips
1.27      rillig   7484:                   the leading and trailing whitespace from the
                   7485:                   variable and then passes it to the other
                   7486:                   configure scripts. But these configure scripts
                   7487:                   expect the (child) <code class=
                   7488:                   "varname">CPPFLAGS</code> variable to be the same
                   7489:                   as the parent <code class=
                   7490:                   "varname">CPPFLAGS</code>. That's why we better
                   7491:                   pass the <code class="varname">CPPFLAGS</code>
                   7492:                   value properly trimmed. And here is how we do
                   7493:                   it:</p>
                   7494:                   <pre class="programlisting">
1.51      rillig   7495:     CPPFLAGS=               # empty
                   7496:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7497:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7498: 
                   7499:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7500: 
                   7501:     all:
                   7502:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7503:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7504: </pre>
                   7505:                 </li>
1.1       grant    7506: 
1.27      rillig   7507:                 <li>
                   7508:                   <p>The example above contains one bug: The
                   7509:                   <code class="varname">${PREFIX}</code> is a
                   7510:                   properly quoted shell expression, but there is
                   7511:                   the C compiler after it, which also expects a
                   7512:                   properly quoted string (this time in C syntax).
                   7513:                   The version above is therefore only correct if
                   7514:                   <code class="varname">${PREFIX}</code> does not
                   7515:                   have embedded backslashes or double quotes. If
                   7516:                   you want to allow these, you have to add another
                   7517:                   layer of quoting to each variable that is used as
                   7518:                   a C string literal. You cannot use the
                   7519:                   <code class="varname">:Q</code> operator for it,
                   7520:                   as this operator only works for the shell.</p>
                   7521:                 </li>
1.1       grant    7522: 
1.27      rillig   7523:                 <li>
1.47      reed     7524:                   <p>Whenever a variable can be empty, the
1.27      rillig   7525:                   <code class="varname">:Q</code> operator can have
                   7526:                   surprising results. Here are two completely
                   7527:                   different cases which can be solved with the same
                   7528:                   trick.</p>
                   7529:                   <pre class="programlisting">
1.51      rillig   7530:     EMPTY=                  # empty
                   7531:     empty_test:
                   7532:             for i in a ${EMPTY:Q} c; do \
                   7533:                     echo "$$i"; \
                   7534:             done
                   7535: 
                   7536:     for_test:
                   7537:     .for i in a:\ a:\test.txt
                   7538:             echo ${i:Q}
                   7539:             echo "foo"
                   7540:     .endfor
1.1       grant    7541: </pre>
                   7542: 
1.27      rillig   7543:                   <p>The first example will only print two of the
                   7544:                   three lines we might have expected. This is
                   7545:                   because <code class="varname">${EMPTY:Q}</code>
                   7546:                   expands to the empty string, which the shell
                   7547:                   cannot see. The workaround is to write
                   7548:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7549:                   pattern can be often found as <code class=
                   7550:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7551:                   <code class="varname">${TEST} -f
                   7552:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7553: 
                   7554:                   <p>The second example will only print three lines
                   7555:                   instead of four. The first line looks like
                   7556:                   <code class="varname">a:\ echo foo</code>. This
                   7557:                   is because the backslash of the value
                   7558:                   <code class="varname">a:\</code> is interpreted
                   7559:                   as a line-continuation by <a href=
                   7560:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7561:                   <span class="citerefentry"><span class=
                   7562:                   "refentrytitle">make</span>(1)</span></a>, which
                   7563:                   makes the second line the arguments of the
                   7564:                   <a href=
                   7565:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7566:                   <span class="citerefentry"><span class=
                   7567:                   "refentrytitle">echo</span>(1)</span></a> command
                   7568:                   from the first line. To avoid this, write
                   7569:                   <code class="varname">${i:Q}""</code>.</p>
                   7570:                 </li>
                   7571:               </ul>
                   7572:             </div>
1.1       grant    7573:           </div>
                   7574: 
1.57      minskim  7575:           <div class="sect2" lang="en">
1.27      rillig   7576:             <div class="titlepage">
1.1       grant    7577:               <div>
1.27      rillig   7578:                 <div>
1.30      wiz      7579:                   <h3 class="title"><a name=
1.38      dillo    7580:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7581:                   for a bug in BSD Make</h3>
1.27      rillig   7582:                 </div>
1.1       grant    7583:               </div>
                   7584:             </div>
                   7585: 
1.27      rillig   7586:             <p>The pkgsrc bmake program does not handle the
                   7587:             following assignment correctly. In case <code class=
                   7588:             "varname">_othervar_</code> contains a ``-'' character,
                   7589:             one of the closing braces is included in <code class=
                   7590:             "varname">${VAR}</code> after this code executes.</p>
                   7591:             <pre class="programlisting">
1.51      rillig   7592:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    7593: </pre>
                   7594: 
1.27      rillig   7595:             <p>For a more complex code snippet and a workaround,
                   7596:             see the package <a xmlns=
                   7597:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7598:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7599:             target="_top"><code xmlns="" class=
                   7600:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7601:             <code class="varname">bug1</code>.</p>
1.1       grant    7602:           </div>
                   7603:         </div>
                   7604:       </div>
                   7605: 
1.57      minskim  7606:       <div class="chapter" lang="en">
1.1       grant    7607:         <div class="titlepage">
                   7608:           <div>
                   7609:             <div>
1.57      minskim  7610:               <h2 class="title"><a name=
1.38      dillo    7611:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7612:             </div>
                   7613:           </div>
                   7614:         </div>
                   7615: 
                   7616:         <div class="toc">
                   7617:           <p><b>Table of Contents</b></p>
                   7618: 
                   7619:           <dl>
1.38      dillo    7620:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7621:             ID</a></span></dt>
                   7622: 
1.30      wiz      7623:             <dt><span class="sect1"><a href=
1.38      dillo    7624:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7625:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7626:             class="filename">PLIST</code>
1.14      xtraeme  7627:             generation</a></span></dt>
1.1       grant    7628: 
1.38      dillo    7629:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7630:             Tweaking output of <span><strong class="command">make
                   7631:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7632: 
1.38      dillo    7633:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7634:             Variable substitution in PLIST</a></span></dt>
                   7635: 
1.30      wiz      7636:             <dt><span class="sect1"><a href=
1.48      dillo    7637:             "#manpage-compression">10.5. Man page
                   7638:             compression</a></span></dt>
1.1       grant    7639: 
1.38      dillo    7640:             <dt><span class="sect1"><a href=
                   7641:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7642:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7643: 
1.30      wiz      7644:             <dt><span class="sect1"><a href=
1.47      reed     7645:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7646:             differing PLISTs</a></span></dt>
1.1       grant    7647: 
1.38      dillo    7648:             <dt><span class="sect1"><a href=
                   7649:             "#faq.common-dirs">10.8. Sharing directories between
                   7650:             packages</a></span></dt>
1.1       grant    7651:           </dl>
                   7652:         </div>
                   7653: 
1.45      wiz      7654:         <p>The <code xmlns=
                   7655:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7656:         "filename">PLIST</code> file contains a package's
                   7657:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7658:         a list of files that belong to the package (relative to the
                   7659:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7660:         class="filename">${PREFIX}</code> directory it's been
                   7661:         installed in) plus some additional statements - see the
                   7662:         <a href=
1.1       grant    7663:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7664:         <span class="citerefentry"><span class=
1.47      reed     7665:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7666:         for a full list. This chapter addresses some issues that
                   7667:         need attention when dealing with the <code xmlns=
1.45      wiz      7668:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7669:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7670: 
1.57      minskim  7671:         <div class="sect1" lang="en">
1.1       grant    7672:           <div class="titlepage">
                   7673:             <div>
                   7674:               <div>
                   7675:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  7676:                 "rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7677:               </div>
                   7678:             </div>
                   7679:           </div>
                   7680: 
                   7681:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7682:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7683:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7684:           <pre class="programlisting">
1.51      rillig   7685:     @comment $NetBSD$
1.1       grant    7686: </pre>
                   7687:         </div>
                   7688: 
1.57      minskim  7689:         <div class="sect1" lang="en">
1.1       grant    7690:           <div class="titlepage">
                   7691:             <div>
                   7692:               <div>
                   7693:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7694:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7695:                 <code xmlns=
                   7696:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7697:                 "filename">PLIST</code> generation</h2>
1.1       grant    7698:               </div>
                   7699:             </div>
                   7700:           </div>
                   7701: 
1.14      xtraeme  7702:           <p>You can use the <span><strong class="command">make
                   7703:           print-PLIST</strong></span> command to output a PLIST
                   7704:           that matches any new files since the package was
                   7705:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   7706:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    7707:           &#8220;Other helpful targets&#8221;</a> for more
                   7708:           information on this target.</p>
                   7709:         </div>
                   7710: 
1.57      minskim  7711:         <div class="sect1" lang="en">
1.1       grant    7712:           <div class="titlepage">
                   7713:             <div>
                   7714:               <div>
                   7715:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7716:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7717:                 <span><strong class="command">make
                   7718:                 print-PLIST</strong></span></h2>
1.1       grant    7719:               </div>
                   7720:             </div>
                   7721:           </div>
                   7722: 
                   7723:           <p>If you have used any of the *-dirs packages, as
                   7724:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7725:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7726:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7727:           you may have noticed that <span><strong class=
                   7728:           "command">make print-PLIST</strong></span> outputs a set
                   7729:           of <code class="varname">@comment</code>s instead of real
                   7730:           <code class="varname">@dirrm</code> lines. You can also
                   7731:           do this for specific directories and files, so that the
                   7732:           results of that command are very close to reality. This
                   7733:           helps <span class="emphasis"><em>a lot</em></span> during
                   7734:           the update of packages.</p>
                   7735: 
                   7736:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7737:           variable takes a set of AWK patterns and actions that are
                   7738:           used to filter the output of print-PLIST. You can
                   7739:           <span class="emphasis"><em>append</em></span> any chunk
                   7740:           of AWK scripting you like to it, but be careful with
1.1       grant    7741:           quoting.</p>
                   7742: 
1.45      wiz      7743:           <p>For example, to get all files inside the <code xmlns=
                   7744:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7745:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7746:           resulting PLIST:</p>
                   7747:           <pre class="programlisting">
1.51      rillig   7748:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    7749: </pre>
                   7750: 
1.14      xtraeme  7751:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7752:           lines referring to a specific (shared) directory
1.14      xtraeme  7753:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7754:           <pre class="programlisting">
1.51      rillig   7755:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    7756: </pre>
                   7757:         </div>
                   7758: 
1.57      minskim  7759:         <div class="sect1" lang="en">
1.1       grant    7760:           <div class="titlepage">
                   7761:             <div>
                   7762:               <div>
                   7763:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7764:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7765:                 in PLIST</h2>
1.1       grant    7766:               </div>
                   7767:             </div>
                   7768:           </div>
                   7769: 
                   7770:           <p>A number of variables are substituted automatically in
                   7771:           PLISTs when a package is installed on a system. This
                   7772:           includes the following variables:</p>
                   7773: 
                   7774:           <div class="variablelist">
                   7775:             <dl>
1.14      xtraeme  7776:               <dt><span class="term"><code class=
                   7777:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7778:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7779: 
                   7780:               <dd>
                   7781:                 <p>Some packages like emacs and perl embed
                   7782:                 information about which architecture they were
                   7783:                 built on into the pathnames where they install
1.47      reed     7784:                 their files. To handle this case, PLIST will be
1.1       grant    7785:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7786:                 &#8220;<span class="quote"><code class=
                   7787:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7788:                 be replaced by what <span><strong class=
                   7789:                 "command">uname -p</strong></span> gives. The same
                   7790:                 is done if the string <code class=
                   7791:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7792:                 PLIST somewhere - use this on packages that have
1.47      reed     7793:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7794: 
                   7795:                 <div class="note" style=
                   7796:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7797:                   <h3 class="title">Legacy note</h3>
                   7798: 
                   7799:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7800:                   "quote"><code class=
                   7801:                   "varname">$ARCH</code></span>&#8221; that was
                   7802:                   replaced by the output of <span><strong class=
                   7803:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7804:                   longer supported and has been removed.</p>
                   7805:                 </div>
                   7806:               </dd>
                   7807: 
1.14      xtraeme  7808:               <dt><span class="term"><code class=
                   7809:               "varname">${OPSYS}</code>, <code class=
                   7810:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7811:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7812: 
                   7813:               <dd>
                   7814:                 <p>Some packages want to embed the OS name and
                   7815:                 version into some paths. To do this, use these
1.45      wiz      7816:                 variables in the <code xmlns=
                   7817:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7818:                 "filename">PLIST</code>:</p>
1.1       grant    7819: 
                   7820:                 <div class="itemizedlist">
                   7821:                   <ul type="disc">
                   7822:                     <li>
1.14      xtraeme  7823:                       <p><code class="varname">${OPSYS}</code> -
                   7824:                       output of &#8220;<span class=
                   7825:                       "quote"><span><strong class="command">uname
                   7826:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7827:                     </li>
                   7828: 
                   7829:                     <li>
1.14      xtraeme  7830:                       <p><code class=
                   7831:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7832:                       common name (eg. &#8220;<span class=
                   7833:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7834:                     </li>
                   7835: 
                   7836:                     <li>
1.14      xtraeme  7837:                       <p><code class="varname">${OS_VERSION}</code>
                   7838:                       - &#8220;<span class=
                   7839:                       "quote"><span><strong class="command">uname
                   7840:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7841:                     </li>
                   7842:                   </ul>
                   7843:                 </div>
                   7844:               </dd>
                   7845: 
1.14      xtraeme  7846:               <dt><span class="term"><code class=
                   7847:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7848: 
                   7849:               <dd>
                   7850:                 <p>Packages that install locale files should list
                   7851:                 them in the PLIST as &#8220;<span class=
                   7852:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7853:                 instead of &#8220;<span class=
                   7854:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7855:                 This properly handles the fact that different
                   7856:                 operating systems expect locale files to be either
1.45      wiz      7857:                 in <code xmlns=
                   7858:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7859:                 "filename">share</code> or <code xmlns=
                   7860:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7861:                 "filename">lib</code> by default.</p>
1.1       grant    7862:               </dd>
                   7863:             </dl>
                   7864:           </div>
                   7865: 
                   7866:           <p>For a complete list of values which are replaced by
1.45      wiz      7867:           default, please look in <code xmlns=
                   7868:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7869:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    7870:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   7871: 
                   7872:           <p>If you want to change other variables not listed
                   7873:           above, you can add variables and their expansions to this
1.14      xtraeme  7874:           variable in the following way, similar to <code class=
                   7875:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    7876:           "#components.optional" title=
1.38      dillo    7877:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    7878:           &#8220;Optional files&#8221;</a>):</p>
                   7879:           <pre class="programlisting">
1.51      rillig   7880:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    7881: </pre>
                   7882: 
                   7883:           <p>This replaces all occurrences of &#8220;<span class=
                   7884:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   7885:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   7886:         </div>
                   7887: 
1.57      minskim  7888:         <div class="sect1" lang="en">
1.1       grant    7889:           <div class="titlepage">
                   7890:             <div>
                   7891:               <div>
                   7892:                 <h2 class="title" style="clear: both"><a name=
1.48      dillo    7893:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   7894:                 compression</h2>
1.1       grant    7895:               </div>
                   7896:             </div>
                   7897:           </div>
                   7898: 
1.47      reed     7899:           <p>Man pages should be installed in compressed form if
1.45      wiz      7900:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   7901:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7902:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      7903:           otherwise. To handle this in the <code xmlns=
                   7904:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7905:           "filename">PLIST</code> file, the suffix
                   7906:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     7907:           appended/removed automatically for man pages according to
1.14      xtraeme  7908:           <code class="varname">MANZ</code> and <code class=
                   7909:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      7910:           above for details. This modification of the <code xmlns=
                   7911:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7912:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      7913:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7914:           class="filename">PLIST</code> itself.</p>
1.1       grant    7915:         </div>
                   7916: 
1.57      minskim  7917:         <div class="sect1" lang="en">
1.1       grant    7918:           <div class="titlepage">
                   7919:             <div>
                   7920:               <div>
                   7921:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7922:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      7923:                 source with <code class=
1.14      xtraeme  7924:                 "varname">PLIST_SRC</code></h2>
1.1       grant    7925:               </div>
                   7926:             </div>
                   7927:           </div>
                   7928: 
1.14      xtraeme  7929:           <p>To use one or more files as source for the
1.45      wiz      7930:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7931:           class="filename">PLIST</code> used in generating the
                   7932:           binary package, set the variable <code class=
1.14      xtraeme  7933:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      7934:           The files are later concatenated using <a href=
                   7935:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   7936:           <span class="citerefentry"><span class=
                   7937:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   7938:           things is important.</p>
1.1       grant    7939:         </div>
                   7940: 
1.57      minskim  7941:         <div class="sect1" lang="en">
1.1       grant    7942:           <div class="titlepage">
                   7943:             <div>
                   7944:               <div>
                   7945:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     7946:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   7947:                 and differing PLISTs</h2>
1.1       grant    7948:               </div>
                   7949:             </div>
                   7950:           </div>
                   7951: 
                   7952:           <p>Some packages decide to install a different set of
                   7953:           files based on the operating system being used. These
                   7954:           differences can be automatically handled by using the
                   7955:           following files:</p>
                   7956: 
                   7957:           <div class="itemizedlist">
                   7958:             <ul type="disc">
                   7959:               <li>
1.45      wiz      7960:                 <p><code xmlns=
                   7961:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7962:                 "filename">PLIST.common</code></p>
1.1       grant    7963:               </li>
                   7964: 
                   7965:               <li>
1.45      wiz      7966:                 <p><code xmlns=
                   7967:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7968:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    7969:               </li>
                   7970: 
                   7971:               <li>
1.45      wiz      7972:                 <p><code xmlns=
                   7973:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7974:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   7975:               </li>
                   7976: 
                   7977:               <li>
1.45      wiz      7978:                 <p><code xmlns=
                   7979:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7980:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   7981:               </li>
                   7982: 
                   7983:               <li>
1.45      wiz      7984:                 <p><code xmlns=
                   7985:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7986:                 "filename">PLIST.common_end</code></p>
1.1       grant    7987:               </li>
                   7988:             </ul>
                   7989:           </div>
                   7990:         </div>
                   7991: 
1.57      minskim  7992:         <div class="sect1" lang="en">
1.1       grant    7993:           <div class="titlepage">
                   7994:             <div>
                   7995:               <div>
                   7996:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7997:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   7998:                 directories between packages</h2>
1.1       grant    7999:               </div>
                   8000:             </div>
                   8001:           </div>
                   8002: 
                   8003:           <p>A &#8220;<span class="quote">shared
                   8004:           directory</span>&#8221; is a directory where multiple
                   8005:           (and unrelated) packages install files. These directories
                   8006:           are problematic because you have to add special tricks in
                   8007:           the PLIST to conditionally remove them, or have some
                   8008:           centralized package handle them.</p>
                   8009: 
                   8010:           <p>Within pkgsrc, you'll find both approaches. If a
                   8011:           directory is shared by a few unrelated packages, it's
                   8012:           often not worth to add an extra package to remove it.
                   8013:           Therefore, one simply does:</p>
                   8014:           <pre class="programlisting">
1.51      rillig   8015:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8016: </pre>
                   8017: 
                   8018:           <p>in the PLISTs of all affected packages, instead of the
                   8019:           regular "@dirrm" line.</p>
                   8020: 
                   8021:           <p>However, if the directory is shared across many
                   8022:           packages, two different solutions are available:</p>
                   8023: 
                   8024:           <div class="orderedlist">
                   8025:             <ol type="1">
                   8026:               <li>
                   8027:                 <p>If the packages have a common dependency, the
                   8028:                 directory can be removed in that. For example, see
                   8029:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8030:                 href=
                   8031:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8032:                 target="_top"><code xmlns="" class=
                   8033:                 "filename">textproc/scrollkeeper</code></a>, which
                   8034:                 removes the shared directory <code xmlns=
                   8035:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8036:                 "filename">share/omf</code>.</p>
1.1       grant    8037:               </li>
                   8038: 
                   8039:               <li>
                   8040:                 <p>If the packages using the directory are not
                   8041:                 related at all (they have no common dependencies),
                   8042:                 a *-dirs package is used.</p>
                   8043:               </li>
                   8044:             </ol>
                   8045:           </div>
                   8046: 
                   8047:           <p>From now on, we'll discuss the second solution. To get
                   8048:           an idea of the *-dirs packages available, issue:</p>
                   8049:           <pre class="programlisting">
1.51      rillig   8050:     <code class="prompt">%</code> cd .../pkgsrc
                   8051:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8052: </pre>
                   8053: 
                   8054:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8055:           <code class="varname">USE_DIRS</code> variable takes a
                   8056:           list of package names (without the &#8220;<span class=
1.1       grant    8057:           "quote">-dirs</span>&#8221; part) together with the
                   8058:           required version number (always pick the latest one when
1.34      wiz      8059:           writing new packages).</p>
1.1       grant    8060: 
                   8061:           <p>For example, if a package installs files under
1.45      wiz      8062:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8063:           class="filename">share/applications</code>, it should
                   8064:           have the following line in it:</p>
1.1       grant    8065:           <pre class="programlisting">
1.51      rillig   8066:     USE_DIRS+=      xdg-1.1
1.1       grant    8067: </pre>
                   8068: 
1.14      xtraeme  8069:           <p>After regenerating the PLIST using
                   8070:           <span><strong class="command">make
                   8071:           print-PLIST</strong></span>, you should get the right
                   8072:           (commented out) lines.</p>
1.1       grant    8073: 
1.47      reed     8074:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8075:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8076:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8077:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8078:           part and pkgsrc (in particular, <code xmlns=
                   8079:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8080:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8081:         </div>
                   8082:       </div>
                   8083: 
1.57      minskim  8084:       <div class="chapter" lang="en">
1.1       grant    8085:         <div class="titlepage">
                   8086:           <div>
                   8087:             <div>
1.57      minskim  8088:               <h2 class="title"><a name=
1.38      dillo    8089:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8090:               methodology</h2>
                   8091:             </div>
                   8092:           </div>
                   8093:         </div>
                   8094: 
                   8095:         <div class="toc">
                   8096:           <p><b>Table of Contents</b></p>
                   8097: 
                   8098:           <dl>
1.30      wiz      8099:             <dt><span class="sect1"><a href=
1.38      dillo    8100:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8101:             to use buildlink3</a></span></dt>
1.1       grant    8102: 
1.30      wiz      8103:             <dt><span class="sect1"><a href=
1.45      wiz      8104:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8105:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8106:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8107: 
                   8108:             <dd>
                   8109:               <dl>
1.25      rillig   8110:                 <dt><span class="sect2"><a href=
1.38      dillo    8111:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8112:                 buildlink3.mk file</a></span></dt>
1.1       grant    8113: 
1.25      rillig   8114:                 <dt><span class="sect2"><a href=
1.38      dillo    8115:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8116:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8117:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8118:                 <code xmlns=
                   8119:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8120:                 "filename">buildlink3.mk</code>
1.1       grant    8121:                 files</a></span></dt>
                   8122:               </dl>
                   8123:             </dd>
                   8124: 
1.30      wiz      8125:             <dt><span class="sect1"><a href=
1.45      wiz      8126:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8127:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8128:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8129: 
                   8130:             <dd>
                   8131:               <dl>
1.25      rillig   8132:                 <dt><span class="sect2"><a href=
1.38      dillo    8133:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8134:                 <code xmlns=
                   8135:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8136:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8137: 
1.25      rillig   8138:                 <dt><span class="sect2"><a href=
1.38      dillo    8139:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8140:                 preferences for native or pkgsrc
                   8141:                 software</a></span></dt>
1.1       grant    8142:               </dl>
                   8143:             </dd>
                   8144:           </dl>
                   8145:         </div>
                   8146: 
                   8147:         <p>Buildlink is a framework in pkgsrc that controls what
                   8148:         headers and libraries are seen by a package's configure and
                   8149:         build processes. This is implemented in a two step
                   8150:         process:</p>
                   8151: 
                   8152:         <div class="orderedlist">
                   8153:           <ol type="1">
                   8154:             <li>
                   8155:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8156:               into <code class="varname">BUILDLINK_DIR</code>,
                   8157:               which by default is a subdirectory of <code class=
                   8158:               "varname">WRKDIR</code>.</p>
1.1       grant    8159:             </li>
                   8160: 
                   8161:             <li>
                   8162:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8163:               the normal compiler tools that translate <code class=
                   8164:               "option">-I${LOCALBASE}/include</code> and
                   8165:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8166:               references to <code class=
                   8167:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8168:               also make native compiler on some operating systems
                   8169:               look like GCC, so that packages that expect GCC won't
                   8170:               require modifications to build with those native
                   8171:               compilers.</p>
1.1       grant    8172:             </li>
                   8173:           </ol>
                   8174:         </div>
                   8175: 
                   8176:         <p>This normalizes the environment in which a package is
                   8177:         built so that the package may be built consistently despite
                   8178:         what other software may be installed. Please note that the
1.45      wiz      8179:         normal system header and library paths, e.g. <code xmlns=
                   8180:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8181:         "filename">/usr/include</code>, <code xmlns=
                   8182:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8183:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8184:         buildlink3 is designed to insulate the package build from
                   8185:         non-system-supplied software.</p>
                   8186: 
1.57      minskim  8187:         <div class="sect1" lang="en">
1.1       grant    8188:           <div class="titlepage">
                   8189:             <div>
                   8190:               <div>
                   8191:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8192:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8193:                 packages to use buildlink3</h2>
1.1       grant    8194:               </div>
                   8195:             </div>
                   8196:           </div>
                   8197: 
                   8198:           <p>The process of converting packages to use the
                   8199:           buildlink3 framework (&#8220;<span class=
                   8200:           "quote">bl3ifying</span>&#8221;) is fairly
                   8201:           straightforward. The things to keep in mind are:</p>
                   8202: 
                   8203:           <div class="orderedlist">
                   8204:             <ol type="1">
                   8205:               <li>
                   8206:                 <p>Ensure that the build always calls the wrapper
                   8207:                 scripts instead of the actual toolchain. Some
                   8208:                 packages are tricky, and the only way to know for
1.45      wiz      8209:                 sure is the check <code xmlns=
                   8210:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8211:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8212:                 wrappers are being invoked.</p>
                   8213:               </li>
                   8214: 
                   8215:               <li>
1.14      xtraeme  8216:                 <p>Don't override <code class=
                   8217:                 "varname">PREFIX</code> from within the package
                   8218:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8219:                 because the code to symlink files into <code xmlns=
                   8220:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8221:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8222:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8223:                 <em class=
                   8224:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8225:               </li>
                   8226: 
                   8227:               <li>
                   8228:                 <p>Remember that <span class=
1.45      wiz      8229:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8230:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8231:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8232:                 in a package's Makefile are added as dependencies
                   8233:                 for that package.</p>
                   8234:               </li>
                   8235:             </ol>
                   8236:           </div>
                   8237: 
                   8238:           <p>If a dependency on a particular package is required
                   8239:           for its libraries and headers, then we replace:</p>
                   8240:           <pre class="programlisting">
1.51      rillig   8241:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8242: </pre>
                   8243: 
                   8244:           <p>with</p>
                   8245:           <pre class="programlisting">
1.51      rillig   8246:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8247: </pre>
                   8248: 
1.47      reed     8249:           <p>The buildlink3.mk files usually define the required
                   8250:           dependencies. If you need a newer version of the
                   8251:           dependency when using buildlink3.mk files, then you can
                   8252:           define it in your Makefile; for example:</p>
                   8253:           <pre class="programlisting">
1.51      rillig   8254:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8255:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8256: </pre>
                   8257: 
1.45      wiz      8258:           <p>There are several <code xmlns=
                   8259:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8260:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8261:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8262:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8263:           issues:</p>
                   8264: 
                   8265:           <div class="itemizedlist">
                   8266:             <ul type="disc">
                   8267:               <li>
1.45      wiz      8268:                 <p><code xmlns=
                   8269:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8270:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8271:                 the native or a pkgsrc Berkeley DB implementation
                   8272:                 based on the values of <code class=
1.14      xtraeme  8273:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8274:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8275:               </li>
                   8276: 
                   8277:               <li>
1.45      wiz      8278:                 <p><code xmlns=
                   8279:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8280:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8281:                 system comes with neither Curses nor NCurses, this
                   8282:                 will take care to install the <a xmlns=
                   8283:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8284:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8285:                 target="_top"><code xmlns="" class=
                   8286:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8287:               </li>
                   8288: 
                   8289:               <li>
1.45      wiz      8290:                 <p><code xmlns=
                   8291:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8292:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8293:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8294:                 choose between adding a dependency on Heimdal or
                   8295:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8296:                 implementation.</p>
                   8297:               </li>
                   8298: 
                   8299:               <li>
1.45      wiz      8300:                 <p><code xmlns=
                   8301:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8302:                 "filename">motif.buildlink3.mk</code> checks for a
                   8303:                 system-provided Motif installation or adds a
                   8304:                 dependency on <a xmlns=
1.1       grant    8305:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8306:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8307:                 target="_top"><code xmlns="" class=
                   8308:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8309:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8310:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8311:                 target="_top"><code xmlns="" class=
1.47      reed     8312:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8313:               </li>
                   8314: 
                   8315:               <li>
1.45      wiz      8316:                 <p><code xmlns=
                   8317:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8318:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8319:                 several variables that may be used by packages that
1.47      reed     8320:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8321:               </li>
                   8322: 
                   8323:               <li>
1.45      wiz      8324:                 <p><code xmlns=
                   8325:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8326:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8327:                 either Postgres 7.3 or 7.4, whichever is found
                   8328:                 installed. See the file for more information.</p>
1.1       grant    8329:               </li>
                   8330: 
                   8331:               <li>
1.45      wiz      8332:                 <p><code xmlns=
                   8333:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8334:                 "filename">pthread.buildlink3.mk</code> uses the
                   8335:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8336:                 and checks for native pthreads or adds a dependency
                   8337:                 on <a xmlns=
1.1       grant    8338:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8339:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8340:                 target="_top"><code xmlns="" class=
1.47      reed     8341:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8342:               </li>
                   8343: 
                   8344:               <li>
1.45      wiz      8345:                 <p><code xmlns=
                   8346:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8347:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8348:                 of <code class="varname">XAW_TYPE</code> to choose
                   8349:                 a particular Athena widgets library.</p>
1.1       grant    8350:               </li>
                   8351:             </ul>
                   8352:           </div>
                   8353: 
1.45      wiz      8354:           <p>The comments in those <code xmlns=
                   8355:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8356:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8357:           complete description of how to use them properly.</p>
                   8358:         </div>
                   8359: 
1.57      minskim  8360:         <div class="sect1" lang="en">
1.1       grant    8361:           <div class="titlepage">
                   8362:             <div>
                   8363:               <div>
                   8364:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8365:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8366:                 <code xmlns=
                   8367:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8368:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8369:               </div>
                   8370:             </div>
                   8371:           </div>
                   8372: 
1.45      wiz      8373:           <p>A package's <code xmlns=
                   8374:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8375:           "filename">buildlink3.mk</code> file is included by
                   8376:           Makefiles to indicate the need to compile and link
                   8377:           against header files and libraries provided by the
1.45      wiz      8378:           package. A <code xmlns=
                   8379:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8380:           "filename">buildlink3.mk</code> file should always
                   8381:           provide enough information to add the correct type of
                   8382:           dependency relationship and include any other
                   8383:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8384:           class="filename">buildlink3.mk</code> files that it needs
                   8385:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8386: 
1.45      wiz      8387:           <p>To generate an initial <code xmlns=
                   8388:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8389:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8390:           Rene Hexel's <a xmlns=
                   8391:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8392:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8393:           target="_top"><code xmlns="" class=
                   8394:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8395:           highly recommended. For most packages, the following
                   8396:           command will generate a good starting point for
1.45      wiz      8397:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8398:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8399:           <pre class="screen">
1.14      xtraeme  8400: <code class="prompt">%</code> <strong class=
                   8401: "userinput"><code>cd pkgsrc/<em class=
                   8402: "replaceable"><code>category</code></em>/<em class=
                   8403: "replaceable"><code>pkgdir</code></em>
                   8404: <code class=
1.49      rillig   8405: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8406: </pre>
                   8407: 
1.57      minskim  8408:           <div class="sect2" lang="en">
1.1       grant    8409:             <div class="titlepage">
                   8410:               <div>
                   8411:                 <div>
1.57      minskim  8412:                   <h3 class="title"><a name=
                   8413:                   "anatomy-of-bl3"></a>11.2.1.&nbsp;Anatomy of a
1.25      rillig   8414:                   buildlink3.mk file</h3>
1.1       grant    8415:                 </div>
                   8416:               </div>
                   8417:             </div>
                   8418: 
1.45      wiz      8419:             <p>The following real-life example <code xmlns=
                   8420:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8421:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8422:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8423:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8424:             <pre class="programlisting">
1.51      rillig   8425:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8426: 
1.51      rillig   8427:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8428:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8429: 
1.51      rillig   8430:     .if !empty(BUILDLINK_DEPTH:M+)
                   8431:     BUILDLINK_DEPENDS+=     tiff
                   8432:     .endif
1.1       grant    8433: 
1.51      rillig   8434:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8435:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8436: 
1.51      rillig   8437:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8438:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8439:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8440:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8441: 
1.51      rillig   8442:     .include "../../devel/zlib/buildlink3.mk"
                   8443:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8444: 
1.51      rillig   8445:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8446: </pre>
                   8447: 
1.14      xtraeme  8448:             <p>The header and footer manipulate <code class=
                   8449:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8450:             across all <code xmlns=
                   8451:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8452:             "filename">buildlink3.mk</code> files and is used to
                   8453:             track at what depth we are including <code xmlns=
                   8454:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8455:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8456: 
                   8457:             <p>The first section controls if the dependency on
1.14      xtraeme  8458:             <em class="replaceable"><code>pkg</code></em> is added.
                   8459:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8460:             global list of packages for which dependencies are
                   8461:             added by buildlink3.</p>
                   8462: 
                   8463:             <p>The second section advises pkgsrc that the
1.45      wiz      8464:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8465:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8466:             <em class="replaceable"><code>pkg</code></em> has been
                   8467:             included at some point. <code class=
                   8468:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8469:             of packages for which <code xmlns=
                   8470:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8471:             "filename">buildlink3.mk</code> files have been
                   8472:             included. It must <span class=
                   8473:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8474:             a <code xmlns=
                   8475:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8476:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8477: 
                   8478:             <p>The third section is protected from multiple
1.14      xtraeme  8479:             inclusion and controls how the dependency on <em class=
                   8480:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8481:             important variables are set in the section:</p>
                   8482: 
                   8483:             <div class="itemizedlist">
                   8484:               <ul type="disc">
                   8485:                 <li>
1.14      xtraeme  8486:                   <p><code class=
                   8487:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8488:                   "replaceable"><code>pkg</code></em></code> is the
                   8489:                   actual dependency recorded in the installed
                   8490:                   package; this should always be set using
                   8491:                   <span><strong class="command">+=</strong></span>
                   8492:                   to ensure that we're appending to any
                   8493:                   pre-existing list of values. This variable should
                   8494:                   be set to the first version of the package that
                   8495:                   had the last change in the major number of a
                   8496:                   shared library or that had a major API
                   8497:                   change.</p>
1.1       grant    8498:                 </li>
                   8499: 
                   8500:                 <li>
1.14      xtraeme  8501:                   <p><code class=
                   8502:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8503:                   "replaceable"><code>pkg</code></em></code> is the
                   8504:                   location of the <em class=
                   8505:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8506:                   directory.</p>
1.1       grant    8507:                 </li>
                   8508: 
                   8509:                 <li>
1.14      xtraeme  8510:                   <p><code class=
                   8511:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8512:                   "replaceable"><code>pkg</code></em></code> (not
                   8513:                   shown above) controls whether we use <code class=
                   8514:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8515:                   "varname">DEPENDS</code> to add the dependency on
                   8516:                   <em class="replaceable"><code>pkg</code></em>.
                   8517:                   The build dependency is selected by setting
                   8518:                   <code class=
                   8519:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8520:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8521:                   &#8220;<span class="quote">build</span>&#8221;.
                   8522:                   By default, the full dependency is used.</p>
                   8523:                 </li>
                   8524: 
                   8525:                 <li>
1.14      xtraeme  8526:                   <p><code class=
                   8527:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8528:                   "replaceable"><code>pkg</code></em></code> and
                   8529:                   <code class=
1.57      minskim  8530:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   8531:                   (not shown above) are lists of subdirectories of
                   8532:                   <code xmlns=
1.45      wiz      8533:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8534:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8535:                   "replaceable"><code>pkg</code></em>}</code> to
                   8536:                   add to the header and library search paths. These
1.1       grant    8537:                   default to &#8220;<span class=
                   8538:                   "quote">include</span>&#8221; and
                   8539:                   &#8220;<span class="quote">lib</span>&#8221;
                   8540:                   respectively.</p>
                   8541:                 </li>
                   8542: 
                   8543:                 <li>
1.14      xtraeme  8544:                   <p><code class=
                   8545:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8546:                   "replaceable"><code>pkg</code></em></code> (not
                   8547:                   shown above) is the list of preprocessor flags to
                   8548:                   add to <code class="varname">CPPFLAGS</code>,
                   8549:                   which are passed on to the configure and build
                   8550:                   phases. The &#8220;<span class=
                   8551:                   "quote">-I</span>&#8221; option should be avoided
                   8552:                   and instead be handled using <code class=
                   8553:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8554:                   "replaceable"><code>pkg</code></em></code> as
                   8555:                   above.</p>
1.1       grant    8556:                 </li>
                   8557:               </ul>
                   8558:             </div>
                   8559: 
                   8560:             <p>The following variables are all optionally defined
                   8561:             within this second section (protected against multiple
                   8562:             inclusion) and control which package files are
1.45      wiz      8563:             symlinked into <code xmlns=
                   8564:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8565:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8566:             are transformed during the symlinking:</p>
                   8567: 
                   8568:             <div class="itemizedlist">
                   8569:               <ul type="disc">
                   8570:                 <li>
1.14      xtraeme  8571:                   <p><code class=
                   8572:                   "varname">BUILDLINK_FILES.<em class=
                   8573:                   "replaceable"><code>pkg</code></em></code> (not
                   8574:                   shown above) is a shell glob pattern relative to
1.45      wiz      8575:                   <code xmlns=
                   8576:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8577:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8578:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8579:                   symlinked into <code xmlns=
                   8580:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8581:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8582:                   <code xmlns=
                   8583:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8584:                   "filename">include/*.h</code>.</p>
1.1       grant    8585:                 </li>
                   8586: 
                   8587:                 <li>
1.14      xtraeme  8588:                   <p><code class=
                   8589:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8590:                   "replaceable"><code>pkg</code></em></code> (not
                   8591:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8592:                   stdout a list of files relative to <code xmlns=
                   8593:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8594:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8595:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8596:                   resulting files are to be symlinked into
1.45      wiz      8597:                   <code xmlns=
                   8598:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8599:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8600:                   this takes the <code xmlns=
                   8601:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8602:                   "filename">+CONTENTS</code> of a <em class=
                   8603:                   "replaceable"><code>pkg</code></em> and filters
                   8604:                   it through <code class=
                   8605:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8606:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8607:                 </li>
                   8608: 
                   8609:                 <li>
1.14      xtraeme  8610:                   <p><code class=
                   8611:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8612:                   "replaceable"><code>pkg</code></em></code> (not
                   8613:                   shown above) is a filter command that filters
1.45      wiz      8614:                   <code xmlns=
                   8615:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8616:                   "filename">+CONTENTS</code> input into a list of
                   8617:                   files relative to <code xmlns=
                   8618:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8619:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8620:                   "replaceable"><code>pkg</code></em>}</code> on
                   8621:                   stdout. By default for overwrite packages,
                   8622:                   <code class=
                   8623:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8624:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8625:                   outputs the contents of the <code xmlns=
                   8626:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8627:                   "filename">include</code> and <code xmlns=
                   8628:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8629:                   "filename">lib</code> directories in the package
1.45      wiz      8630:                   <code xmlns=
                   8631:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8632:                   "filename">+CONTENTS</code>, and for pkgviews
                   8633:                   packages, it outputs any libtool archives in
                   8634:                   <code xmlns=
                   8635:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8636:                   "filename">lib</code> directories.</p>
1.1       grant    8637:                 </li>
                   8638: 
                   8639:                 <li>
1.14      xtraeme  8640:                   <p><code class=
                   8641:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8642:                   "replaceable"><code>pkg</code></em></code> (not
                   8643:                   shown above) is a list of sed arguments used to
1.1       grant    8644:                   transform the name of the source filename into a
1.14      xtraeme  8645:                   destination filename, e.g. <span><strong class=
1.1       grant    8646:                   "command">-e
1.14      xtraeme  8647:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8648:                 </li>
                   8649:               </ul>
                   8650:             </div>
                   8651: 
1.45      wiz      8652:             <p>The last section includes any <code xmlns=
                   8653:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8654:             "filename">buildlink3.mk</code> needed for <em class=
                   8655:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8656:             dependencies. Including these <code xmlns=
                   8657:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8658:             "filename">buildlink3.mk</code> files means that the
                   8659:             headers and libraries for these dependencies are also
1.45      wiz      8660:             symlinked into <code xmlns=
                   8661:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8662:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8663:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8664:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8665:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8666:             included.</p>
1.1       grant    8667:           </div>
                   8668: 
1.57      minskim  8669:           <div class="sect2" lang="en">
1.1       grant    8670:             <div class="titlepage">
                   8671:               <div>
                   8672:                 <div>
1.30      wiz      8673:                   <h3 class="title"><a name=
1.57      minskim  8674:                   "updating-buildlink-depends"></a>11.2.2.&nbsp;Updating
1.30      wiz      8675:                   <code class=
1.57      minskim  8676:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   8677:                   in <code xmlns=
1.45      wiz      8678:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8679:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8680:                 </div>
                   8681:               </div>
                   8682:             </div>
                   8683: 
                   8684:             <p>There are two situations that require increasing the
1.14      xtraeme  8685:             dependency listed in <code class=
                   8686:             "varname">BUILDLINK_DEPENDS.<em class=
                   8687:             "replaceable"><code>pkg</code></em></code> after a
                   8688:             package update:</p>
1.1       grant    8689: 
                   8690:             <div class="orderedlist">
                   8691:               <ol type="1">
                   8692:                 <li>
                   8693:                   <p>if the sonames (major number of the library
                   8694:                   version) of any installed shared libraries
1.47      reed     8695:                   change.</p>
1.1       grant    8696:                 </li>
                   8697: 
                   8698:                 <li>
                   8699:                   <p>if the API or interface to the header files
                   8700:                   change.</p>
                   8701:                 </li>
                   8702:               </ol>
                   8703:             </div>
                   8704: 
1.14      xtraeme  8705:             <p>In these cases, <code class=
                   8706:             "varname">BUILDLINK_DEPENDS.<em class=
                   8707:             "replaceable"><code>pkg</code></em></code> should be
                   8708:             adjusted to require at least the new package version.
                   8709:             In some cases, the packages that depend on this new
                   8710:             version may need their <code class=
                   8711:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8712:             have <code xmlns=
                   8713:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8714:             "filename">buildlink3.mk</code> files, their
                   8715:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8716:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8717:             too. This is needed so that binary packages made using
                   8718:             it will require the correct package dependency and not
                   8719:             settle for an older one which will not contain the
                   8720:             necessary shared libraries.</p>
1.1       grant    8721: 
                   8722:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8723:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8724:             "replaceable"><code>pkg</code></em></code> as we don't
                   8725:             want to cause unneeded package deletions and rebuilds.
                   8726:             In many cases, new versions of packages work just fine
                   8727:             with older dependencies. See <a href="#dependencies"
1.57      minskim  8728:             title=
                   8729:             "15.1.4.&nbsp;Handling dependencies">Section&nbsp;15.1.4,
                   8730:             &#8220;Handling dependencies&#8221;</a> for more
                   8731:             information about dependencies on other packages,
1.25      rillig   8732:             including the <code class=
                   8733:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8734:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8735:           </div>
                   8736:         </div>
                   8737: 
1.57      minskim  8738:         <div class="sect1" lang="en">
1.1       grant    8739:           <div class="titlepage">
                   8740:             <div>
                   8741:               <div>
                   8742:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8743:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8744:                 <code xmlns=
                   8745:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8746:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8747:               </div>
                   8748:             </div>
                   8749:           </div>
                   8750: 
                   8751:           <p>Some packages in pkgsrc install headers and libraries
                   8752:           that coincide with headers and libraries present in the
1.45      wiz      8753:           base system. Aside from a <code xmlns=
                   8754:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8755:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8756:           should also include a <code xmlns=
                   8757:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8758:           "filename">builtin.mk</code> file that includes the
                   8759:           necessary checks to decide whether using the built-in
                   8760:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8761: 
                   8762:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8763:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8764: 
                   8765:           <div class="orderedlist">
                   8766:             <ol type="1">
                   8767:               <li>
1.14      xtraeme  8768:                 <p>It should set <code class=
                   8769:                 "varname">USE_BUILTIN.<em class=
                   8770:                 "replaceable"><code>pkg</code></em></code> to
                   8771:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8772:                 or &#8220;<span class="quote">no</span>&#8221;
                   8773:                 after it is included.</p>
1.1       grant    8774:               </li>
                   8775: 
                   8776:               <li>
                   8777:                 <p>It should <span class=
                   8778:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8779:                 <code class="varname">USE_BUILTIN.<em class=
                   8780:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8781:                 already set before the <code xmlns=
                   8782:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8783:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8784:               </li>
                   8785: 
                   8786:               <li>
                   8787:                 <p>It should be written to allow multiple
                   8788:                 inclusion. This is <span class=
                   8789:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8790:                 careful attention to <code xmlns=
                   8791:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8792:                 "filename">Makefile</code> coding.</p>
1.1       grant    8793:               </li>
                   8794:             </ol>
                   8795:           </div>
                   8796: 
1.57      minskim  8797:           <div class="sect2" lang="en">
1.1       grant    8798:             <div class="titlepage">
                   8799:               <div>
                   8800:                 <div>
1.57      minskim  8801:                   <h3 class="title"><a name=
1.38      dillo    8802:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8803:                   of a <code xmlns=
                   8804:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8805:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8806:                 </div>
                   8807:               </div>
                   8808:             </div>
                   8809: 
                   8810:             <p>The following is the recommended template for
                   8811:             builtin.mk files:</p>
                   8812:             <pre class="programlisting">
1.51      rillig   8813:     .if !defined(IS_BUILTIN.foo)
                   8814:     #
                   8815:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8816:     # genuinely exists in the system or not.
                   8817:     #
                   8818:     IS_BUILTIN.foo?=        no
                   8819: 
                   8820:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8821:     # version can be determined.
                   8822:     #
                   8823:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8824:     BUILTIN_PKG.foo?=       foo-1.0
                   8825:     .  endif
                   8826:     .endif  # IS_BUILTIN.foo
                   8827: 
                   8828:     .if !defined(USE_BUILTIN.foo)
                   8829:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8830:     .  if defined(BUILTIN_PKG.foo)
                   8831:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8832:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8833:     USE_BUILTIN.foo!=                                                       \
                   8834:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8835:                   ${ECHO} "yes";                                            \
                   8836:           else                                                              \
                   8837:                   ${ECHO} "no";                                             \
                   8838:           fi
                   8839:     .      endif
                   8840:     .    endfor
                   8841:     .  endif
                   8842:     .endif  # USE_BUILTIN.foo
                   8843: 
                   8844:     CHECK_BUILTIN.foo?=     no
                   8845:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8846:     #
                   8847:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8848:     # "yes" or "no".
                   8849:     #
                   8850:     .endif  # CHECK_BUILTIN.foo
1.1       grant    8851: </pre>
                   8852: 
1.14      xtraeme  8853:             <p>The first section sets <code class=
                   8854:             "varname">IS_BUILTIN.<em class=
                   8855:             "replaceable"><code>pkg</code></em></code> depending on
                   8856:             if <em class="replaceable"><code>pkg</code></em> really
                   8857:             exists in the base system. This should not be a base
                   8858:             system software with similar functionality to
                   8859:             <em class="replaceable"><code>pkg</code></em>; it
                   8860:             should only be &#8220;<span class=
                   8861:             "quote">yes</span>&#8221; if the actual package is
                   8862:             included as part of the base system. This variable is
1.45      wiz      8863:             only used internally within the <code xmlns=
                   8864:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8865:             "filename">builtin.mk</code> file.</p>
                   8866: 
                   8867:             <p>The second section sets <code class=
                   8868:             "varname">BUILTIN_PKG.<em class=
                   8869:             "replaceable"><code>pkg</code></em></code> to the
                   8870:             version of <em class=
                   8871:             "replaceable"><code>pkg</code></em> in the base system
                   8872:             if it exists (if <code class=
                   8873:             "varname">IS_BUILTIN.<em class=
                   8874:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8875:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  8876:             variable is only used internally within the
1.45      wiz      8877:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8878:             class="filename">builtin.mk</code> file.</p>
1.1       grant    8879: 
1.14      xtraeme  8880:             <p>The third section sets <code class=
                   8881:             "varname">USE_BUILTIN.<em class=
                   8882:             "replaceable"><code>pkg</code></em></code> and is
                   8883:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      8884:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8885:             class="filename">builtin.mk</code> files. The code in
                   8886:             this section must make the determination whether the
                   8887:             built-in software is adequate to satisfy the
                   8888:             dependencies listed in <code class=
1.14      xtraeme  8889:             "varname">BUILDLINK_DEPENDS.<em class=
                   8890:             "replaceable"><code>pkg</code></em></code>. This is
                   8891:             typically done by comparing <code class=
                   8892:             "varname">BUILTIN_PKG.<em class=
                   8893:             "replaceable"><code>pkg</code></em></code> against each
                   8894:             of the dependencies in <code class=
                   8895:             "varname">BUILDLINK_DEPENDS.<em class=
                   8896:             "replaceable"><code>pkg</code></em></code>.
                   8897:             <code class="varname">USE_BUILTIN.<em class=
                   8898:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    8899:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      8900:             value by the end of the <code xmlns=
                   8901:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8902:             "filename">builtin.mk</code> file. Note that
                   8903:             <code class="varname">USE_BUILTIN.<em class=
                   8904:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    8905:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  8906:             <code class="varname">IS_BUILTIN.<em class=
                   8907:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8908:             &#8220;<span class="quote">no</span>&#8221; because we
                   8909:             may make the determination that the built-in version of
                   8910:             the software is similar enough to be used as a
                   8911:             replacement.</p>
                   8912: 
1.14      xtraeme  8913:             <p>The last section is guarded by <code class=
                   8914:             "varname">CHECK_BUILTIN.<em class=
                   8915:             "replaceable"><code>pkg</code></em></code>, and
                   8916:             includes code that uses the value of <code class=
                   8917:             "varname">USE_BUILTIN.<em class=
                   8918:             "replaceable"><code>pkg</code></em></code> set in the
                   8919:             previous section. This typically includes, e.g., adding
1.1       grant    8920:             additional dependency restrictions and listing
1.45      wiz      8921:             additional files to symlink into <code xmlns=
                   8922:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8923:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   8924:             "varname">BUILDLINK_FILES.<em class=
                   8925:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    8926:           </div>
                   8927: 
1.57      minskim  8928:           <div class="sect2" lang="en">
1.1       grant    8929:             <div class="titlepage">
                   8930:               <div>
                   8931:                 <div>
1.30      wiz      8932:                   <h3 class="title"><a name=
1.38      dillo    8933:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      8934:                   preferences for native or pkgsrc software</h3>
1.1       grant    8935:                 </div>
                   8936:               </div>
                   8937:             </div>
                   8938: 
                   8939:             <p>When building packages, it's possible to choose
                   8940:             whether to set a global preference for using either the
                   8941:             built-in (native) version or the pkgsrc version of
                   8942:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  8943:             setting <code class="varname">PREFER_PKGSRC</code> and
                   8944:             <code class="varname">PREFER_NATIVE</code>. These
                   8945:             variables take values of either &#8220;<span class=
1.1       grant    8946:             "quote">yes</span>&#8221;, &#8220;<span class=
                   8947:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  8948:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   8949:             to use the pkgsrc versions of software, while
                   8950:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   8951:             to use the built-in versions. Preferences are
                   8952:             determined by the most specific instance of the package
                   8953:             in either <code class="varname">PREFER_PKGSRC</code> or
                   8954:             <code class="varname">PREFER_NATIVE</code>. If a
                   8955:             package is specified in neither or in both variables,
                   8956:             then <code class="varname">PREFER_PKGSRC</code> has
                   8957:             precedence over <code class=
                   8958:             "varname">PREFER_NATIVE</code>. For example, to require
                   8959:             using pkgsrc versions of software for all but the most
                   8960:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    8961:             <pre class="programlisting">
1.51      rillig   8962:     PREFER_PKGSRC=  yes
                   8963:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    8964: </pre>
                   8965: 
                   8966:             <p>A package <span class=
1.45      wiz      8967:             "emphasis"><em>must</em></span> have a <code xmlns=
                   8968:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8969:             "filename">builtin.mk</code> file to be listed in
                   8970:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   8971:             it is simply ignored in that list.</p>
1.1       grant    8972:           </div>
                   8973:         </div>
                   8974:       </div>
                   8975: 
1.57      minskim  8976:       <div class="chapter" lang="en">
1.1       grant    8977:         <div class="titlepage">
                   8978:           <div>
                   8979:             <div>
1.57      minskim  8980:               <h2 class="title"><a name=
1.38      dillo    8981:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     8982:               framework</h2>
1.1       grant    8983:             </div>
                   8984:           </div>
                   8985:         </div>
                   8986: 
                   8987:         <div class="toc">
                   8988:           <p><b>Table of Contents</b></p>
                   8989: 
                   8990:           <dl>
1.30      wiz      8991:             <dt><span class="sect1"><a href=
1.38      dillo    8992:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     8993:             directories outside the installation
                   8994:             prefix</a></span></dt>
                   8995: 
                   8996:             <dd>
                   8997:               <dl>
                   8998:                 <dt><span class="sect2"><a href=
1.38      dillo    8999:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9000:                 manipulation</a></span></dt>
                   9001: 
                   9002:                 <dt><span class="sect2"><a href=
1.38      dillo    9003:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9004:                 manipulation</a></span></dt>
                   9005:               </dl>
                   9006:             </dd>
                   9007: 
1.38      dillo    9008:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9009:             Configuration files</a></span></dt>
                   9010: 
                   9011:             <dd>
                   9012:               <dl>
                   9013:                 <dt><span class="sect2"><a href=
1.38      dillo    9014:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9015:                 "varname">PKG_SYSCONFDIR</code> is
                   9016:                 set</a></span></dt>
                   9017: 
                   9018:                 <dt><span class="sect2"><a href=
1.38      dillo    9019:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9020:                 software where configuration files
1.35      jmmv     9021:                 are</a></span></dt>
                   9022: 
                   9023:                 <dt><span class="sect2"><a href=
1.38      dillo    9024:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9025:                 installations</a></span></dt>
                   9026: 
                   9027:                 <dt><span class="sect2"><a href=
1.38      dillo    9028:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9029:                 configuration files</a></span></dt>
                   9030:               </dl>
                   9031:             </dd>
                   9032: 
1.38      dillo    9033:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9034:             System startup scripts</a></span></dt>
                   9035: 
                   9036:             <dd>
                   9037:               <dl>
                   9038:                 <dt><span class="sect2"><a href=
1.38      dillo    9039:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9040:                 of system startup scripts</a></span></dt>
                   9041:               </dl>
                   9042:             </dd>
1.1       grant    9043: 
1.30      wiz      9044:             <dt><span class="sect1"><a href=
1.38      dillo    9045:             "#users-and-groups">12.4. System users and
1.35      jmmv     9046:             groups</a></span></dt>
                   9047: 
1.38      dillo    9048:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9049:             shells</a></span></dt>
                   9050: 
                   9051:             <dd>
                   9052:               <dl>
                   9053:                 <dt><span class="sect2"><a href=
1.38      dillo    9054:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     9055:                 configuration files</a></span></dt>
                   9056:               </dl>
                   9057:             </dd>
1.1       grant    9058:           </dl>
                   9059:         </div>
                   9060: 
1.35      jmmv     9061:         <p>This chapter describes the framework known as
                   9062:         <code class="literal">pkginstall</code>, whose key features
                   9063:         are:</p>
                   9064: 
                   9065:         <div class="itemizedlist">
                   9066:           <ul type="disc">
                   9067:             <li>
                   9068:               <p>Generic installation and manipulation of
                   9069:               directories and files outside the pkgsrc-handled
                   9070:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9071:             </li>
                   9072: 
                   9073:             <li>
                   9074:               <p>Automatic handling of configuration files during
                   9075:               installation, provided that packages are correctly
                   9076:               designed.</p>
                   9077:             </li>
                   9078: 
                   9079:             <li>
                   9080:               <p>Generation and installation of system startup
                   9081:               scripts.</p>
                   9082:             </li>
                   9083: 
                   9084:             <li>
                   9085:               <p>Registration of system users and groups.</p>
                   9086:             </li>
                   9087: 
                   9088:             <li>
                   9089:               <p>Registration of system shells.</p>
                   9090:             </li>
                   9091:           </ul>
                   9092:         </div>
                   9093: 
                   9094:         <p>The following sections inspect each of the above points
1.47      reed     9095:         in detail. Note that in order to use any of the described
1.35      jmmv     9096:         functionalities, you must add the following to your
1.45      wiz      9097:         package's <code xmlns=
                   9098:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   9099:         "filename">Makefile</code>:</p>
1.35      jmmv     9100:         <pre class="programlisting">
1.51      rillig   9101:     USE_PKGINSTALL= YES
1.35      jmmv     9102: </pre>
                   9103: 
                   9104:         <p>You may be thinking that many of the things described
                   9105:         here could be easily done with simple code in the package's
                   9106:         post-installation target (<code class=
                   9107:         "literal">post-install</code>). <span class=
                   9108:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9109:         in them is only executed when building from source.
                   9110:         Machines using binary packages could not benefit from it at
                   9111:         all (as the code itself could be unavailable). Therefore,
                   9112:         the only way to achieve any of the items described above is
                   9113:         by means of the installation scripts, which are
                   9114:         automatically generated by pkginstall.</p>
1.1       grant    9115: 
1.57      minskim  9116:         <div class="sect1" lang="en">
1.1       grant    9117:           <div class="titlepage">
                   9118:             <div>
                   9119:               <div>
                   9120:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  9121:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
                   9122:                 and directories outside the installation
                   9123:                 prefix</h2>
1.1       grant    9124:               </div>
                   9125:             </div>
                   9126:           </div>
                   9127: 
1.45      wiz      9128:           <p>As you already know, the <code xmlns=
                   9129:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9130:           "filename">PLIST</code> file holds a list of files and
                   9131:           directories that belong to a package. The names used in
1.45      wiz      9132:           it are relative to the installation prefix (<code xmlns=
                   9133:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9134:           "filename">${PREFIX}</code>), which means that it cannot
                   9135:           register files outside this directory (absolute path
                   9136:           names are not allowed). Despite this restriction, some
                   9137:           packages need to install files outside this location;
1.45      wiz      9138:           e.g., under <code xmlns=
                   9139:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9140:           "filename">${VARBASE}</code> or <code xmlns=
                   9141:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9142:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9143: 
                   9144:           <p>The only way to achieve this is to create such files
                   9145:           during installation time by using the installation
                   9146:           scripts. These scripts can run arbitrary commands, so
                   9147:           they have the potential to create and manage files
1.47      reed     9148:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9149:           comes into play: it provides generic scripts to abstract
                   9150:           the manipulation of such files and directories based on
1.45      wiz      9151:           variables set in the package's <code xmlns=
                   9152:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9153:           "filename">Makefile</code>. The rest of this section
1.47      reed     9154:           describes these variables.</p>
1.1       grant    9155: 
1.57      minskim  9156:           <div class="sect2" lang="en">
1.35      jmmv     9157:             <div class="titlepage">
1.1       grant    9158:               <div>
1.35      jmmv     9159:                 <div>
1.57      minskim  9160:                   <h3 class="title"><a name=
                   9161:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9162:                   manipulation</h3>
                   9163:                 </div>
1.1       grant    9164:               </div>
                   9165:             </div>
                   9166: 
1.35      jmmv     9167:             <p>The following variables can be set to request the
1.47      reed     9168:             creation of directories anywhere in the file
                   9169:             system:</p>
1.27      rillig   9170: 
1.35      jmmv     9171:             <div class="itemizedlist">
                   9172:               <ul type="disc">
                   9173:                 <li>
                   9174:                   <p><code class="varname">MAKE_DIRS</code> and
                   9175:                   <code class="varname">OWN_DIRS</code> contain a
                   9176:                   list of directories that should be created and
                   9177:                   should attempt to be destroyed by the
                   9178:                   installation scripts. The difference between the
                   9179:                   two is that the latter prompts the administrator
                   9180:                   to remove any directories that may be left after
                   9181:                   deinstallation (because they were not empty),
                   9182:                   while the former does not.</p>
                   9183:                 </li>
1.1       grant    9184: 
1.35      jmmv     9185:                 <li>
                   9186:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9187:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9188:                   contain a list of tuples describing which
                   9189:                   directories should be created and should attempt
                   9190:                   to be destroyed by the installation scripts. Each
                   9191:                   tuple holds the following values, separated by
                   9192:                   spaces: the directory name, its owner, its group
                   9193:                   and its numerical mode. For example:</p>
                   9194:                   <pre class="programlisting">
1.51      rillig   9195:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9196: </pre>
1.1       grant    9197: 
1.35      jmmv     9198:                   <p>The difference between the two is exactly the
                   9199:                   same as their non-<code class=
                   9200:                   "varname">PERMS</code> counterparts.</p>
                   9201:                 </li>
                   9202:               </ul>
                   9203:             </div>
                   9204:           </div>
                   9205: 
1.57      minskim  9206:           <div class="sect2" lang="en">
1.35      jmmv     9207:             <div class="titlepage">
                   9208:               <div>
                   9209:                 <div>
1.57      minskim  9210:                   <h3 class="title"><a name=
                   9211:                   "files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9212:                   manipulation</h3>
                   9213:                 </div>
                   9214:               </div>
                   9215:             </div>
                   9216: 
                   9217:             <p>Creating non-empty files outside the installation
1.45      wiz      9218:             prefix is tricky because the <code xmlns=
                   9219:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9220:             "filename">PLIST</code> forces all files to be inside
                   9221:             it. To overcome this problem, the only solution is to
                   9222:             extract the file in the known place (i.e., inside the
                   9223:             installation prefix) and copy it to the appropriate
                   9224:             location during installation (done by the installation
                   9225:             scripts generated by pkginstall). We will call the
                   9226:             former the <span class="emphasis"><em>master
                   9227:             file</em></span> in the following paragraphs, which
                   9228:             describe the variables that can be used to
                   9229:             automatically and consistently handle files outside the
                   9230:             installation prefix:</p>
                   9231: 
                   9232:             <div class="itemizedlist">
                   9233:               <ul type="disc">
                   9234:                 <li>
                   9235:                   <p><code class="varname">CONF_FILES</code> and
                   9236:                   <code class="varname">SUPPORT_FILES</code> are
                   9237:                   pairs of master and target files. During
                   9238:                   installation time, the master file is copied to
                   9239:                   the target one if and only if the latter does not
                   9240:                   exist. Upon deinstallation, the target file is
                   9241:                   removed provided that it was not modified by the
                   9242:                   installation.</p>
                   9243: 
                   9244:                   <p>The difference between the two is that the
                   9245:                   latter prompts the administrator to remove any
                   9246:                   files that may be left after deinstallation
                   9247:                   (because they were not empty), while the former
                   9248:                   does not.</p>
                   9249:                 </li>
                   9250: 
                   9251:                 <li>
                   9252:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9253:                   and <code class=
                   9254:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9255:                   tuples describing master files as well as their
                   9256:                   target locations. For each of them, it also
                   9257:                   specifies their owner, their group and their
                   9258:                   numeric permissions, in this order. For
                   9259:                   example:</p>
                   9260:                   <pre class="programlisting">
1.51      rillig   9261:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9262: </pre>
                   9263: 
                   9264:                   <p>The difference between the two is exactly the
                   9265:                   same as their non-<code class=
                   9266:                   "varname">PERMS</code> counterparts.</p>
                   9267:                 </li>
                   9268:               </ul>
                   9269:             </div>
                   9270:           </div>
                   9271:         </div>
                   9272: 
1.57      minskim  9273:         <div class="sect1" lang="en">
1.35      jmmv     9274:           <div class="titlepage">
                   9275:             <div>
                   9276:               <div>
                   9277:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  9278:                 "conf-files"></a>12.2.&nbsp;Configuration
                   9279:                 files</h2>
1.35      jmmv     9280:               </div>
                   9281:             </div>
                   9282:           </div>
                   9283: 
                   9284:           <p>Configuration files are special in the sense that they
                   9285:           are installed in their own specific directory,
                   9286:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9287:           special treatment during installation (most of which is
                   9288:           automated by pkginstall). The main concept you must bear
1.36      wiz      9289:           in mind is that files marked as configuration files are
1.35      jmmv     9290:           automatically copied to the right place (somewhere inside
                   9291:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9292:           installation <span class="emphasis"><em>if and only
                   9293:           if</em></span> they didn't exist before. Similarly, they
                   9294:           will not be removed if they have local modifications.
1.36      wiz      9295:           This ensures that administrators never lose any custom
1.35      jmmv     9296:           changes they may have made.</p>
                   9297: 
1.57      minskim  9298:           <div class="sect2" lang="en">
1.35      jmmv     9299:             <div class="titlepage">
                   9300:               <div>
                   9301:                 <div>
1.57      minskim  9302:                   <h3 class="title"><a name=
                   9303:                   "conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9304:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9305:                   set</h3>
                   9306:                 </div>
                   9307:               </div>
                   9308:             </div>
                   9309: 
                   9310:             <p>As said before, the <code class=
                   9311:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9312:             where configuration files shall be installed. Its
                   9313:             contents are set based upon the following
                   9314:             variables:</p>
                   9315: 
                   9316:             <div class="itemizedlist">
                   9317:               <ul type="disc">
                   9318:                 <li>
                   9319:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9320:                   The configuration's root directory. Defaults to
1.45      wiz      9321:                   <code xmlns=
                   9322:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9323:                   "filename">${PREFIX}/etc</code> although it may
                   9324:                   be overridden by the user to point to his
                   9325:                   preferred location (e.g., <code xmlns=
                   9326:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9327:                   "filename">/etc</code>, <code xmlns=
                   9328:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9329:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9330:                   not use it directly.</p>
                   9331:                 </li>
                   9332: 
                   9333:                 <li>
                   9334:                   <p><code class=
                   9335:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9336:                   subdirectory of <code class=
                   9337:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9338:                   configuration files for the package being built
                   9339:                   shall be installed. The definition of this
                   9340:                   variable only makes sense in the package's
1.45      wiz      9341:                   <code xmlns=
                   9342:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9343:                   "filename">Makefile</code> (i.e., it is not
                   9344:                   user-customizable).</p>
1.35      jmmv     9345: 
                   9346:                   <p>As an example, consider the Apache package,
                   9347:                   <a xmlns=
                   9348:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9349:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9350:                   target="_top"><code xmlns="" class=
                   9351:                   "filename">www/apache2</code></a>, which places
                   9352:                   its configuration files under the <code xmlns=
                   9353:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9354:                   "filename">httpd/</code> subdirectory of
                   9355:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9356:                   This should be set in the package Makefile.</p>
                   9357:                 </li>
                   9358: 
                   9359:                 <li>
                   9360:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9361:                   Specifies the name of the variable that holds
                   9362:                   this package's configuration directory (if
                   9363:                   different from <code class=
                   9364:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9365:                   <code class="varname">PKGBASE</code>'s value, and
                   9366:                   is always prefixed with <code class=
                   9367:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9368:                 </li>
                   9369: 
                   9370:                 <li>
                   9371:                   <p><code class=
                   9372:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9373:                   Holds the directory where the configuration files
                   9374:                   for the package identified by <code class=
                   9375:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9376:                   placed.</p>
                   9377:                 </li>
                   9378:               </ul>
                   9379:             </div>
                   9380: 
                   9381:             <p>Based on the above variables, pkginstall determines
                   9382:             the value of <code class=
                   9383:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9384:             <span class="emphasis"><em>only</em></span> variable
                   9385:             that can be used within a package to refer to its
                   9386:             configuration directory. The algorithm used to set its
                   9387:             value is basically the following:</p>
                   9388: 
                   9389:             <div class="orderedlist">
                   9390:               <ol type="1">
                   9391:                 <li>
                   9392:                   <p>If <code class=
                   9393:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9394:                   is set, its value is used.</p>
                   9395:                 </li>
                   9396: 
                   9397:                 <li>
                   9398:                   <p>If the previous variable is not defined but
                   9399:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9400:                   set in the package's <code xmlns=
                   9401:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9402:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9403:                   is <code xmlns=
                   9404:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9405:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9406:                 </li>
                   9407: 
                   9408:                 <li>
1.45      wiz      9409:                   <p>Otherwise, it is set to <code xmlns=
                   9410:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9411:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9412:                 </li>
                   9413:               </ol>
                   9414:             </div>
                   9415: 
1.45      wiz      9416:             <p>It is worth mentioning that <code xmlns=
                   9417:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9418:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9419:             added to <code xmlns=
                   9420:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9421:             "filename">OWN_DIRS</code>. See <a href=
                   9422:             "#dirs-outside-prefix" title=
1.57      minskim  9423:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9424:             &#8220;Directory manipulation&#8221;</a> what this
                   9425:             means.</p>
                   9426:           </div>
                   9427: 
1.57      minskim  9428:           <div class="sect2" lang="en">
1.35      jmmv     9429:             <div class="titlepage">
                   9430:               <div>
                   9431:                 <div>
1.57      minskim  9432:                   <h3 class="title"><a name=
                   9433:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
                   9434:                   the software where configuration files are</h3>
1.35      jmmv     9435:                 </div>
                   9436:               </div>
                   9437:             </div>
                   9438: 
                   9439:             <p>Given that pkgsrc (and users!) expect configuration
                   9440:             files to be in a known place, you need to teach each
1.36      wiz      9441:             package where it shall install its files. In some cases
1.35      jmmv     9442:             you will have to patch the package Makefiles to achieve
                   9443:             it. If you are lucky, though, it may be as easy as
                   9444:             passing an extra flag to the configuration script; this
1.47      reed     9445:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9446:             <pre class="programlisting">
1.51      rillig   9447:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9448: </pre>
                   9449: 
                   9450:             <p>Note that this specifies where the package has to
                   9451:             <span class="emphasis"><em>look for</em></span> its
                   9452:             configuration files, not where they will be originally
                   9453:             installed (although the difference is never explicit,
                   9454:             unfortunately).</p>
                   9455:           </div>
                   9456: 
1.57      minskim  9457:           <div class="sect2" lang="en">
1.35      jmmv     9458:             <div class="titlepage">
                   9459:               <div>
                   9460:                 <div>
1.57      minskim  9461:                   <h3 class="title"><a name=
                   9462:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9463:                   installations</h3>
                   9464:                 </div>
                   9465:               </div>
                   9466:             </div>
                   9467: 
                   9468:             <p>As said before, pkginstall automatically handles
                   9469:             configuration files. This means that <span class=
                   9470:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9471:             the contents of <code xmlns=
                   9472:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9473:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9474:             directly</strong></span>. Bad news is that many
                   9475:             software installation scripts will, out of the box,
                   9476:             mess with the contents of that directory. So what is
                   9477:             the correct procedure to fix this issue?</p>
1.35      jmmv     9478: 
                   9479:             <p>You must teach the package (usually by manually
                   9480:             patching it) to install any configuration files under
1.45      wiz      9481:             the examples hierarchy, <code xmlns=
                   9482:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9483:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9484:             the <code xmlns=
                   9485:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9486:             "filename">PLIST</code> registers them and the
                   9487:             administrator always has the original copies
1.35      jmmv     9488:             available.</p>
                   9489: 
                   9490:             <p>Once the required configuration files are in place
                   9491:             (i.e., under the examples hierarchy), the pkginstall
                   9492:             framework can use them as master copies during the
1.45      wiz      9493:             package installation to update what is in <code xmlns=
                   9494:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9495:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9496:             the variables <code class="varname">CONF_FILES</code>
                   9497:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9498:             used. Check out <a href="#files-outside-prefix" title=
1.57      minskim  9499:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9500:             &#8220;File manipulation&#8221;</a> for information
                   9501:             about their syntax and their purpose. Here is an
                   9502:             example, taken from the <a xmlns=
                   9503:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9504:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9505:             target="_top"><code xmlns="" class=
                   9506:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9507:             <pre class="programlisting">
1.51      rillig   9508:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9509:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9510: </pre>
                   9511: 
                   9512:             <p>Note that the <code class="varname">EGDIR</code>
                   9513:             variable is specific to that package and has no meaning
                   9514:             outside it.</p>
                   9515:           </div>
                   9516: 
1.57      minskim  9517:           <div class="sect2" lang="en">
1.35      jmmv     9518:             <div class="titlepage">
                   9519:               <div>
                   9520:                 <div>
1.57      minskim  9521:                   <h3 class="title"><a name=
                   9522:                   "conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     9523:                   handling of configuration files</h3>
                   9524:                 </div>
                   9525:               </div>
                   9526:             </div>
                   9527: 
                   9528:             <p>The automatic copying of config files can be toggled
                   9529:             by setting the environment variable <code class=
                   9530:             "varname">PKG_CONFIG</code> prior to package
                   9531:             installation.</p>
                   9532:           </div>
                   9533:         </div>
                   9534: 
1.57      minskim  9535:         <div class="sect1" lang="en">
1.35      jmmv     9536:           <div class="titlepage">
                   9537:             <div>
                   9538:               <div>
                   9539:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  9540:                 "rcd-scripts"></a>12.3.&nbsp;System startup
                   9541:                 scripts</h2>
1.35      jmmv     9542:               </div>
                   9543:             </div>
                   9544:           </div>
                   9545: 
                   9546:           <p>System startup scripts are special files because they
                   9547:           must be installed in a place known by the underlying OS,
                   9548:           usually outside the installation prefix. Therefore, the
                   9549:           same rules described in <a href=
                   9550:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9551:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.57      minskim  9552:           Section&nbsp;12.1, &#8220;Files and directories outside
                   9553:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     9554:           solutions can be used. However, pkginstall provides a
1.36      wiz      9555:           special mechanism to handle these files.</p>
1.35      jmmv     9556: 
                   9557:           <p>In order to provide system startup scripts, the
                   9558:           package has to:</p>
                   9559: 
                   9560:           <div class="orderedlist">
                   9561:             <ol type="1">
                   9562:               <li>
1.45      wiz      9563:                 <p>Store the script inside <code xmlns=
                   9564:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9565:                 "filename">${FILESDIR}</code>, with the
                   9566:                 <code class="literal">.sh</code> suffix appended.
                   9567:                 Considering the <a xmlns=
                   9568:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9569:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9570:                 target="_top"><code xmlns="" class=
                   9571:                 "filename">print/cups</code></a> package as an
                   9572:                 example, it has a <code xmlns=
                   9573:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9574:                 "filename">cupsd.sh</code> in its files
                   9575:                 directory.</p>
                   9576:               </li>
                   9577: 
                   9578:               <li>
                   9579:                 <p>Tell pkginstall to handle it, appending the name
                   9580:                 of the script, without its extension, to the
                   9581:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9582:                 Continuing the previous example:</p>
                   9583:                 <pre class="programlisting">
1.51      rillig   9584:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     9585: </pre>
                   9586:               </li>
                   9587:             </ol>
                   9588:           </div>
                   9589: 
                   9590:           <p>Once this is done, pkginstall will do the following
                   9591:           steps for each script in an automated fashion:</p>
                   9592: 
                   9593:           <div class="orderedlist">
                   9594:             <ol type="1">
                   9595:               <li>
                   9596:                 <p>Process the file found in the files directory
                   9597:                 applying all the substitutions described in the
1.45      wiz      9598:                 <code xmlns=
                   9599:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9600:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9601:               </li>
                   9602: 
                   9603:               <li>
                   9604:                 <p>Copy the script from the files directory to the
1.45      wiz      9605:                 examples hierarchy, <code xmlns=
                   9606:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9607:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9608:                 Note that this master file must be explicitly
1.45      wiz      9609:                 registered in the <code xmlns=
                   9610:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9611:                 "filename">PLIST</code>.</p>
                   9612:               </li>
                   9613: 
                   9614:               <li>
                   9615:                 <p>Add code to the installation scripts to copy the
                   9616:                 startup script from the examples hierarchy into the
                   9617:                 system-wide startup scripts directory.</p>
                   9618:               </li>
                   9619:             </ol>
                   9620:           </div>
                   9621: 
1.57      minskim  9622:           <div class="sect2" lang="en">
1.35      jmmv     9623:             <div class="titlepage">
                   9624:               <div>
                   9625:                 <div>
1.57      minskim  9626:                   <h3 class="title"><a name=
                   9627:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     9628:                   handling of system startup scripts</h3>
                   9629:                 </div>
                   9630:               </div>
                   9631:             </div>
                   9632: 
                   9633:             <p>The automatic copying of config files can be toggled
                   9634:             by setting the environment variable <code class=
                   9635:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9636:             installation. Note that the scripts will be always
1.45      wiz      9637:             copied inside the examples hierarchy, <code xmlns=
                   9638:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9639:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9640:             matter what the value of this variable is.</p>
                   9641:           </div>
                   9642:         </div>
                   9643: 
1.57      minskim  9644:         <div class="sect1" lang="en">
1.35      jmmv     9645:           <div class="titlepage">
                   9646:             <div>
                   9647:               <div>
                   9648:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  9649:                 "users-and-groups"></a>12.4.&nbsp;System users and
                   9650:                 groups</h2>
1.35      jmmv     9651:               </div>
                   9652:             </div>
                   9653:           </div>
                   9654: 
                   9655:           <p>If a package needs to create special users and/or
                   9656:           groups during installation, it can do so by using the
                   9657:           pkginstall framework.</p>
                   9658: 
                   9659:           <p>Users can be created by adding entries to the
                   9660:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9661:           entry has the following syntax, which mimics <code xmlns=
                   9662:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9663:           "filename">/etc/passwd</code>:</p>
                   9664:           <pre class="programlisting">
1.51      rillig   9665:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     9666: </pre>
                   9667: 
                   9668:           <p>Only the user and group are required; everything else
                   9669:           is optional, but the colons must be in the right places
                   9670:           when specifying optional bits. By default, a new user
1.45      wiz      9671:           will have home directory <code xmlns=
                   9672:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9673:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9674:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9675:           class="filename">/sbin/nologin</code> unless they are
                   9676:           specified as part of the user element. Note that if the
1.51      rillig   9677:           description contains spaces, then spaces should be
1.45      wiz      9678:           backslash-escaped, as in:</p>
1.35      jmmv     9679:           <pre class="programlisting">
1.51      rillig   9680:     foo:foogrp::The\ Foomister
1.35      jmmv     9681: </pre>
                   9682: 
                   9683:           <p>Similarly, groups can be created using the
                   9684:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9685:           syntax is:</p>
                   9686:           <pre class="programlisting">
1.51      rillig   9687:     group[:groupid]
1.35      jmmv     9688: </pre>
                   9689: 
                   9690:           <p>As before, only the group name is required; the
                   9691:           numeric identifier is optional.</p>
                   9692:         </div>
                   9693: 
1.57      minskim  9694:         <div class="sect1" lang="en">
1.35      jmmv     9695:           <div class="titlepage">
                   9696:             <div>
                   9697:               <div>
                   9698:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  9699:                 "shells"></a>12.5.&nbsp;System shells</h2>
1.35      jmmv     9700:               </div>
                   9701:             </div>
                   9702:           </div>
                   9703: 
                   9704:           <p>Packages that install system shells should register
1.45      wiz      9705:           them in the shell database, <code xmlns=
                   9706:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9707:           "filename">/etc/shells</code>, to make things easier to
                   9708:           the administrator. This must be done from the
                   9709:           installation scripts to keep binary packages working on
                   9710:           any system. pkginstall provides an easy way to accomplish
                   9711:           this task.</p>
                   9712: 
                   9713:           <p>When a package provides a shell interpreter, it has to
                   9714:           set the <code class="varname">PKG_SHELL</code> variable
                   9715:           to its absolute file name. This will add some hooks to
                   9716:           the installation scripts to handle it. Consider the
                   9717:           following example, taken from <a xmlns=
                   9718:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9719:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9720:           target="_top"><code xmlns="" class=
                   9721:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9722:           <pre class="programlisting">
1.51      rillig   9723:     USE_PKGINSTALL= YES
                   9724:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     9725: </pre>
                   9726: 
1.57      minskim  9727:           <div class="sect2" lang="en">
1.35      jmmv     9728:             <div class="titlepage">
                   9729:               <div>
                   9730:                 <div>
1.57      minskim  9731:                   <h3 class="title"><a name=
                   9732:                   "shells-disable"></a>12.5.1.&nbsp;Disabling
                   9733:                   handling of configuration files</h3>
1.35      jmmv     9734:                 </div>
                   9735:               </div>
                   9736:             </div>
                   9737: 
                   9738:             <p>The automatic registration of shell interpreters can
                   9739:             be disabled by the administrator by setting the
1.45      wiz      9740:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9741:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9742:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9743:           </div>
                   9744:         </div>
                   9745:       </div>
                   9746: 
1.57      minskim  9747:       <div class="chapter" lang="en">
1.35      jmmv     9748:         <div class="titlepage">
                   9749:           <div>
                   9750:             <div>
1.57      minskim  9751:               <h2 class="title"><a name=
1.38      dillo    9752:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9753:               handling</h2>
                   9754:             </div>
                   9755:           </div>
                   9756:         </div>
                   9757: 
                   9758:         <div class="toc">
                   9759:           <p><b>Table of Contents</b></p>
                   9760: 
                   9761:           <dl>
                   9762:             <dt><span class="sect1"><a href=
1.38      dillo    9763:             "#global-default-options">13.1. Global default
1.35      jmmv     9764:             options</a></span></dt>
                   9765: 
                   9766:             <dt><span class="sect1"><a href=
1.38      dillo    9767:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9768:             use <code xmlns=
                   9769:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9770:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9771: 
                   9772:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9773:             Option Names</a></span></dt>
1.35      jmmv     9774:           </dl>
                   9775:         </div>
                   9776: 
                   9777:         <p>Many packages have the ability to be built to support
1.45      wiz      9778:         different sets of features. <code xmlns=
                   9779:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9780:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9781:         that provides generic handling of those options that
                   9782:         determine different ways in which the packages can be
                   9783:         built. It's possible for the user to specify exactly which
                   9784:         sets of options will be built into a package or to allow a
                   9785:         set of global default options apply.</p>
                   9786: 
1.57      minskim  9787:         <div class="sect1" lang="en">
1.35      jmmv     9788:           <div class="titlepage">
                   9789:             <div>
                   9790:               <div>
                   9791:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9792:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9793:                 default options</h2>
                   9794:               </div>
                   9795:             </div>
                   9796:           </div>
                   9797: 
                   9798:           <p>Global default options are listed in <code class=
                   9799:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9800:           the options that should be built into every package if
                   9801:           that option is supported. This variable should be set in
1.45      wiz      9802:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9803:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     9804:         </div>
                   9805: 
1.57      minskim  9806:         <div class="sect1" lang="en">
1.35      jmmv     9807:           <div class="titlepage">
                   9808:             <div>
                   9809:               <div>
                   9810:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9811:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      9812:                 packages to use <code xmlns=
                   9813:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9814:                 "filename">bsd.options.mk</code></h2>
                   9815:               </div>
                   9816:             </div>
                   9817:           </div>
                   9818: 
1.45      wiz      9819:           <p>The following example shows how <code xmlns=
                   9820:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9821:           "filename">bsd.options.mk</code> should be used by the
                   9822:           hypothetical ``wibble'' package, either in the package
1.45      wiz      9823:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9824:           class="filename">Makefile</code>, or in a file, e.g.
                   9825:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9826:           class="filename">options.mk</code>, that is included by
                   9827:           the main package <code xmlns=
                   9828:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9829:           "filename">Makefile</code>.</p>
                   9830:           <pre class="programlisting">
1.51      rillig   9831:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   9832:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   9833:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   9834:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   9835:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   9836:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   9837:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   9838: 
                   9839:     .include "../../mk/bsd.prefs.mk"
                   9840: 
                   9841:     # this package was previously named wibble2
                   9842:     .if defined(PKG_OPTIONS.wibble2)
                   9843:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   9844:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   9845:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   9846:     .endif
                   9847: 
                   9848:     .include "../../mk/bsd.options.mk"
                   9849: 
                   9850:     # Package-specific option-handling
                   9851: 
                   9852:     ###
                   9853:     ### FOO support
                   9854:     ###
                   9855:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   9856:     CONFIGURE_ARGS+=    --enable-foo
                   9857:     .endif
                   9858: 
                   9859:     ###
                   9860:     ### LDAP support
                   9861:     ###
                   9862:     .if !empty(PKG_OPTIONS:Mldap)
                   9863:     .  include "../../databases/openldap/buildlink3.mk"
                   9864:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   9865:     .endif
                   9866: 
                   9867:     ###
                   9868:     ### database support
                   9869:     ###
                   9870:     .if !empty(PKG_OPTIONS:Mmysql)
                   9871:     .  include "../../mk/mysql.buildlink3.mk"
                   9872:     .endif
                   9873:     .if !empty(PKG_OPTIONS:Mpgsql)
                   9874:     .  include "../../mk/pgsql.buildlink3.mk"
                   9875:     .endif
1.1       grant    9876: </pre>
                   9877: 
1.28      rillig   9878:           <p>The first section contains the information about which
                   9879:           build options are supported by the package, and any
1.1       grant    9880:           default options settings if needed.</p>
                   9881: 
                   9882:           <div class="orderedlist">
                   9883:             <ol type="1">
                   9884:               <li>
1.14      xtraeme  9885:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   9886:                 the name of the <a href=
1.1       grant    9887:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9888:                 <span class="citerefentry"><span class=
1.27      rillig   9889:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    9890:                 that the user can set to override the default
1.57      minskim  9891:                 options. It should be set to PKG_OPTIONS.<em class=
                   9892:                 "replaceable"><code>pkgbase</code></em>.</p>
1.1       grant    9893:               </li>
                   9894: 
                   9895:               <li>
1.14      xtraeme  9896:                 <p><code class=
                   9897:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    9898:                 build options supported by the package.</p>
                   9899:               </li>
                   9900: 
                   9901:               <li>
                   9902:                 <p><code class=
                   9903:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   9904:                 list of names of groups of mutually exclusive
                   9905:                 options. The options in each group are listed in
                   9906:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   9907:                 "replaceable"><code>groupname</code></em></code>.
                   9908:                 The most specific setting of any option from the
                   9909:                 group takes precedence over all other options in
                   9910:                 the group. Options from the groups will be
                   9911:                 automatically added to <code class=
                   9912:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   9913:               </li>
                   9914: 
                   9915:               <li>
                   9916:                 <p><code class=
                   9917:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   9918:                 like <code class=
                   9919:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   9920:                 building the packages will fail if no option from
                   9921:                 the group is selected.</p>
1.1       grant    9922:               </li>
                   9923: 
                   9924:               <li>
1.27      rillig   9925:                 <p><code class=
1.44      gdt      9926:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   9927:                 list of names of sets of options. At least one
                   9928:                 option from each set must be selected. The options
                   9929:                 in each set are listed in <code class=
                   9930:                 "varname">PKG_OPTIONS_SET.<em class=
                   9931:                 "replaceable"><code>setname</code></em></code>.
                   9932:                 Options from the sets will be automatically added
                   9933:                 to <code class=
                   9934:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   9935:                 the package will fail if no option from the set is
                   9936:                 selected.</p>
                   9937:               </li>
                   9938: 
                   9939:               <li>
                   9940:                 <p><code class=
1.27      rillig   9941:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   9942:                 build options which are enabled by default.</p>
                   9943:               </li>
                   9944: 
                   9945:               <li>
1.37      dillo    9946:                 <p><code class=
                   9947:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   9948:                 of &#8220;<span class="quote"><em class=
1.57      minskim  9949:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;
                   9950:                 pairs that map legacy <code xmlns=
1.45      wiz      9951:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    9952:                 "filename">/etc/mk.conf</code> variables to their
                   9953:                 option counterparts. Pairs should be added with
                   9954:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9955:                 the listing of global legacy variables. A warning
                   9956:                 will be issued if the user uses a legacy
                   9957:                 variable.</p>
                   9958:               </li>
1.1       grant    9959: 
1.37      dillo    9960:               <li>
                   9961:                 <p><code class=
                   9962:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   9963:                 of &#8220;<span class="quote"><em class=
1.57      minskim  9964:                 "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;
                   9965:                 pairs that map options that have been renamed to
                   9966:                 their new counterparts. Pairs should be added with
1.37      dillo    9967:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9968:                 the listing of global legacy options. A warning
                   9969:                 will be issued if the user uses a legacy
                   9970:                 option.</p>
                   9971:               </li>
1.1       grant    9972: 
1.37      dillo    9973:               <li>
                   9974:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   9975:                 is a list of options implied by deprecated
                   9976:                 variables used. This can be used for cases that
                   9977:                 neither <code class=
                   9978:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   9979:                 <code class=
                   9980:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   9981:                 handle, e. g. when <code class=
                   9982:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    9983:               </li>
                   9984: 
                   9985:               <li>
1.37      dillo    9986:                 <p><code class=
                   9987:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   9988:                 a list of warnings about deprecated variables or
                   9989:                 options used, and what to use instead.</p>
1.1       grant    9990:               </li>
1.28      rillig   9991:             </ol>
1.1       grant    9992:           </div>
                   9993: 
1.37      dillo    9994:           <p>A package should never modify <code class=
                   9995:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   9996:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   9997:           These are strictly user-settable. To suggest a default
                   9998:           set of options, use <code class=
                   9999:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10000: 
1.42      dillo    10001:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10002:           defined before including <code xmlns=
                   10003:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10004:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10005:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10006:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10007:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10008:           are defined (as can happen with platform-specific options
1.42      dillo    10009:           if none of them is supported on the current platform),
                   10010:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10011:           empty list and the package is otherwise treated as not
                   10012:           using the options framework.</p>
1.37      dillo    10013: 
1.45      wiz      10014:           <p>After the inclusion of <code xmlns=
                   10015:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10016:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10017:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10018:           list of selected build options, properly filtered to
1.28      rillig   10019:           remove unsupported and duplicate options.</p>
                   10020: 
1.1       grant    10021:           <p>The remaining sections contain the logic that is
1.37      dillo    10022:           specific to each option. The correct way to check for an
                   10023:           option is to check whether it is listed in <code class=
                   10024:           "varname">PKG_OPTIONS</code>:</p>
                   10025:           <pre class="programlisting">
1.51      rillig   10026:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10027: "replaceable"><code>option</code></em>)
                   10028: </pre>
1.48      dillo    10029:         </div>
1.37      dillo    10030: 
1.57      minskim  10031:         <div class="sect1" lang="en">
1.48      dillo    10032:           <div class="titlepage">
                   10033:             <div>
                   10034:               <div>
                   10035:                 <h2 class="title" style="clear: both"><a name=
                   10036:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10037:               </div>
                   10038:             </div>
                   10039:           </div>
                   10040: 
                   10041:           <p>Options that enable similar features in different
                   10042:           packages (like optional support for a library) should use
                   10043:           a common name in all packages that support it (like the
                   10044:           name of the library). If another package already has an
                   10045:           option with the same meaning, use the same name.</p>
                   10046: 
                   10047:           <p>Options that enable features specific to one package,
                   10048:           where it's unlikely that another (unrelated) package has
                   10049:           the same (or a similar) optional feature, should use a
                   10050:           name prefixed with <code class="varname"><em class=
                   10051:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10052: 
                   10053:           <p>If a group of related packages share an optional
                   10054:           feature specific to that group, prefix it with the name
                   10055:           of the &#8220;<span class="quote">main</span>&#8221;
                   10056:           package (e. g. <code class=
                   10057:           "varname">djbware-errno-hack</code>).</p>
                   10058: 
                   10059:           <p>For new options, add a line to <code xmlns=
                   10060:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10061:           "filename">mk/defaults/options.description</code>. Lines
                   10062:           have two fields, separated by tab. The first field is the
                   10063:           option name, the second its description. The description
                   10064:           should be a whole sentence (starting with an uppercase
                   10065:           letter and ending with a period) that describes what
                   10066:           enabling the option does. E. g. &#8220;<span class=
                   10067:           "quote">Enable ispell support.</span>&#8221; The file is
                   10068:           sorted by option names.</p>
1.1       grant    10069:         </div>
                   10070:       </div>
                   10071: 
1.57      minskim  10072:       <div class="chapter" lang="en">
1.1       grant    10073:         <div class="titlepage">
                   10074:           <div>
                   10075:             <div>
1.57      minskim  10076:               <h2 class="title"><a name=
1.38      dillo    10077:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10078:               process</h2>
                   10079:             </div>
                   10080:           </div>
                   10081:         </div>
                   10082: 
                   10083:         <div class="toc">
                   10084:           <p><b>Table of Contents</b></p>
                   10085: 
                   10086:           <dl>
1.56      rillig   10087:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10088:             Introduction</a></span></dt>
                   10089: 
                   10090:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10091:             Program location</a></span></dt>
                   10092: 
1.56      rillig   10093:             <dt><span class="sect1"><a href=
                   10094:             "#build.builddirs">14.3. Directories used during the
                   10095:             build process</a></span></dt>
                   10096: 
                   10097:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10098:             Running a phase</a></span></dt>
                   10099: 
                   10100:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10101:             The <span class="emphasis"><em>fetch</em></span>
                   10102:             phase</a></span></dt>
                   10103: 
                   10104:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10105:             The <span class="emphasis"><em>checksum</em></span>
                   10106:             phase</a></span></dt>
                   10107: 
                   10108:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10109:             The <span class="emphasis"><em>extract</em></span>
                   10110:             phase</a></span></dt>
                   10111: 
                   10112:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10113:             The <span class="emphasis"><em>patch</em></span>
                   10114:             phase</a></span></dt>
                   10115: 
                   10116:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10117:             The <span class="emphasis"><em>tools</em></span>
                   10118:             phase</a></span></dt>
                   10119: 
                   10120:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10121:             The <span class="emphasis"><em>wrapper</em></span>
                   10122:             phase</a></span></dt>
1.1       grant    10123: 
                   10124:             <dt><span class="sect1"><a href=
1.56      rillig   10125:             "#build.configure">14.11. The <span class=
                   10126:             "emphasis"><em>configure</em></span>
                   10127:             phase</a></span></dt>
                   10128: 
                   10129:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10130:             The <span class="emphasis"><em>build</em></span>
                   10131:             phase</a></span></dt>
                   10132: 
                   10133:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10134:             The <span class="emphasis"><em>test</em></span>
                   10135:             phase</a></span></dt>
                   10136: 
                   10137:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10138:             The <span class="emphasis"><em>install</em></span>
                   10139:             phase</a></span></dt>
                   10140: 
                   10141:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10142:             The <span class="emphasis"><em>package</em></span>
                   10143:             phase</a></span></dt>
                   10144: 
                   10145:             <dt><span class="sect1"><a href=
                   10146:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10147:             targets</a></span></dt>
                   10148:           </dl>
                   10149:         </div>
                   10150: 
1.57      minskim  10151:         <div class="sect1" lang="en">
1.56      rillig   10152:           <div class="titlepage">
                   10153:             <div>
                   10154:               <div>
                   10155:                 <h2 class="title" style="clear: both"><a name=
                   10156:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10157:               </div>
                   10158:             </div>
                   10159:           </div>
                   10160: 
                   10161:           <p>This chapter gives a detailed description on how a
                   10162:           package is built. Building a package is separated into
                   10163:           different <span class="emphasis"><em>phases</em></span>
                   10164:           (for example <code class="varname">fetch</code>,
                   10165:           <code class="varname">build</code>, <code class=
                   10166:           "varname">install</code>), all of which are described in
                   10167:           the following sections. Each phase is splitted into
                   10168:           so-called <span class="emphasis"><em>stages</em></span>,
                   10169:           which take the name of the containing stage, prefixed by
                   10170:           one of <code class="varname">pre-</code>, <code class=
                   10171:           "varname">do-</code> or <code class=
                   10172:           "varname">post-</code>. (Examples are <code class=
                   10173:           "varname">pre-configure</code>, <code class=
                   10174:           "varname">post-build</code>.) Most of the actual work is
                   10175:           done in the <code class="varname">do-*</code> stages.</p>
                   10176: 
                   10177:           <p>The basic steps for building a program are always the
                   10178:           same. First the program's source (<span class=
                   10179:           "emphasis"><em>distfile</em></span>) must be brought to
                   10180:           the local system and then extracted. After any patches to
                   10181:           compile properly on NetBSD are applied, the software can
                   10182:           be configured, then built (usually by compiling), and
                   10183:           finally the generated binaries, etc. can be put into
                   10184:           place on the system. These are exactly the steps
                   10185:           performed by the NetBSD package system, which is
                   10186:           implemented as a series of targets in a central Makefile,
                   10187:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10188:           class="filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
                   10189:         </div>
1.1       grant    10190: 
1.57      minskim  10191:         <div class="sect1" lang="en">
1.1       grant    10192:           <div class="titlepage">
                   10193:             <div>
                   10194:               <div>
                   10195:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10196:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10197:               </div>
                   10198:             </div>
                   10199:           </div>
                   10200: 
                   10201:           <p>Before outlining the process performed by the NetBSD
                   10202:           package system in the next section, here's a brief
                   10203:           discussion on where programs are installed, and which
                   10204:           variables influence this.</p>
                   10205: 
1.14      xtraeme  10206:           <p>The automatic variable <code class=
                   10207:           "varname">PREFIX</code> indicates where all files of the
                   10208:           final program shall be installed. It is usually set to
1.45      wiz      10209:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10210:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10211:           "filename">/usr/pkg</code>), or <code class=
                   10212:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10213:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10214:           The value of <code class="varname">PREFIX</code> needs to
                   10215:           be put into the various places in the program's source
                   10216:           where paths to these files are encoded. See <a href=
1.1       grant    10217:           "#components.patches" title=
1.38      dillo    10218:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10219:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10220:           title=
1.38      dillo    10221:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    10222:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10223:           details.</p>
                   10224: 
                   10225:           <p>When choosing which of these variables to use, follow
                   10226:           the following rules:</p>
                   10227: 
                   10228:           <div class="itemizedlist">
                   10229:             <ul type="disc">
                   10230:               <li>
1.14      xtraeme  10231:                 <p><code class="varname">PREFIX</code> always
                   10232:                 points to the location where the current pkg will
                   10233:                 be installed. When referring to a pkg's own
1.1       grant    10234:                 installation path, use &#8220;<span class=
                   10235:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10236:               </li>
                   10237: 
                   10238:               <li>
1.14      xtraeme  10239:                 <p><code class="varname">LOCALBASE</code> is where
                   10240:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10241:                 construct a -I or -L argument to the compiler to
                   10242:                 find includes and libraries installed by another
                   10243:                 non-X11 pkg, use &#8220;<span class=
                   10244:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10245:               </li>
                   10246: 
                   10247:               <li>
1.14      xtraeme  10248:                 <p><code class="varname">X11BASE</code> is where
                   10249:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10250:                 installed. When looking for <span class=
                   10251:                 "emphasis"><em>standard</em></span> X11 includes
                   10252:                 (not those installed by a pkg), use
                   10253:                 &#8220;<span class=
                   10254:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10255:               </li>
                   10256: 
                   10257:               <li>
1.47      reed     10258:                 <p>X11-based packages are special in that they may
                   10259:                 be installed in either <code class=
1.14      xtraeme  10260:                 "varname">X11BASE</code> or <code class=
                   10261:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10262: 
                   10263:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10264:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10265:                 possible. Note that you will need to include
1.45      wiz      10266:                 <code xmlns=
                   10267:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10268:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10269:                 them to request the presence of X11 and to get the
                   10270:                 right compilation flags.</p>
1.1       grant    10271: 
                   10272:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10273:                 be installed under <code class=
                   10274:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10275:                 app-defaults files. These packages are special and
1.14      xtraeme  10276:                 they must be placed under <code class=
                   10277:                 "varname">X11BASE</code>. To accomplish this, set
                   10278:                 either <code class="varname">USE_X11BASE</code> or
                   10279:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10280:                 package.</p>
                   10281: 
1.34      wiz      10282:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10283:                 libraries installed by a pkg that has <code class=
                   10284:                 "varname">USE_IMAKE</code> or <code class=
                   10285:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10286:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10287:                 class="filename">Makefile</code>, you need to look
                   10288:                 in <span class="emphasis"><em>both</em></span>
                   10289:                 <code xmlns=
                   10290:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10291:                 "filename">${X11BASE}</code> and <code xmlns=
                   10292:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10293:                 "filename">${LOCALBASE}</code>. To force
                   10294:                 installation of all X11 packages in <code class=
                   10295:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10296:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10297:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10298:                 target="_top"><code xmlns="" class=
                   10299:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10300:                 enabled by default.</p>
1.1       grant    10301:               </li>
                   10302: 
                   10303:               <li>
1.14      xtraeme  10304:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10305:                 used to refer to the installed location of an X11
1.14      xtraeme  10306:                 package. <code class="varname">X11PREFIX</code>
                   10307:                 will be set to <code class="varname">X11BASE</code>
                   10308:                 if xpkgwedge is not installed, and to <code class=
                   10309:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10310:                 installed.</p>
                   10311:               </li>
                   10312: 
                   10313:               <li>
                   10314:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10315:                 have some packages installed in <code class=
                   10316:                 "varname">X11BASE</code> and some in <code class=
                   10317:                 "varname">LOCALBASE</code>. To determine the prefix
                   10318:                 of an installed package, the <code class=
                   10319:                 "varname">EVAL_PREFIX</code> definition can be
                   10320:                 used. It takes pairs in the format
                   10321:                 &#8220;<span class=
1.1       grant    10322:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10323:                 the <a href=
                   10324:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10325:                 <span class="citerefentry"><span class=
                   10326:                 "refentrytitle">make</span>(1)</span></a> variable
                   10327:                 <code class="varname">DIRNAME</code> will be set to
                   10328:                 the prefix of the installed package
                   10329:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10330:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10331:                 is not installed.</p>
                   10332: 
                   10333:                 <p>This is best illustrated by example.</p>
                   10334: 
1.45      wiz      10335:                 <p>The following lines are taken from <code xmlns=
                   10336:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10337:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10338:                 <pre class="programlisting">
1.51      rillig   10339:     EVAL_PREFIX+=           GTKDIR=gtk+
                   10340:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10341:                             --with-gtk-prefix="${GTKDIR}"           \
                   10342:                             --enable-multibyte
1.1       grant    10343: </pre>
                   10344: 
                   10345:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10346:                 packages evaluated using <code class=
                   10347:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10348:                 of the form:</p>
                   10349:                 <pre class="programlisting">
1.51      rillig   10350:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10351: </pre>
                   10352: 
1.14      xtraeme  10353:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10354:                 corresponds to the first definition in the
1.14      xtraeme  10355:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10356:               </li>
                   10357: 
                   10358:               <li>
1.45      wiz      10359:                 <p>Within <code xmlns=
                   10360:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10361:                 "filename">${PREFIX}</code>, packages should
                   10362:                 install files according to <a href=
1.24      wiz      10363:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10364:                 <span class="citerefentry"><span class=
                   10365:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10366:                 exception that manual pages go into <code xmlns=
                   10367:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10368:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10369:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10370:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10371:               </li>
                   10372:             </ul>
                   10373:           </div>
                   10374:         </div>
                   10375: 
1.57      minskim  10376:         <div class="sect1" lang="en">
1.1       grant    10377:           <div class="titlepage">
                   10378:             <div>
                   10379:               <div>
                   10380:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10381:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10382:                 during the build process</h2>
1.1       grant    10383:               </div>
                   10384:             </div>
                   10385:           </div>
                   10386: 
1.56      rillig   10387:           <p>When building a package, a number of directories is
                   10388:           used to store source files, temporary files,
                   10389:           pkgsrc-internal files, and so on. These directories are
                   10390:           explained here.</p>
                   10391: 
                   10392:           <p>Some of the directory variables contain relative
                   10393:           pathnames. There are two common base directories for
                   10394:           these relative directories: <code class=
                   10395:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10396:           directories that are pkgsrc-specific. <code class=
                   10397:           "varname">WRKSRC</code> is used for directories inside
                   10398:           the package itself. The permissions after each variable
                   10399:           indicate whether the variable may be changed by the
                   10400:           package Makefile.</p>
1.1       grant    10401: 
                   10402:           <div class="variablelist">
                   10403:             <dl>
1.56      rillig   10404:               <dt><span class="term"><code class=
                   10405:               "varname">PKGSRCDIR</code> (read-only)</span></dt>
                   10406: 
                   10407:               <dd>
                   10408:                 <p>This is an absolute pathname that points to the
                   10409:                 pkgsrc root directory. Generally, you don't need
                   10410:                 it.</p>
                   10411:               </dd>
                   10412: 
                   10413:               <dt><span class="term"><code class=
                   10414:               "varname">PKGPATH</code> (read-only)</span></dt>
1.1       grant    10415: 
                   10416:               <dd>
1.56      rillig   10417:                 <p>This is a pathname relative to <code class=
                   10418:                 "varname">PKGSRCDIR</code> that points to the
                   10419:                 current package.</p>
                   10420:               </dd>
                   10421: 
                   10422:               <dt><span class="term"><code class=
                   10423:               "varname">WRKDIR</code> (read-only)</span></dt>
                   10424: 
                   10425:               <dd>
                   10426:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10427:                 directory where all work takes place. The distfiles
                   10428:                 are extraced to this directory. It also contains
                   10429:                 temporary directories and log files used by the
                   10430:                 various pkgsrc frameworks, like <span class=
                   10431:                 "emphasis"><em>buildlink</em></span> or the
                   10432:                 <span class=
1.56      rillig   10433:                 "emphasis"><em>wrappers</em></span>.</p>
                   10434:               </dd>
                   10435: 
                   10436:               <dt><span class="term"><code class=
                   10437:               "varname">WRKSRC</code> (read-write)</span></dt>
                   10438: 
                   10439:               <dd>
                   10440:                 <p>This is an absolute pathname pointing to the
                   10441:                 directory where the distfiles are extracted. It is
                   10442:                 usually a direct subdirectory of <code class=
                   10443:                 "varname">WRKDIR</code>, and often it's the only
                   10444:                 directory entry that isn't hidden.</p>
                   10445:               </dd>
                   10446:             </dl>
                   10447:           </div>
                   10448:         </div>
                   10449: 
1.57      minskim  10450:         <div class="sect1" lang="en">
1.56      rillig   10451:           <div class="titlepage">
                   10452:             <div>
                   10453:               <div>
                   10454:                 <h2 class="title" style="clear: both"><a name=
                   10455:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10456:               </div>
                   10457:             </div>
                   10458:           </div>
                   10459: 
                   10460:           <p>You can run a particular phase by typing
                   10461:           <span><strong class="command">make phase</strong></span>,
                   10462:           where <span class="emphasis"><em>phase</em></span> is the
                   10463:           name of the phase. This will automatically run all phases
                   10464:           that are required for this phase. The default phase is
                   10465:           <code class="varname">build</code>, that is, when you run
                   10466:           <span><strong class="command">make</strong></span>
                   10467:           without parameters in a package directory, the package
                   10468:           will be built, but not installed.</p>
                   10469:         </div>
                   10470: 
1.57      minskim  10471:         <div class="sect1" lang="en">
1.56      rillig   10472:           <div class="titlepage">
                   10473:             <div>
                   10474:               <div>
                   10475:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  10476:                 "build.fetch"></a>14.5.&nbsp;The <span class=
                   10477:                 "emphasis"><em>fetch</em></span> phase</h2>
1.56      rillig   10478:               </div>
                   10479:             </div>
                   10480:           </div>
                   10481: 
                   10482:           <p>This will check if the file(s) given in the variables
                   10483:           <code class="varname">DISTFILES</code> and <code class=
                   10484:           "varname">PATCHFILES</code> (as defined in the package's
                   10485:           Makefile) are present on the local system in <code xmlns=
                   10486:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10487:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   10488:           present, an attempt will be made to fetch them using
                   10489:           commands of the form:</p>
                   10490:           <pre class="programlisting">
1.51      rillig   10491:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    10492: </pre>
                   10493: 
1.56      rillig   10494:           <p>where ${site} varies through several possibilities in
                   10495:           turn: first, <code class=
                   10496:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   10497:           sites specified in either <code class=
                   10498:           "varname">SITES_file</code> if defined, else <code class=
                   10499:           "varname">MASTER_SITES</code> or <code class=
                   10500:           "varname">PATCH_SITES</code>, as applies, then finally
                   10501:           the value of <code class=
                   10502:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   10503:           except the first can be optionally sorted by the user,
                   10504:           via setting either <code class=
                   10505:           "varname">MASTER_SORT_AWK</code> or <code class=
                   10506:           "varname">MASTER_SORT_REGEX</code>.</p>
                   10507:         </div>
                   10508: 
1.57      minskim  10509:         <div class="sect1" lang="en">
1.56      rillig   10510:           <div class="titlepage">
                   10511:             <div>
                   10512:               <div>
                   10513:                 <h2 class="title" style="clear: both"><a name=
                   10514:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   10515:                 "emphasis"><em>checksum</em></span> phase</h2>
                   10516:               </div>
                   10517:             </div>
                   10518:           </div>
                   10519: 
                   10520:           <p>After the distfile(s) are fetched, their checksum is
                   10521:           generated and compared with the checksums stored in the
                   10522:           distinfo file. If the checksums don't match, the build is
                   10523:           aborted. This is to ensure the same distfile is used for
                   10524:           building, and that the distfile wasn't changed, e.g. by
                   10525:           some malign force, deliberately changed distfiles on the
                   10526:           master distribution site or network lossage.</p>
                   10527:         </div>
                   10528: 
1.57      minskim  10529:         <div class="sect1" lang="en">
1.56      rillig   10530:           <div class="titlepage">
                   10531:             <div>
                   10532:               <div>
                   10533:                 <h2 class="title" style="clear: both"><a name=
                   10534:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   10535:                 "emphasis"><em>extract</em></span> phase</h2>
                   10536:               </div>
                   10537:             </div>
                   10538:           </div>
                   10539: 
                   10540:           <p>When the distfiles are present on the local system,
                   10541:           they need to be extracted, as they are usually in the
                   10542:           form of some compressed archive format, most commonly
                   10543:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10544:           class="filename">.tar.gz</code>.</p>
1.1       grant    10545: 
1.56      rillig   10546:           <p>If only some of the distfiles need to be uncompressed,
                   10547:           the files to be uncompressed should be put into
                   10548:           <code class="varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10549: 
1.56      rillig   10550:           <p>If the distfiles are not in <code xmlns=
                   10551:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10552:           "filename">.tar.gz</code> format, they can be extracted
                   10553:           by setting either <code class=
                   10554:           "varname">EXTRACT_SUFX</code>, or <code class=
                   10555:           "varname">EXTRACT_CMD</code>, <code class=
                   10556:           "varname">EXTRACT_BEFORE_ARGS</code> and <code class=
                   10557:           "varname">EXTRACT_AFTER_ARGS</code>. In the former case,
                   10558:           pkgsrc knows how to extract a number of suffixes
                   10559:           (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10560:           class="filename">.tar.gz</code>, <code xmlns=
                   10561:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10562:           "filename">.tgz</code>, <code xmlns=
                   10563:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10564:           "filename">.tar.gz2</code>, <code xmlns=
                   10565:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10566:           "filename">.tbz</code>, <code xmlns=
                   10567:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10568:           "filename">.tar.Z</code>, <code xmlns=
                   10569:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10570:           "filename">.tar</code>, <code xmlns=
                   10571:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10572:           "filename">.shar.gz</code>, <code xmlns=
                   10573:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10574:           "filename">.shar.bz2</code>, <code xmlns=
                   10575:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10576:           "filename">.shar.Z</code>, <code xmlns=
                   10577:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10578:           "filename">.shar</code>, <code xmlns=
                   10579:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10580:           "filename">.Z</code>, <code xmlns=
                   10581:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10582:           "filename">.bz2</code> and <code xmlns=
                   10583:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10584:           "filename">.gz</code>; see the definition of the various
                   10585:           <code class="varname">DECOMPRESS_CMD</code> variables in
                   10586:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10587:           class="filename">bsd.pkg.extract.mk</code> for a complete
                   10588:           list). Here's an example on how to use the other
                   10589:           variables for a program that comes with a compressed
                   10590:           shell archive whose name ends in <code xmlns=
                   10591:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10592:           "filename">.msg.gz</code>:</p>
                   10593:           <pre class="programlisting">
1.51      rillig   10594:     EXTRACT_SUFX=           .msg.gz
                   10595:     EXTRACT_CMD=            zcat
                   10596:     EXTRACT_BEFORE_ARGS=
                   10597:     EXTRACT_AFTER_ARGS=     |sh
1.1       grant    10598: </pre>
1.56      rillig   10599:         </div>
                   10600: 
1.57      minskim  10601:         <div class="sect1" lang="en">
1.56      rillig   10602:           <div class="titlepage">
                   10603:             <div>
                   10604:               <div>
                   10605:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  10606:                 "build.patch"></a>14.8.&nbsp;The <span class=
                   10607:                 "emphasis"><em>patch</em></span> phase</h2>
1.56      rillig   10608:               </div>
                   10609:             </div>
                   10610:           </div>
                   10611: 
                   10612:           <p>After extraction, all the patches named by the
                   10613:           <code class="varname">PATCHFILES</code>, those present in
                   10614:           the patches subdirectory of the package as well as in
                   10615:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   10616:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10617:           "filename">/usr/local/patches/graphics/png</code>) are
                   10618:           applied. Patchfiles ending in <code xmlns=
                   10619:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10620:           "filename">.Z</code> or <code xmlns=
                   10621:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10622:           "filename">.gz</code> are uncompressed before they are
                   10623:           applied, files ending in <code xmlns=
                   10624:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10625:           "filename">.orig</code> or <code xmlns=
                   10626:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10627:           "filename">.rej</code> are ignored. Any special options
                   10628:           to <a href=
                   10629:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10630:           <span class="citerefentry"><span class=
                   10631:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   10632:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   10633:           <a href="#components.patches" title=
                   10634:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   10635:           &#8220;patches/*&#8221;</a> for more details.</p>
                   10636: 
                   10637:           <p>By default <a href=
                   10638:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10639:           <span class="citerefentry"><span class=
                   10640:           "refentrytitle">patch</span>(1)</span></a> is given
                   10641:           special args to make it fail if the patches apply with
                   10642:           some lines of fuzz. Please fix (regen) the patches so
                   10643:           that they apply cleanly. The rationale behind this is
                   10644:           that patches that don't apply cleanly may end up being
                   10645:           applied in the wrong place, and cause severe harm
                   10646:           there.</p>
                   10647:         </div>
                   10648: 
1.57      minskim  10649:         <div class="sect1" lang="en">
1.56      rillig   10650:           <div class="titlepage">
                   10651:             <div>
                   10652:               <div>
                   10653:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  10654:                 "build.tools"></a>14.9.&nbsp;The <span class=
                   10655:                 "emphasis"><em>tools</em></span> phase</h2>
1.56      rillig   10656:               </div>
                   10657:             </div>
                   10658:           </div>
                   10659: 
                   10660:           <p>[TODO]</p>
                   10661:         </div>
                   10662: 
1.57      minskim  10663:         <div class="sect1" lang="en">
1.56      rillig   10664:           <div class="titlepage">
                   10665:             <div>
                   10666:               <div>
                   10667:                 <h2 class="title" style="clear: both"><a name=
                   10668:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   10669:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   10670:               </div>
                   10671:             </div>
                   10672:           </div>
                   10673: 
                   10674:           <p>[TODO]</p>
                   10675:         </div>
                   10676: 
1.57      minskim  10677:         <div class="sect1" lang="en">
1.56      rillig   10678:           <div class="titlepage">
                   10679:             <div>
                   10680:               <div>
                   10681:                 <h2 class="title" style="clear: both"><a name=
                   10682:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   10683:                 "emphasis"><em>configure</em></span> phase</h2>
                   10684:               </div>
                   10685:             </div>
                   10686:           </div>
                   10687: 
                   10688:           <p>Most pieces of software need information on the header
                   10689:           files, system calls, and library routines which are
                   10690:           available on the platform they run on. The process of
                   10691:           determining this information is known as configuration,
                   10692:           and is usually automated. In most cases, a script is
                   10693:           supplied with the distfiles, and its invocation results
                   10694:           in generation of header files, Makefiles, etc.</p>
                   10695: 
                   10696:           <p>If the package contains a configure script, this can
                   10697:           be invoked by setting <code class=
                   10698:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   10699:           "quote">yes</span>&#8221;. If the configure script is a
                   10700:           GNU autoconf script, you should set <code class=
                   10701:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   10702:           "quote">yes</span>&#8221; instead. What happens in the
                   10703:           <span class="emphasis"><em>configure</em></span> phase is
                   10704:           roughly:</p>
                   10705:           <pre class="programlisting">
                   10706:     .for d in ${CONFIGURE_DIRS}
                   10707:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   10708:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   10709:     .endfor
                   10710: </pre>
1.1       grant    10711: 
1.56      rillig   10712:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   10713:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10714:           pathnames relative to <code class=
                   10715:           "varname">WRKSRC</code>. In each of these directories,
                   10716:           the configure script is run with the environment
                   10717:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   10718:           <code class="varname">CONFIGURE_ARGS</code>. The
                   10719:           variables <code class="varname">CONFIGURE_ENV</code>,
                   10720:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   10721:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   10722:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   10723:           changed by the package.</p>
1.1       grant    10724: 
1.56      rillig   10725:           <p>If the program uses an <code xmlns=
                   10726:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10727:           "filename">Imakefile</code> for configuration, the
                   10728:           appropriate steps can be invoked by setting <code class=
                   10729:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   10730:           "quote">yes</span>&#8221;. (If you only want the package
                   10731:           installed in <code class="varname">${X11PREFIX}</code>
                   10732:           but xmkmf not being run, set <code class=
                   10733:           "varname">USE_X11BASE</code> instead.)</p>
                   10734:         </div>
1.1       grant    10735: 
1.57      minskim  10736:         <div class="sect1" lang="en">
1.56      rillig   10737:           <div class="titlepage">
                   10738:             <div>
                   10739:               <div>
                   10740:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  10741:                 "build.build"></a>14.12.&nbsp;The <span class=
                   10742:                 "emphasis"><em>build</em></span> phase</h2>
1.56      rillig   10743:               </div>
                   10744:             </div>
1.1       grant    10745:           </div>
                   10746: 
1.56      rillig   10747:           <p>For building a package, a rough equivalent of the
                   10748:           following code is executed.</p>
1.1       grant    10749:           <pre class="programlisting">
1.56      rillig   10750:     .for d in ${BUILD_DIRS}
                   10751:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   10752:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   10753:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   10754:     .endfor
1.1       grant    10755: </pre>
1.56      rillig   10756: 
                   10757:           <p><code class="varname">BUILD_DIRS</code> (default:
                   10758:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   10759:           pathnames relative to <code class=
                   10760:           "varname">WRKSRC</code>. In each of these directories,
                   10761:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   10762:           environment <code class="varname">MAKE_ENV</code> and
                   10763:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   10764:           The variables <code class="varname">MAKE_ENV</code>,
                   10765:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   10766:           <code class="varname">MAKEFILE</code> and <code class=
                   10767:           "varname">BUILD_TARGET</code> may all be changed by the
                   10768:           package.</p>
                   10769: 
                   10770:           <p>The default value of <code class=
                   10771:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   10772:           "quote">gmake</span>&#8221; if <code class=
                   10773:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   10774:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   10775:           "quote">make</span>&#8221; otherwise. The default value
                   10776:           of <code class="varname">MAKEFILE</code> is
                   10777:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   10778:           <code class="varname">BUILD_TARGET</code> defaults to
                   10779:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   10780:         </div>
                   10781: 
1.57      minskim  10782:         <div class="sect1" lang="en">
1.56      rillig   10783:           <div class="titlepage">
                   10784:             <div>
                   10785:               <div>
                   10786:                 <h2 class="title" style="clear: both"><a name=
1.57      minskim  10787:                 "build.test"></a>14.13.&nbsp;The <span class=
                   10788:                 "emphasis"><em>test</em></span> phase</h2>
1.56      rillig   10789:               </div>
                   10790:             </div>
                   10791:           </div>
                   10792: 
                   10793:           <p>[TODO]</p>
                   10794:         </div>
                   10795: 
1.57      minskim  10796:         <div class="sect1" lang="en">
1.56      rillig   10797:           <div class="titlepage">
                   10798:             <div>
                   10799:               <div>
                   10800:                 <h2 class="title" style="clear: both"><a name=
                   10801:                 "build.install"></a>14.14.&nbsp;The <span class=
                   10802:                 "emphasis"><em>install</em></span> phase</h2>
                   10803:               </div>
                   10804:             </div>
                   10805:           </div>
                   10806: 
                   10807:           <p>Once the build stage has completed, the final step is
                   10808:           to install the software in public directories, so users
                   10809:           can access the programs and files. As in the
                   10810:           build-target, <code class="varname">$MAKE_PROGRAM</code>
                   10811:           is invoked on <code class="varname">$MAKEFILE</code>
                   10812:           here, but with the <code class=
                   10813:           "varname">$INSTALL_TARGET</code> instead, the latter
                   10814:           defaulting to &#8220;<span class=
                   10815:           "quote">install</span>&#8221; (plus &#8220;<span class=
                   10816:           "quote">install.man</span>&#8221;, if <code class=
                   10817:           "varname">USE_IMAKE</code> is set).</p>
                   10818:         </div>
                   10819: 
1.57      minskim  10820:         <div class="sect1" lang="en">
1.56      rillig   10821:           <div class="titlepage">
                   10822:             <div>
                   10823:               <div>
                   10824:                 <h2 class="title" style="clear: both"><a name=
                   10825:                 "build.package"></a>14.15.&nbsp;The <span class=
                   10826:                 "emphasis"><em>package</em></span> phase</h2>
                   10827:               </div>
                   10828:             </div>
                   10829:           </div>
                   10830: 
                   10831:           <p>[TODO]</p>
1.1       grant    10832:         </div>
                   10833: 
1.57      minskim  10834:         <div class="sect1" lang="en">
1.1       grant    10835:           <div class="titlepage">
                   10836:             <div>
                   10837:               <div>
                   10838:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10839:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    10840:                 helpful targets</h2>
                   10841:               </div>
                   10842:             </div>
                   10843:           </div>
                   10844: 
                   10845:           <div class="variablelist">
                   10846:             <dl>
                   10847:               <dt><span class="term">pre/post-*</span></dt>
                   10848: 
                   10849:               <dd>
                   10850:                 <p>For any of the main targets described in the
                   10851:                 previous section, two auxiliary targets exist with
                   10852:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   10853:                 &#8220;<span class="quote">post-</span>&#8221; used
                   10854:                 as a prefix for the main target's name. These
                   10855:                 targets are invoked before and after the main
                   10856:                 target is called, allowing extra configuration or
                   10857:                 installation steps be performed from a package's
                   10858:                 Makefile, for example, which a program's configure
                   10859:                 script or install target omitted.</p>
                   10860:               </dd>
                   10861: 
                   10862:               <dt><span class="term">do-*</span></dt>
                   10863: 
                   10864:               <dd>
                   10865:                 <p>Should one of the main targets do the wrong
                   10866:                 thing, and should there be no variable to fix this,
                   10867:                 you can redefine it with the do-* target. (Note
                   10868:                 that redefining the target itself instead of the
                   10869:                 do-* target is a bad idea, as the pre-* and post-*
                   10870:                 targets won't be called anymore, etc.) You will not
                   10871:                 usually need to do this.</p>
                   10872:               </dd>
                   10873: 
                   10874:               <dt><span class="term">reinstall</span></dt>
                   10875: 
                   10876:               <dd>
1.14      xtraeme  10877:                 <p>If you did a <span><strong class="command">make
                   10878:                 install</strong></span> and you noticed some file
                   10879:                 was not installed properly, you can repeat the
1.1       grant    10880:                 installation with this target, which will ignore
                   10881:                 the &#8220;<span class="quote">already
                   10882:                 installed</span>&#8221; flag.</p>
                   10883:               </dd>
                   10884: 
                   10885:               <dt><span class="term">deinstall</span></dt>
                   10886: 
                   10887:               <dd>
1.24      wiz      10888:                 <p>This target does a <a href=
                   10889:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10890:                 <span class="citerefentry"><span class=
                   10891:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   10892:                 the current directory, effectively de-installing
                   10893:                 the package. The following variables can be used to
                   10894:                 tune the behaviour:</p>
1.1       grant    10895: 
                   10896:                 <div class="variablelist">
                   10897:                   <dl>
1.14      xtraeme  10898:                     <dt><span class="term"><code class=
                   10899:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    10900: 
                   10901:                     <dd>
                   10902:                       <p>Add a "-v" to the <a href=
                   10903:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10904:                       <span class="citerefentry"><span class=
                   10905:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10906:                       command.</p>
                   10907:                     </dd>
                   10908: 
1.14      xtraeme  10909:                     <dt><span class="term"><code class=
                   10910:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    10911: 
                   10912:                     <dd>
                   10913:                       <p>Remove all packages that require (depend
                   10914:                       on) the given package. This can be used to
                   10915:                       remove any packages that may have been pulled
                   10916:                       in by a given package, e.g. if
1.14      xtraeme  10917:                       <span><strong class="command">make deinstall
                   10918:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      10919:                       <code xmlns=
                   10920:                       "http://www.w3.org/TR/xhtml1/transitional"
                   10921:                       class="filename">pkgsrc/x11/kde</code>, this
                   10922:                       is likely to remove whole KDE. Works by
1.1       grant    10923:                       adding &#8220;<span class=
                   10924:                       "quote">-R</span>&#8221; to the <a href=
                   10925:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10926:                       <span class="citerefentry"><span class=
                   10927:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10928:                       command line.</p>
                   10929:                     </dd>
                   10930:                   </dl>
                   10931:                 </div>
                   10932:               </dd>
                   10933: 
                   10934:               <dt><span class="term">update</span></dt>
                   10935: 
                   10936:               <dd>
                   10937:                 <p>This target causes the current package to be
                   10938:                 updated to the latest version. The package and all
                   10939:                 depending packages first get de-installed, then
                   10940:                 current versions of the corresponding packages get
                   10941:                 compiled and installed. This is similar to manually
                   10942:                 noting which packages are currently installed, then
1.14      xtraeme  10943:                 performing a series of <span><strong class=
                   10944:                 "command">make deinstall</strong></span> and
                   10945:                 <span><strong class="command">make
                   10946:                 install</strong></span> (or whatever <code class=
                   10947:                 "varname">UPDATE_TARGET</code> is set to) for these
                   10948:                 packages.</p>
1.1       grant    10949: 
                   10950:                 <p>You can use the &#8220;<span class=
                   10951:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  10952:                 package updating in case a previous
                   10953:                 <span><strong class="command">make
                   10954:                 update</strong></span> was interrupted for some
                   10955:                 reason. However, in this case, make sure you don't
                   10956:                 call <span><strong class="command">make
                   10957:                 clean</strong></span> or otherwise remove the list
                   10958:                 of dependent packages in <code class=
1.47      reed     10959:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    10960:                 ability to automatically update the current package
                   10961:                 along with the dependent packages you have
                   10962:                 installed.</p>
                   10963: 
1.14      xtraeme  10964:                 <p>Resuming an interrupted <span><strong class=
                   10965:                 "command">make update</strong></span> will only
                   10966:                 work as long as the package tree remains unchanged.
                   10967:                 If the source code for one of the packages to be
                   10968:                 updated has been changed, resuming
                   10969:                 <span><strong class="command">make
                   10970:                 update</strong></span> will most certainly
                   10971:                 fail!</p>
1.1       grant    10972: 
                   10973:                 <p>The following variables can be used either on
1.45      wiz      10974:                 the command line or in <code xmlns=
                   10975:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10976:                 "filename">/etc/mk.conf</code> to alter the
                   10977:                 behaviour of <span><strong class="command">make
                   10978:                 update</strong></span>:</p>
1.1       grant    10979: 
                   10980:                 <div class="variablelist">
                   10981:                   <dl>
1.14      xtraeme  10982:                     <dt><span class="term"><code class=
                   10983:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    10984: 
                   10985:                     <dd>
                   10986:                       <p>Install target to recursively use for the
                   10987:                       updated package and the dependent packages.
1.14      xtraeme  10988:                       Defaults to <code class=
                   10989:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    10990:                       &#8220;<span class=
                   10991:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  10992:                       <span><strong class="command">make
                   10993:                       update</strong></span>. e.g.
                   10994:                       <span><strong class="command">make update
                   10995:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    10996:                     </dd>
                   10997: 
1.14      xtraeme  10998:                     <dt><span class="term"><code class=
                   10999:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11000: 
                   11001:                     <dd>
                   11002:                       <p>Don't clean up after updating. Useful if
                   11003:                       you want to leave the work sources of the
                   11004:                       updated packages around for inspection or
                   11005:                       other purposes. Be sure you eventually clean
                   11006:                       up the source tree (see the
                   11007:                       &#8220;<span class=
                   11008:                       "quote">clean-update</span>&#8221; target
                   11009:                       below) or you may run into troubles with old
                   11010:                       source code still lying around on your next
1.14      xtraeme  11011:                       <span><strong class=
                   11012:                       "command">make</strong></span> or
                   11013:                       <span><strong class="command">make
                   11014:                       update</strong></span>.</p>
1.1       grant    11015:                     </dd>
                   11016: 
1.14      xtraeme  11017:                     <dt><span class="term"><code class=
                   11018:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11019: 
                   11020:                     <dd>
                   11021:                       <p>Deinstall each package before installing
1.14      xtraeme  11022:                       (making <code class=
                   11023:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11024:                       necessary if the &#8220;<span class=
                   11025:                       "quote">clean-update</span>&#8221; target
                   11026:                       (see below) was called after interrupting a
1.14      xtraeme  11027:                       running <span><strong class="command">make
                   11028:                       update</strong></span>.</p>
1.1       grant    11029:                     </dd>
                   11030: 
1.14      xtraeme  11031:                     <dt><span class="term"><code class=
                   11032:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11033: 
                   11034:                     <dd>
                   11035:                       <p>Allows you to disable recursion and
                   11036:                       hardcode the target for packages. The default
                   11037:                       is &#8220;<span class=
                   11038:                       "quote">update</span>&#8221; for the update
                   11039:                       target, facilitating a recursive update of
1.14      xtraeme  11040:                       prerequisite packages. Only set <code class=
                   11041:                       "varname">DEPENDS_TARGET</code> if you want
                   11042:                       to disable recursive updates. Use
                   11043:                       <code class="varname">UPDATE_TARGET</code>
                   11044:                       instead to just set a specific target for
                   11045:                       each package to be installed during
                   11046:                       <span><strong class="command">make
                   11047:                       update</strong></span> (see above).</p>
1.1       grant    11048:                     </dd>
                   11049:                   </dl>
                   11050:                 </div>
                   11051:               </dd>
                   11052: 
                   11053:               <dt><span class="term">clean-update</span></dt>
                   11054: 
                   11055:               <dd>
                   11056:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11057:                 would get updated if <span><strong class=
                   11058:                 "command">make update</strong></span> was called
                   11059:                 from the current directory. This target should not
                   11060:                 be used if the current package (or any of its
                   11061:                 depending packages) have already been de-installed
                   11062:                 (e.g., after calling <span><strong class=
                   11063:                 "command">make update</strong></span>) or you may
                   11064:                 lose some packages you intended to update. As a
                   11065:                 rule of thumb: only use this target <span class=
                   11066:                 "emphasis"><em>before</em></span> the first time
                   11067:                 you run <span><strong class="command">make
                   11068:                 update</strong></span> and only if you have a dirty
                   11069:                 package tree (e.g., if you used <code class=
                   11070:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11071: 
1.47      reed     11072:                 <p>If you are unsure about whether your tree is
                   11073:                 clean, you can either perform a
1.14      xtraeme  11074:                 <span><strong class="command">make
1.47      reed     11075:                 clean</strong></span> at the top of the tree, or
                   11076:                 use the following sequence of commands from the
                   11077:                 directory of the package you want to update
                   11078:                 (<span class="emphasis"><em>before</em></span>
                   11079:                 running <span><strong class="command">make
1.14      xtraeme  11080:                 update</strong></span> for the first time,
                   11081:                 otherwise you lose all the packages you wanted to
                   11082:                 update!):</p>
1.1       grant    11083:                 <pre class="screen">
1.14      xtraeme  11084: <code class="prompt">#</code> <strong class=
                   11085: "userinput"><code>make clean-update</code></strong>
                   11086: <code class="prompt">#</code> <strong class=
                   11087: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11088: <code class="prompt">#</code> <strong class=
                   11089: "userinput"><code>make update</code></strong>
1.1       grant    11090: </pre>
                   11091: 
                   11092:                 <p>The following variables can be used either on
1.45      wiz      11093:                 the command line or in <code xmlns=
                   11094:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11095:                 "filename">/etc/mk.conf</code> to alter the
                   11096:                 behaviour of <span><strong class="command">make
                   11097:                 clean-update</strong></span>:</p>
1.1       grant    11098: 
                   11099:                 <div class="variablelist">
                   11100:                   <dl>
1.14      xtraeme  11101:                     <dt><span class="term"><code class=
                   11102:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11103: 
                   11104:                     <dd>
1.14      xtraeme  11105:                       <p>After <span><strong class="command">make
                   11106:                       clean</strong></span>, do not reconstruct the
                   11107:                       list of directories to update for this
                   11108:                       package. Only use this if
                   11109:                       <span><strong class="command">make
                   11110:                       update</strong></span> successfully installed
                   11111:                       all packages you wanted to update. Normally,
                   11112:                       this is done automatically on
                   11113:                       <span><strong class="command">make
                   11114:                       update</strong></span>, but may have been
                   11115:                       suppressed by the <code class=
                   11116:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11117:                       above).</p>
                   11118:                     </dd>
                   11119:                   </dl>
                   11120:                 </div>
                   11121:               </dd>
                   11122: 
                   11123:               <dt><span class="term">info</span></dt>
                   11124: 
                   11125:               <dd>
                   11126:                 <p>This target invokes <a href=
                   11127:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11128:                 <span class="citerefentry"><span class=
                   11129:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11130:                 the current package. You can use this to check
                   11131:                 which version of a package is installed.</p>
                   11132:               </dd>
                   11133: 
                   11134:               <dt><span class="term">readme</span></dt>
                   11135: 
                   11136:               <dd>
1.45      wiz      11137:                 <p>This target generates a <code xmlns=
                   11138:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11139:                 "filename">README.html</code> file, which can be
1.1       grant    11140:                 viewed using a browser such as <a xmlns=
                   11141:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11142:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11143:                 target="_top"><code xmlns="" class=
                   11144:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11145:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11146:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11147:                 target="_top"><code xmlns="" class=
                   11148:                 "filename">www/links</code></a>. The generated
                   11149:                 files contain references to any packages which are
                   11150:                 in the <code class="varname">PACKAGES</code>
                   11151:                 directory on the local host. The generated files
                   11152:                 can be made to refer to URLs based on <code class=
1.20      ben      11153:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11154:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11155:                 wanted to generate <code xmlns=
                   11156:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11157:                 "filename">README.html</code> files which pointed
                   11158:                 to binary packages on the local machine, in the
1.45      wiz      11159:                 directory <code xmlns=
                   11160:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11161:                 "filename">/usr/packages</code>, set <code class=
                   11162:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11163:                 and <code class=
                   11164:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11165:                 <code class="varname">${PACKAGES}</code> directory
                   11166:                 and its subdirectories will be searched for all the
                   11167:                 binary packages.</p>
1.1       grant    11168:               </dd>
                   11169: 
                   11170:               <dt><span class="term">readme-all</span></dt>
                   11171: 
                   11172:               <dd>
1.45      wiz      11173:                 <p>Use this target to create a file <code xmlns=
                   11174:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11175:                 "filename">README-all.html</code> which contains a
1.1       grant    11176:                 list of all packages currently available in the
                   11177:                 NetBSD Packages Collection, together with the
                   11178:                 category they belong to and a short description.
1.45      wiz      11179:                 This file is compiled from the <code xmlns=
                   11180:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11181:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11182:                 sure to run this <span class=
1.14      xtraeme  11183:                 "emphasis"><em>after</em></span> a
                   11184:                 <span><strong class="command">make
                   11185:                 readme</strong></span>.</p>
1.1       grant    11186:               </dd>
                   11187: 
                   11188:               <dt><span class="term">cdrom-readme</span></dt>
                   11189: 
                   11190:               <dd>
                   11191:                 <p>This is very much the same as the
                   11192:                 &#8220;<span class="quote">readme</span>&#8221;
                   11193:                 target (see above), but is to be used when
                   11194:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11195:                 This target also produces <code xmlns=
                   11196:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11197:                 "filename">README.html</code> files, and can be
                   11198:                 made to refer to URLs based on <code class=
                   11199:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11200:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11201:               </dd>
                   11202: 
                   11203:               <dt><span class="term">show-distfiles</span></dt>
                   11204: 
                   11205:               <dd>
                   11206:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11207:                 are needed to build the package. (<code class=
                   11208:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11209:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11210:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11211:                 "filename">patches/*</code>)</p>
1.1       grant    11212:               </dd>
                   11213: 
                   11214:               <dt><span class="term">show-downlevel</span></dt>
                   11215: 
                   11216:               <dd>
                   11217:                 <p>This target shows nothing if the package is not
                   11218:                 installed. If a version of this package is
                   11219:                 installed, but is not the version provided in this
                   11220:                 version of pkgsrc, then a warning message is
                   11221:                 displayed. This target can be used to show which of
                   11222:                 your installed packages are downlevel, and so the
                   11223:                 old versions can be deleted, and the current ones
                   11224:                 added.</p>
                   11225:               </dd>
                   11226: 
                   11227:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11228: 
                   11229:               <dd>
                   11230:                 <p>This target shows the directory in the pkgsrc
                   11231:                 hierarchy from which the package can be built and
                   11232:                 installed. This may not be the same directory as
                   11233:                 the one from which the package was installed. This
                   11234:                 target is intended to be used by people who may
                   11235:                 wish to upgrade many packages on a single host, and
                   11236:                 can be invoked from the top-level pkgsrc Makefile
                   11237:                 by using the &#8220;<span class=
                   11238:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11239:                 target.</p>
                   11240:               </dd>
                   11241: 
                   11242:               <dt><span class=
                   11243:               "term">show-installed-depends</span></dt>
                   11244: 
                   11245:               <dd>
                   11246:                 <p>This target shows which installed packages match
1.14      xtraeme  11247:                 the current package's <code class=
                   11248:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11249:                 dependencies are causing build problems.</p>
                   11250:               </dd>
                   11251: 
                   11252:               <dt><span class="term">check-shlibs</span></dt>
                   11253: 
                   11254:               <dd>
                   11255:                 <p>After a package is installed, check all its
                   11256:                 binaries and (on ELF platforms) shared libraries to
                   11257:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11258:                 default if <code class=
                   11259:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11260:                 <code xmlns=
                   11261:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11262:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11263:               </dd>
                   11264: 
                   11265:               <dt><span class="term">print-PLIST</span></dt>
                   11266: 
                   11267:               <dd>
                   11268:                 <p>After a &#8220;<span class="quote">make
                   11269:                 install</span>&#8221; from a new or upgraded pkg,
                   11270:                 this prints out an attempt to generate a new
1.45      wiz      11271:                 <code xmlns=
                   11272:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11273:                 "filename">PLIST</code> from a <span><strong class=
                   11274:                 "command">find -newer
1.14      xtraeme  11275:                 work/.extract_done</strong></span>. An attempt is
                   11276:                 made to care for shared libs etc., but it is
1.1       grant    11277:                 <span class="emphasis"><em>strongly</em></span>
                   11278:                 recommended to review the result before putting it
1.45      wiz      11279:                 into <code xmlns=
                   11280:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11281:                 "filename">PLIST</code>. On upgrades, it's useful
                   11282:                 to diff the output of this command against an
                   11283:                 already existing <code xmlns=
                   11284:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11285:                 "filename">PLIST</code> file.</p>
1.1       grant    11286: 
1.24      wiz      11287:                 <p>If the package installs files via <a href=
                   11288:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11289:                 <span class="citerefentry"><span class=
                   11290:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11291:                 methods that don't update file access times, be
                   11292:                 sure to add these files manually to your
1.45      wiz      11293:                 <code xmlns=
                   11294:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11295:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11296:                 "quote">find -newer</span>&#8221; command used by
                   11297:                 this target won't catch them!</p>
1.1       grant    11298: 
                   11299:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11300:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11301:                 &#8220;Tweaking output of <span><strong class=
                   11302:                 "command">make
                   11303:                 print-PLIST</strong></span>&#8221;</a> for more
                   11304:                 information on this target.</p>
1.1       grant    11305:               </dd>
                   11306: 
                   11307:               <dt><span class="term">bulk-package</span></dt>
                   11308: 
                   11309:               <dd>
                   11310:                 <p>Used to do bulk builds. If an appropriate binary
                   11311:                 package already exists, no action is taken. If not,
                   11312:                 this target will compile, install and package it
1.47      reed     11313:                 (and its depends, if <code class=
1.14      xtraeme  11314:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11315:                 <a href="#binary.configuration" title=
1.38      dillo    11316:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     11317:                 &#8220;Configuration&#8221;</a>). After creating
                   11318:                 the binary package, the sources, the just-installed
                   11319:                 package and its required packages are removed,
1.1       grant    11320:                 preserving free disk space.</p>
                   11321: 
                   11322:                 <p><span class="emphasis"><em>Beware that this
                   11323:                 target may deinstall all packages installed on a
                   11324:                 system!</em></span></p>
                   11325:               </dd>
                   11326: 
                   11327:               <dt><span class="term">bulk-install</span></dt>
                   11328: 
                   11329:               <dd>
                   11330:                 <p>Used during bulk-installs to install required
1.47      reed     11331:                 packages. If an up-to-date binary package is
1.1       grant    11332:                 available, it will be installed via <a href=
                   11333:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11334:                 <span class="citerefentry"><span class=
                   11335:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  11336:                 not, <span><strong class="command">make
                   11337:                 bulk-package</strong></span> will be executed, but
1.47      reed     11338:                 the installed binary won't be removed.</p>
1.1       grant    11339: 
                   11340:                 <p>A binary package is considered
1.47      reed     11341:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    11342:                 to be installed via <a href=
                   11343:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   11344:                 <span class="citerefentry"><span class=
                   11345:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   11346:                 if:</p>
                   11347: 
                   11348:                 <div class="itemizedlist">
                   11349:                   <ul type="disc">
                   11350:                     <li>
1.45      wiz      11351:                       <p>None of the package's files (<code xmlns=
                   11352:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11353:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  11354:                       modified since it was built.</p>
1.1       grant    11355:                     </li>
                   11356: 
                   11357:                     <li>
                   11358:                       <p>None of the package's required (binary)
                   11359:                       packages were modified since it was
                   11360:                       built.</p>
                   11361:                     </li>
                   11362:                   </ul>
                   11363:                 </div>
                   11364: 
                   11365:                 <p><span class="emphasis"><em>Beware that this
                   11366:                 target may deinstall all packages installed on a
                   11367:                 system!</em></span></p>
                   11368:               </dd>
                   11369:             </dl>
                   11370:           </div>
                   11371:         </div>
                   11372:       </div>
                   11373: 
1.57      minskim  11374:       <div class="chapter" lang="en">
1.1       grant    11375:         <div class="titlepage">
                   11376:           <div>
                   11377:             <div>
1.57      minskim  11378:               <h2 class="title"><a name=
1.55      rillig   11379:               "fixes"></a>Chapter&nbsp;15.&nbsp;Making your package
                   11380:               work</h2>
1.1       grant    11381:             </div>
                   11382:           </div>
                   11383:         </div>
                   11384: 
                   11385:         <div class="toc">
                   11386:           <p><b>Table of Contents</b></p>
                   11387: 
                   11388:           <dl>
1.30      wiz      11389:             <dt><span class="sect1"><a href=
1.38      dillo    11390:             "#general-operation">15.1. General
1.30      wiz      11391:             operation</a></span></dt>
1.1       grant    11392: 
                   11393:             <dd>
                   11394:               <dl>
                   11395:                 <dt><span class="sect2"><a href=
1.38      dillo    11396:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      11397:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    11398: 
                   11399:                 <dt><span class="sect2"><a href=
1.38      dillo    11400:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      11401:                 install documentation</a></span></dt>
                   11402: 
                   11403:                 <dt><span class="sect2"><a href=
1.38      dillo    11404:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    11405:                 packages</a></span></dt>
                   11406: 
                   11407:                 <dt><span class="sect2"><a href=
1.38      dillo    11408:                 "#dependencies">15.1.4. Handling
1.1       grant    11409:                 dependencies</a></span></dt>
                   11410: 
                   11411:                 <dt><span class="sect2"><a href=
1.38      dillo    11412:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    11413:                 packages</a></span></dt>
                   11414: 
                   11415:                 <dt><span class="sect2"><a href=
1.38      dillo    11416:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      11417:                 cannot or should not be built</a></span></dt>
1.1       grant    11418: 
                   11419:                 <dt><span class="sect2"><a href=
1.38      dillo    11420:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      11421:                 should not be deleted, once
                   11422:                 installed</a></span></dt>
1.1       grant    11423: 
                   11424:                 <dt><span class="sect2"><a href=
1.38      dillo    11425:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    11426:                 security problems</a></span></dt>
                   11427: 
                   11428:                 <dt><span class="sect2"><a href=
1.38      dillo    11429:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    11430:                 bugs</a></span></dt>
                   11431: 
                   11432:                 <dt><span class="sect2"><a href=
1.38      dillo    11433:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      11434:                 incrementing versions when fixing an existing
1.1       grant    11435:                 package</a></span></dt>
                   11436: 
                   11437:                 <dt><span class="sect2"><a href=
1.38      dillo    11438:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    11439:                 packages</a></span></dt>
                   11440:               </dl>
                   11441:             </dd>
                   11442: 
1.30      wiz      11443:             <dt><span class="sect1"><a href=
1.38      dillo    11444:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      11445:             issues</a></span></dt>
1.1       grant    11446: 
                   11447:             <dd>
                   11448:               <dl>
                   11449:                 <dt><span class="sect2"><a href=
1.38      dillo    11450:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      11451:                 distfiles aren't available for plain
1.1       grant    11452:                 downloading</a></span></dt>
                   11453: 
                   11454:                 <dt><span class="sect2"><a href=
1.38      dillo    11455:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      11456:                 handle modified distfiles with the 'old'
                   11457:                 name</a></span></dt>
1.1       grant    11458:               </dl>
                   11459:             </dd>
                   11460: 
1.30      wiz      11461:             <dt><span class="sect1"><a href=
1.38      dillo    11462:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      11463:             gotchas</a></span></dt>
1.1       grant    11464: 
                   11465:             <dd>
                   11466:               <dl>
                   11467:                 <dt><span class="sect2"><a href=
1.38      dillo    11468:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    11469:                 libtool</a></span></dt>
                   11470: 
                   11471:                 <dt><span class="sect2"><a href=
1.38      dillo    11472:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      11473:                 packages that already support
                   11474:                 libtool</a></span></dt>
1.1       grant    11475: 
                   11476:                 <dt><span class="sect2"><a href=
1.38      dillo    11477:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    11478:                 Autoconf/Automake</a></span></dt>
                   11479:               </dl>
                   11480:             </dd>
                   11481: 
1.55      rillig   11482:             <dt><span class="sect1"><a href="#fixes-build">15.4.
                   11483:             Building the package</a></span></dt>
1.1       grant    11484: 
                   11485:             <dd>
                   11486:               <dl>
                   11487:                 <dt><span class="sect2"><a href=
1.38      dillo    11488:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.51      rillig   11489: 
                   11490:                 <dt><span class="sect2"><a href="#cpp-list">15.4.2.
                   11491:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    11492:               </dl>
                   11493:             </dd>
                   11494: 
1.30      wiz      11495:             <dt><span class="sect1"><a href=
1.38      dillo    11496:             "#package-specific-actions">15.5. Package specific
1.30      wiz      11497:             actions</a></span></dt>
1.1       grant    11498: 
                   11499:             <dd>
                   11500:               <dl>
                   11501:                 <dt><span class="sect2"><a href=
1.38      dillo    11502:                 "#user-interaction">15.5.1. User
1.2       hubertf  11503:                 interaction</a></span></dt>
1.1       grant    11504: 
                   11505:                 <dt><span class="sect2"><a href=
1.38      dillo    11506:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11507:                 licenses</a></span></dt>
                   11508: 
                   11509:                 <dt><span class="sect2"><a href=
1.38      dillo    11510:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11511:                 files</a></span></dt>
                   11512: 
                   11513:                 <dt><span class="sect2"><a href=
1.38      dillo    11514:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11515:                 scripts</a></span></dt>
                   11516: 
                   11517:                 <dt><span class="sect2"><a href=
1.38      dillo    11518:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11519:                 paths to other interpreters</a></span></dt>
1.1       grant    11520: 
                   11521:                 <dt><span class="sect2"><a href=
1.38      dillo    11522:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11523:                 modules</a></span></dt>
                   11524: 
                   11525:                 <dt><span class="sect2"><a href=
1.38      dillo    11526:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11527:                 files</a></span></dt>
                   11528: 
1.57      minskim  11529:                 <dt><span class="sect2"><a href="#manpages">15.5.8.
                   11530:                 Packages installing man pages</a></span></dt>
                   11531: 
1.1       grant    11532:                 <dt><span class="sect2"><a href=
1.57      minskim  11533:                 "#gconf2-data-files">15.5.9. Packages installing
1.30      wiz      11534:                 GConf2 data files</a></span></dt>
1.1       grant    11535: 
                   11536:                 <dt><span class="sect2"><a href=
1.57      minskim  11537:                 "#scrollkeeper-data-files">15.5.10. Packages
1.30      wiz      11538:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11539: 
                   11540:                 <dt><span class="sect2"><a href=
1.57      minskim  11541:                 "#x11-fonts">15.5.11. Packages installing X11
1.1       grant    11542:                 fonts</a></span></dt>
                   11543: 
                   11544:                 <dt><span class="sect2"><a href=
1.57      minskim  11545:                 "#gtk2-modules">15.5.12. Packages installing GTK2
1.1       grant    11546:                 modules</a></span></dt>
                   11547: 
                   11548:                 <dt><span class="sect2"><a href=
1.57      minskim  11549:                 "#sgml-xml-data">15.5.13. Packages installing SGML
1.30      wiz      11550:                 or XML data</a></span></dt>
1.1       grant    11551: 
                   11552:                 <dt><span class="sect2"><a href=
1.57      minskim  11553:                 "#mime-database">15.5.14. Packages installing
1.1       grant    11554:                 extensions to the MIME database</a></span></dt>
                   11555: 
                   11556:                 <dt><span class="sect2"><a href=
1.57      minskim  11557:                 "#intltool">15.5.15. Packages using
1.1       grant    11558:                 intltool</a></span></dt>
1.18      xtraeme  11559: 
                   11560:                 <dt><span class="sect2"><a href=
1.57      minskim  11561:                 "#startup-scripts">15.5.16. Packages installing
1.30      wiz      11562:                 startup scripts</a></span></dt>
1.57      minskim  11563: 
                   11564:                 <dt><span class="sect2"><a href=
                   11565:                 "#tex-packages">15.5.17. Packages installing TeX
                   11566:                 modules</a></span></dt>
1.1       grant    11567:               </dl>
                   11568:             </dd>
                   11569: 
1.30      wiz      11570:             <dt><span class="sect1"><a href=
1.38      dillo    11571:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11572:             author</a></span></dt>
1.1       grant    11573:           </dl>
                   11574:         </div>
                   11575: 
1.57      minskim  11576:         <div class="sect1" lang="en">
1.1       grant    11577:           <div class="titlepage">
                   11578:             <div>
                   11579:               <div>
                   11580:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    11581:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11582:                 operation</h2>
                   11583:               </div>
                   11584:             </div>
                   11585:           </div>
                   11586: 
1.57      minskim  11587:           <div class="sect2" lang="en">
1.1       grant    11588:             <div class="titlepage">
                   11589:               <div>
                   11590:                 <div>
1.30      wiz      11591:                   <h3 class="title"><a name=
1.38      dillo    11592:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11593:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11594:                 </div>
                   11595:               </div>
                   11596:             </div>
                   11597: 
                   11598:             <p>The problem with package-defined variables that can
1.14      xtraeme  11599:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11600:             or <code xmlns=
                   11601:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11602:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11603:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11604:             <span class="citerefentry"><span class=
                   11605:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11606:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11607:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11608:             So, to use any variable (which may be set in
1.45      wiz      11609:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11610:             class="filename">/etc/mk.conf</code>) in one of the
                   11611:             .if* statements, the file <code xmlns=
                   11612:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11613:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11614:             that .if* statement.</p>
                   11615: 
1.47      reed     11616:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11617:             including <code xmlns=
                   11618:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11619:             "filename">/etc/mk.conf</code>, should it exist, or
                   11620:             <code class="varname">MAKECONF</code>, should it exist,
                   11621:             include the <code xmlns=
                   11622:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11623:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11624:             package Makefile before any preprocessor-like .if,
                   11625:             .ifdef, or .ifndef statements:</p>
1.1       grant    11626:             <pre class="programlisting">
1.51      rillig   11627:     .include "../../mk/bsd.prefs.mk"
                   11628: 
1.1       grant    11629:     .if defined(USE_MENUS)
1.51      rillig   11630:     # ...
1.1       grant    11631:     .endif
                   11632: </pre>
                   11633: 
1.14      xtraeme  11634:             <p>If you wish to set the <code class=
1.45      wiz      11635:             "varname">CFLAGS</code> variable in <code xmlns=
                   11636:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11637:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11638:             use:</p>
                   11639:             <pre class="programlisting">
1.51      rillig   11640:     CFLAGS+=  -your -flags
1.1       grant    11641: </pre>
                   11642: 
1.14      xtraeme  11643:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11644:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11645:             may lead to problems with packages that need to add
                   11646:             their own flags. Also, you may want to take a look at
                   11647:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11648:             href=
                   11649:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11650:             target="_top"><code xmlns="" class=
                   11651:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11652:             interested in optimization for the current CPU.</p>
1.1       grant    11653:           </div>
                   11654: 
1.57      minskim  11655:           <div class="sect2" lang="en">
1.1       grant    11656:             <div class="titlepage">
                   11657:               <div>
                   11658:                 <div>
1.31      wiz      11659:                   <h3 class="title"><a name=
1.38      dillo    11660:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11661:                   to install documentation</h3>
                   11662:                 </div>
                   11663:               </div>
                   11664:             </div>
                   11665: 
1.45      wiz      11666:             <p>Documentation should be installed into <code xmlns=
                   11667:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11668:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11669:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11670:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11671:             (the latter includes the version number of the
                   11672:             package).</p>
1.31      wiz      11673:           </div>
                   11674: 
1.57      minskim  11675:           <div class="sect2" lang="en">
1.31      wiz      11676:             <div class="titlepage">
                   11677:               <div>
                   11678:                 <div>
1.57      minskim  11679:                   <h3 class="title"><a name=
1.38      dillo    11680:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11681:                   packages</h3>
                   11682:                 </div>
                   11683:               </div>
                   11684:             </div>
                   11685: 
                   11686:             <p>Some licenses restrict how software may be
                   11687:             re-distributed. In order to satisfy these restrictions,
                   11688:             the package system defines five make variables that can
                   11689:             be set to note these restrictions:</p>
                   11690: 
                   11691:             <div class="itemizedlist">
                   11692:               <ul type="disc">
                   11693:                 <li>
1.14      xtraeme  11694:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11695: 
                   11696:                   <p>This variable should be set whenever a
                   11697:                   restriction exists (regardless of its kind). Set
                   11698:                   this variable to a string containing the reason
                   11699:                   for the restriction.</p>
                   11700:                 </li>
                   11701: 
                   11702:                 <li>
1.14      xtraeme  11703:                   <p><code class=
                   11704:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11705: 
                   11706:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11707:                   variable to <code class=
                   11708:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11709:                   package may not be included on a CD-ROM.</p>
                   11710:                 </li>
                   11711: 
                   11712:                 <li>
1.14      xtraeme  11713:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11714: 
                   11715:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11716:                   Set this variable to <code class=
                   11717:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11718:                   package may not not be made available on the
                   11719:                   Internet.</p>
                   11720:                 </li>
                   11721: 
                   11722:                 <li>
1.14      xtraeme  11723:                   <p><code class=
                   11724:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11725: 
                   11726:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11727:                   this variable to <code class=
                   11728:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11729:                   of the source code or other distfile(s) is not
                   11730:                   allowed on CD-ROMs.</p>
                   11731:                 </li>
                   11732: 
                   11733:                 <li>
1.14      xtraeme  11734:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11735: 
                   11736:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11737:                   variable to <code class=
                   11738:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11739:                   of the source code or other distfile(s) via the
                   11740:                   Internet is not allowed.</p>
                   11741:                 </li>
                   11742:               </ul>
                   11743:             </div>
                   11744: 
1.14      xtraeme  11745:             <p>Please note that the use of <code class=
                   11746:             "varname">NO_PACKAGE</code>, <code class=
                   11747:             "varname">IGNORE</code>, <code class=
                   11748:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11749:             variables to denote restrictions is deprecated, because
                   11750:             they unconditionally prevent users from generating
                   11751:             binary packages!</p>
                   11752:           </div>
                   11753: 
1.57      minskim  11754:           <div class="sect2" lang="en">
1.1       grant    11755:             <div class="titlepage">
                   11756:               <div>
                   11757:                 <div>
1.57      minskim  11758:                   <h3 class="title"><a name=
1.38      dillo    11759:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11760:                   dependencies</h3>
                   11761:                 </div>
                   11762:               </div>
                   11763:             </div>
                   11764: 
                   11765:             <p>Your package may depend on some other package being
                   11766:             present - and there are various ways of expressing this
1.14      xtraeme  11767:             dependency. pkgsrc supports the <code class=
                   11768:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11769:             "varname">DEPENDS</code> definitions, the <code class=
                   11770:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11771:             dependencies via <code xmlns=
                   11772:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11773:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11774:             way to handle dependencies, and which uses the
                   11775:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11776:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11777:             <i>Buildlink methodology</i></a> for more
                   11778:             information.</p>
                   11779: 
                   11780:             <p>The basic difference between the two variables is as
1.14      xtraeme  11781:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11782:             definition registers that pre-requisite in the binary
                   11783:             package so it will be pulled in when the binary package
1.14      xtraeme  11784:             is later installed, whilst the <code class=
                   11785:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11786:             marking a dependency that is only needed for building
                   11787:             the package.</p>
                   11788: 
                   11789:             <p>This means that if you only need a package present
                   11790:             whilst you are building, it should be noted as a
1.14      xtraeme  11791:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11792: 
1.14      xtraeme  11793:             <p>The format for a <code class=
                   11794:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11795:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11796:             <pre class="programlisting">
1.51      rillig   11797:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    11798: </pre>
                   11799: 
                   11800:             <p>Please note that the &#8220;<span class=
                   11801:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  11802:             any of the wildcard version numbers recognized by
1.1       grant    11803:             <a href=
                   11804:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11805:             <span class="citerefentry"><span class=
                   11806:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   11807: 
                   11808:             <div class="orderedlist">
                   11809:               <ol type="1">
                   11810:                 <li>
                   11811:                   <p>If your package needs another package's
                   11812:                   binaries or libraries to build or run, and if
1.45      wiz      11813:                   that package has a <code xmlns=
                   11814:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11815:                   "filename">buildlink3.mk</code> file available,
                   11816:                   use it:</p>
1.1       grant    11817:                   <pre class="programlisting">
                   11818:     .include "../../graphics/jpeg/buildlink3.mk"
                   11819: </pre>
                   11820:                 </li>
                   11821: 
                   11822:                 <li>
                   11823:                   <p>If your package needs to use another package
1.45      wiz      11824:                   to build itself and there is no <code xmlns=
                   11825:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11826:                   "filename">buildlink3.mk</code> file available,
                   11827:                   use the <code class=
                   11828:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    11829:                   <pre class="programlisting">
1.51      rillig   11830:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    11831: </pre>
                   11832:                 </li>
                   11833: 
                   11834:                 <li>
                   11835:                   <p>If your package needs a library with which to
1.45      wiz      11836:                   link and again there is no <code xmlns=
                   11837:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11838:                   "filename">buildlink3.mk</code> file available,
                   11839:                   this is specified using the <code class=
                   11840:                   "varname">DEPENDS</code> definition. An example
                   11841:                   of this is the <a xmlns=
1.1       grant    11842:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11843:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11844:                   target="_top"><code xmlns="" class=
                   11845:                   "filename">print/lyx</code></a> package, which
                   11846:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    11847:                   <pre class="programlisting">
1.51      rillig   11848:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    11849: </pre>
                   11850: 
                   11851:                   <p>You can also use wildcards in package
                   11852:                   dependences:</p>
                   11853:                   <pre class="programlisting">
1.51      rillig   11854:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    11855: </pre>
                   11856: 
                   11857:                   <p>Note that such wildcard dependencies are
                   11858:                   retained when creating binary packages. The
                   11859:                   dependency is checked when installing the binary
                   11860:                   package and any package which matches the pattern
                   11861:                   will be used. Wildcard dependencies should be
                   11862:                   used with care.</p>
                   11863: 
                   11864:                   <p>The &#8220;<span class=
                   11865:                   "quote">-[0-9]*</span>&#8221; should be used
                   11866:                   instead of &#8220;<span class=
                   11867:                   "quote">-*</span>&#8221; to avoid potentially
                   11868:                   ambiguous matches such as &#8220;<span class=
                   11869:                   "quote">tk-postgresql</span>&#8221; matching a
                   11870:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  11871:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    11872: 
                   11873:                   <p>Wildcards can also be used to specify that a
                   11874:                   package will only build against a certain minimum
                   11875:                   version of a pre-requisite:</p>
                   11876:                   <pre class="programlisting">
1.51      rillig   11877:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    11878: </pre>
                   11879: 
                   11880:                   <p>This means that the package will build against
                   11881:                   version 3.5.4 of the tiff library or newer. Such
                   11882:                   a dependency may be warranted if, for example,
                   11883:                   the API of the library has changed with version
                   11884:                   3.5.4 and a package would not compile against an
                   11885:                   earlier version of tiff.</p>
                   11886: 
                   11887:                   <p>Please note that such dependencies should only
                   11888:                   be updated if a package requires a newer
                   11889:                   pre-requisite, but not to denote recommendations
                   11890:                   such as security updates or ABI changes that do
                   11891:                   not prevent a package from building correctly.
                   11892:                   Such recommendations can be expressed using
1.14      xtraeme  11893:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    11894:                   <pre class="programlisting">
1.51      rillig   11895:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    11896: </pre>
                   11897: 
1.14      xtraeme  11898:                   <p>In addition to the above <code class=
                   11899:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    11900:                   while a package will build against
                   11901:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  11902:                   recommended. <code class=
                   11903:                   "varname">RECOMMENDED</code> entries will be
                   11904:                   turned into dependencies unless explicitly
                   11905:                   ignored (in which case a warning will be
1.36      wiz      11906:                   printed).</p>
                   11907: 
                   11908:                   <p>To ignore these dependency recommendations and
                   11909:                   just use the required <code class=
                   11910:                   "varname">DEPENDS</code>, set <code class=
                   11911:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   11912:                   make it easier and faster to update packages
                   11913:                   built using pkgsrc, since older compatible
                   11914:                   dependencies can continue to be used. This is
                   11915:                   useful for people who watch their rebuilds very
                   11916:                   carefully; it is not very good as a
                   11917:                   general-purpose hammer. If you use it, you need
                   11918:                   to be mindful of possible ABI changes, including
                   11919:                   those from the underlying OS.</p>
                   11920: 
                   11921:                   <p>Packages that are built with recommendations
                   11922:                   ignored may not be uploaded to ftp.NetBSD.org by
                   11923:                   developers and should not be used across
                   11924:                   different systems that may have different
                   11925:                   versions of binary packages installed.</p>
1.1       grant    11926: 
                   11927:                   <p>For security fixes, please update the package
                   11928:                   vulnerabilities file as well as setting
1.14      xtraeme  11929:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    11930:                   <a href="#security-handling" title=
1.38      dillo    11931:                   "15.1.8.&nbsp;Handling packages with security problems">
1.57      minskim  11932:                   Section&nbsp;15.1.8, &#8220;Handling packages
                   11933:                   with security problems&#8221;</a> for more
1.1       grant    11934:                   information.</p>
                   11935:                 </li>
                   11936: 
                   11937:                 <li>
                   11938:                   <p>If your package needs some executable to be
1.17      sketch   11939:                   able to run correctly and if there's no
1.45      wiz      11940:                   <code xmlns=
                   11941:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   11942:                   "filename">buildlink3.mk</code> file, this is
                   11943:                   specified using the <code class=
1.14      xtraeme  11944:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    11945:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11946:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11947:                   target="_top"><code xmlns="" class=
                   11948:                   "filename">print/lyx</code></a> package needs to
                   11949:                   be able to execute the latex binary from the
                   11950:                   teTeX package when it runs, and that is
                   11951:                   specified:</p>
1.1       grant    11952:                   <pre class="programlisting">
1.51      rillig   11953:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    11954: </pre>
                   11955: 
                   11956:                   <p>The comment about wildcard dependencies from
                   11957:                   previous paragraph applies here, too.</p>
                   11958:                 </li>
                   11959:               </ol>
                   11960:             </div>
                   11961: 
                   11962:             <p>If your package needs files from another package to
                   11963:             build, see the first part of the &#8220;<span class=
                   11964:             "quote">do-configure</span>&#8221; target <a xmlns=
                   11965:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11966:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      11967:             target="_top"><code xmlns="" class=
                   11968:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      11969:             relies on the jpeg sources being present in source form
                   11970:             during the build):</p>
1.1       grant    11971:             <pre class="programlisting">
1.51      rillig   11972:     if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then    \
                   11973:         cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract; \
1.1       grant    11974:     fi
                   11975: </pre>
                   11976: 
                   11977:             <p>If you build any other packages that way, please
                   11978:             make sure the working files are deleted too when this
                   11979:             package's working files are cleaned up. The easiest way
                   11980:             to do so is by adding a pre-clean target:</p>
                   11981:             <pre class="programlisting">
1.51      rillig   11982:     pre-clean:
                   11983:             cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
1.1       grant    11984: </pre>
                   11985: 
1.14      xtraeme  11986:             <p>Please also note the <code class=
                   11987:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   11988:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   11989:             which are provided as convenience definitions. The
1.24      wiz      11990:             former works out whether <a href=
                   11991:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   11992:             <span class="citerefentry"><span class=
                   11993:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   11994:             the base system, and, if it isn't, installs the
                   11995:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11996:             href=
1.1       grant    11997:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      11998:             target="_top"><code xmlns="" class=
                   11999:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12000:             adds a build dependency on either an installed version
                   12001:             of an older gettext package, or if it isn't, installs
                   12002:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12003:             href=
                   12004:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12005:             target="_top"><code xmlns="" class=
                   12006:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12007:           </div>
                   12008: 
1.57      minskim  12009:           <div class="sect2" lang="en">
1.1       grant    12010:             <div class="titlepage">
                   12011:               <div>
                   12012:                 <div>
1.57      minskim  12013:                   <h3 class="title"><a name=
1.38      dillo    12014:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    12015:                   with other packages</h3>
                   12016:                 </div>
                   12017:               </div>
                   12018:             </div>
                   12019: 
                   12020:             <p>Your package may conflict with other packages a user
                   12021:             might already have installed on his system, e.g. if
                   12022:             your package installs the same set of files like
                   12023:             another package in our pkgsrc tree.</p>
                   12024: 
1.14      xtraeme  12025:             <p>In this case you can set <code class=
1.47      reed     12026:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12027:             packages (including version string) your package
                   12028:             conflicts with.</p>
                   12029: 
1.47      reed     12030:             <p>For example, <a xmlns=
1.1       grant    12031:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12032:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12033:             target="_top"><code xmlns="" class=
                   12034:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12035:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12036:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12037:             target="_top"><code xmlns="" class=
1.47      reed     12038:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12039:             shared library, thus you set in <code xmlns=
1.45      wiz      12040:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12041:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12042:             <pre class="programlisting">
1.51      rillig   12043:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12044: </pre>
                   12045: 
1.45      wiz      12046:             <p>and in <code xmlns=
                   12047:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12048:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12049:             <pre class="programlisting">
1.51      rillig   12050:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12051: </pre>
                   12052: 
                   12053:             <p>Packages will automatically conflict with other
                   12054:             packages with the name prefix and a different version
                   12055:             string. &#8220;<span class=
                   12056:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12057:             conflict with the older version &#8220;<span class=
                   12058:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12059:           </div>
                   12060: 
1.57      minskim  12061:           <div class="sect2" lang="en">
1.1       grant    12062:             <div class="titlepage">
                   12063:               <div>
                   12064:                 <div>
1.57      minskim  12065:                   <h3 class="title"><a name=
1.38      dillo    12066:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      12067:                   that cannot or should not be built</h3>
1.1       grant    12068:                 </div>
                   12069:               </div>
                   12070:             </div>
                   12071: 
                   12072:             <p>There are several reasons why a package might be
                   12073:             instructed to not build under certain circumstances. If
                   12074:             the package builds and runs on most platforms, the
1.14      xtraeme  12075:             exceptions should be noted with <code class=
                   12076:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12077:             builds and runs on a small handful of platforms, set
                   12078:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12079:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12080:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12081:             triples (OS-version-platform) that can use glob-style
                   12082:             wildcards.</p>
                   12083: 
                   12084:             <p>If the package should be skipped (for example,
                   12085:             because it provides functionality already provided by
                   12086:             the system), set <code class=
1.14      xtraeme  12087:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12088:             message. If the package should fail because some
                   12089:             preconditions are not met, set <code class=
                   12090:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12091:             message.</p>
                   12092:           </div>
                   12093: 
1.57      minskim  12094:           <div class="sect2" lang="en">
1.1       grant    12095:             <div class="titlepage">
                   12096:               <div>
                   12097:                 <div>
1.57      minskim  12098:                   <h3 class="title"><a name=
1.38      dillo    12099:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      12100:                   which should not be deleted, once installed</h3>
1.1       grant    12101:                 </div>
                   12102:               </div>
                   12103:             </div>
                   12104: 
                   12105:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12106:             has been installed, the <code class=
                   12107:             "varname">PKG_PRESERVE</code> definition should be set
                   12108:             in the package Makefile. This will be carried into any
1.1       grant    12109:             binary package that is made from this pkgsrc entry. A
                   12110:             &#8220;<span class="quote">preserved</span>&#8221;
                   12111:             package will not be deleted using <a href=
                   12112:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12113:             <span class="citerefentry"><span class=
                   12114:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12115:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12116:             is used.</p>
                   12117:           </div>
                   12118: 
1.57      minskim  12119:           <div class="sect2" lang="en">
1.1       grant    12120:             <div class="titlepage">
                   12121:               <div>
                   12122:                 <div>
1.57      minskim  12123:                   <h3 class="title"><a name=
1.38      dillo    12124:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    12125:                   packages with security problems</h3>
                   12126:                 </div>
                   12127:               </div>
                   12128:             </div>
                   12129: 
                   12130:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12131:             in <code xmlns=
                   12132:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12133:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12134:             and after committing that file, use
                   12135:             <span><strong class="command">make
                   12136:             upload</strong></span> in the same directory to update
                   12137:             the file on ftp.NetBSD.org.</p>
                   12138: 
                   12139:             <p>After fixing the vulnerability by a patch, its
                   12140:             <code class="varname">PKGREVISION</code> should be
                   12141:             increased (this is of course not necessary if the
                   12142:             problem is fixed by using a newer release of the
1.45      wiz      12143:             software). In addition, if a <code xmlns=
                   12144:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12145:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12146:             affected package, a corresponding <code class=
1.14      xtraeme  12147:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12148:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12149:             be added or updated in it.</p>
1.1       grant    12150: 
                   12151:             <p>Also, if the fix should be applied to the stable
                   12152:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12153: 
                   12154:             <p>Binary packages already on ftp.NetBSD.org will be
                   12155:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12156:           </div>
                   12157: 
1.57      minskim  12158:           <div class="sect2" lang="en">
1.1       grant    12159:             <div class="titlepage">
                   12160:               <div>
                   12161:                 <div>
1.57      minskim  12162:                   <h3 class="title"><a name=
1.38      dillo    12163:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    12164:                   compiler bugs</h3>
                   12165:                 </div>
                   12166:               </div>
                   12167:             </div>
                   12168: 
                   12169:             <p>Some source files trigger bugs in the compiler,
                   12170:             based on combinations of compiler version and
                   12171:             architecture and almost always relation to optimisation
                   12172:             being enabled. Common symptoms are gcc internal errors
                   12173:             or never finishing compiling a file.</p>
                   12174: 
1.47      reed     12175:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12176:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12177:             version, disabling optimisation for that
1.14      xtraeme  12178:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12179:             combination, and documenting it in <code xmlns=
                   12180:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12181:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12182:             number of examples!</p>
                   12183:           </div>
                   12184: 
1.57      minskim  12185:           <div class="sect2" lang="en">
1.1       grant    12186:             <div class="titlepage">
                   12187:               <div>
                   12188:                 <div>
1.57      minskim  12189:                   <h3 class="title"><a name=
                   12190:                   "bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      12191:                   handle incrementing versions when fixing an
                   12192:                   existing package</h3>
1.1       grant    12193:                 </div>
                   12194:               </div>
                   12195:             </div>
                   12196: 
                   12197:             <p>When making fixes to an existing package it can be
1.14      xtraeme  12198:             useful to change the version number in <code class=
                   12199:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    12200:             future versions by the original author, a
                   12201:             &#8220;<span class="quote">nb1</span>&#8221;,
                   12202:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   12203:             suffix can be used on package versions by setting
1.14      xtraeme  12204:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   12205:             The &#8220;<span class="quote">nb</span>&#8221; is
                   12206:             treated like a &#8220;<span class=
                   12207:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    12208:             <pre class="programlisting">
1.51      rillig   12209:     DISTNAME=       foo-17.42
                   12210:     PKGREVISION=    9
1.1       grant    12211: </pre>
                   12212: 
1.14      xtraeme  12213:             <p>will result in a <code class=
                   12214:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    12215:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   12216: 
                   12217:             <p>When a new release of the package is released, the
1.14      xtraeme  12218:             <code class="varname">PKGREVISION</code> should be
1.47      reed     12219:             removed, e.g. on a new minor release of the above
1.14      xtraeme  12220:             package, things should be like:</p>
1.1       grant    12221:             <pre class="programlisting">
1.51      rillig   12222:     DISTNAME=       foo-17.43
1.1       grant    12223: </pre>
                   12224:           </div>
                   12225: 
1.57      minskim  12226:           <div class="sect2" lang="en">
1.1       grant    12227:             <div class="titlepage">
                   12228:               <div>
                   12229:                 <div>
1.30      wiz      12230:                   <h3 class="title"><a name=
1.38      dillo    12231:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      12232:                   of packages</h3>
1.1       grant    12233:                 </div>
                   12234:               </div>
                   12235:             </div>
                   12236: 
                   12237:             <p>One appealing feature of pkgsrc is that it runs on
                   12238:             many different platforms. As a result, it is important
                   12239:             to ensure, where possible, that packages in pkgsrc are
                   12240:             portable. There are some particular details you should
                   12241:             pay attention to while working on pkgsrc.</p>
                   12242: 
1.57      minskim  12243:             <div class="sect3" lang="en">
1.1       grant    12244:               <div class="titlepage">
                   12245:                 <div>
                   12246:                   <div>
1.57      minskim  12247:                     <h4 class="title"><a name=
1.38      dillo    12248:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    12249:                     ${INSTALL_DATA_DIR}, ...</h4>
                   12250:                   </div>
                   12251:                 </div>
                   12252:               </div>
                   12253: 
1.14      xtraeme  12254:               <p>The BSD-compatible <span><strong class=
                   12255:               "command">install</strong></span> supplied with some
1.1       grant    12256:               operating systems will not perform more than one
                   12257:               operation at a time. As such, you should call
                   12258:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   12259:               etc. like this:</p>
                   12260:               <pre class="programlisting">
1.51      rillig   12261:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   12262:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    12263: </pre>
                   12264:             </div>
                   12265:           </div>
                   12266:         </div>
                   12267: 
1.57      minskim  12268:         <div class="sect1" lang="en">
1.1       grant    12269:           <div class="titlepage">
                   12270:             <div>
                   12271:               <div>
                   12272:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12273:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    12274:                 downloading issues</h2>
                   12275:               </div>
                   12276:             </div>
                   12277:           </div>
                   12278: 
1.57      minskim  12279:           <div class="sect2" lang="en">
1.1       grant    12280:             <div class="titlepage">
                   12281:               <div>
                   12282:                 <div>
1.57      minskim  12283:                   <h3 class="title"><a name=
1.38      dillo    12284:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      12285:                   whose distfiles aren't available for plain
1.1       grant    12286:                   downloading</h3>
                   12287:                 </div>
                   12288:               </div>
                   12289:             </div>
                   12290: 
                   12291:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  12292:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   12293:             and a <span><strong class="command">make
1.45      wiz      12294:             fetch</strong></span> will call <code xmlns=
                   12295:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12296:             "filename">files/getsite.sh</code> with the name of
                   12297:             each file to download as an argument, expecting it to
                   12298:             output the URL of the directory from which to download
                   12299:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12300:             href=
1.1       grant    12301:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      12302:             target="_top"><code xmlns="" class=
                   12303:             "filename">graphics/ns-cult3d</code></a> is an example
                   12304:             of this usage.</p>
1.1       grant    12305: 
                   12306:             <p>If the download can't be automated, because the user
                   12307:             must submit personal information to apply for a
                   12308:             password, or must pay for the source, or whatever, you
1.14      xtraeme  12309:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   12310:             a macro which displays a message explaining the
                   12311:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   12312:             must be executable shell commands, not just a message.
                   12313:             (Generally, it executes <code class=
                   12314:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    12315:             following packages use this: <a xmlns=
                   12316:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12317:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      12318:             target="_top"><code xmlns="" class=
                   12319:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      12320:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12321:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      12322:             target="_top"><code xmlns="" class=
                   12323:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      12324:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12325:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      12326:             target="_top"><code xmlns="" class=
                   12327:             "filename">emulators/vmware-module</code></a>,
                   12328:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12329:             href=
1.20      ben      12330:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      12331:             target="_top"><code xmlns="" class=
                   12332:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      12333:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      12334:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      12335:             target="_top"><code xmlns="" class=
                   12336:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      12337:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      12338:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      12339:             target="_top"><code xmlns="" class=
                   12340:             "filename">sysutils/storage-manager</code></a>,
                   12341:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12342:             href=
1.20      ben      12343:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      12344:             target="_top"><code xmlns="" class=
                   12345:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      12346:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12347:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      12348:             target="_top"><code xmlns="" class=
                   12349:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      12350:             with them.</p>
1.1       grant    12351:           </div>
                   12352: 
1.57      minskim  12353:           <div class="sect2" lang="en">
1.1       grant    12354:             <div class="titlepage">
                   12355:               <div>
                   12356:                 <div>
1.30      wiz      12357:                   <h3 class="title"><a name=
1.38      dillo    12358:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      12359:                   to handle modified distfiles with the 'old'
                   12360:                   name</h3>
1.1       grant    12361:                 </div>
                   12362:               </div>
                   12363:             </div>
                   12364: 
                   12365:             <p>Sometimes authors of a software package make some
                   12366:             modifications after the software was released, and they
                   12367:             put up a new distfile without changing the package's
                   12368:             version number. If a package is already in pkgsrc at
1.32      wiz      12369:             that time, the checksum will no longer match. The
                   12370:             contents of the new distfile should be compared against
                   12371:             the old one before changing anything, to make sure the
                   12372:             distfile was really updated on purpose, and that no
                   12373:             trojan horse or so crept in. Then, the correct way to
                   12374:             work around this is to set <code class=
                   12375:             "varname">DIST_SUBDIR</code> to a unique directory
                   12376:             name, usually based on <code class=
                   12377:             "varname">PKGNAME_NOREV</code>. In case this happens
                   12378:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      12379:             used (thus including the <code xmlns=
                   12380:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12381:             "filename">nbX</code> suffix) or a date stamp can be
                   12382:             appended, like <code class=
                   12383:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      12384:             forget regenerating the <code xmlns=
                   12385:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      12386:             "filename">distinfo</code> file after that, since it
                   12387:             contains the <code class="varname">DIST_SUBDIR</code>
                   12388:             path in the filenames. Furthermore, a mail to the
                   12389:             package's authors seems appropriate telling them that
                   12390:             changing distfiles after releases without changing the
                   12391:             file names is not good practice.</p>
1.1       grant    12392:           </div>
                   12393:         </div>
                   12394: 
1.57      minskim  12395:         <div class="sect1" lang="en">
1.1       grant    12396:           <div class="titlepage">
                   12397:             <div>
                   12398:               <div>
                   12399:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12400:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    12401:                 gotchas</h2>
                   12402:               </div>
                   12403:             </div>
                   12404:           </div>
                   12405: 
1.57      minskim  12406:           <div class="sect2" lang="en">
1.1       grant    12407:             <div class="titlepage">
                   12408:               <div>
                   12409:                 <div>
1.57      minskim  12410:                   <h3 class="title"><a name=
1.38      dillo    12411:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    12412:                   - libtool</h3>
                   12413:                 </div>
                   12414:               </div>
                   12415:             </div>
                   12416: 
                   12417:             <p>pkgsrc supports many different machines, with
                   12418:             different object formats like a.out and ELF, and
                   12419:             varying abilities to do shared library and dynamic
                   12420:             loading at all. To accompany this, varying commands and
                   12421:             options have to be passed to the compiler, linker, etc.
                   12422:             to get the Right Thing, which can be pretty annoying
                   12423:             especially if you don't have all the machines at your
                   12424:             hand to test things. The <a xmlns=
                   12425:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12426:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      12427:             target="_top"><code xmlns="" class=
                   12428:             "filename">devel/libtool</code></a> pkg can help here,
                   12429:             as it just &#8220;<span class=
                   12430:             "quote">knows</span>&#8221; how to build both static
                   12431:             and dynamic libraries from a set of source files, thus
1.47      reed     12432:             being platform-independent.</p>
1.1       grant    12433: 
                   12434:             <p>Here's how to use libtool in a pkg in seven simple
                   12435:             steps:</p>
                   12436: 
                   12437:             <div class="orderedlist">
                   12438:               <ol type="1">
                   12439:                 <li>
1.14      xtraeme  12440:                   <p>Add <code class=
                   12441:                   "varname">USE_LIBTOOL=yes</code> to the package
                   12442:                   Makefile.</p>
1.1       grant    12443:                 </li>
                   12444: 
                   12445:                 <li>
                   12446:                   <p>For library objects, use &#8220;<span class=
                   12447:                   "quote">${LIBTOOL} --mode=compile
                   12448:                   ${CC}</span>&#8221; in place of
                   12449:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   12450:                   You could even add it to the definition of
1.14      xtraeme  12451:                   <code class="varname">CC</code>, if only
                   12452:                   libraries are being built in a given Makefile.
                   12453:                   This one command will build both PIC and non-PIC
                   12454:                   library objects, so you need not have separate
                   12455:                   shared and non-shared library rules.</p>
1.1       grant    12456:                 </li>
                   12457: 
                   12458:                 <li>
                   12459:                   <p>For the linking of the library, remove any
                   12460:                   &#8220;<span class="quote">ar</span>&#8221;,
                   12461:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   12462:                   and &#8220;<span class="quote">ld
                   12463:                   -Bshareable</span>&#8221; commands, and instead
                   12464:                   use:</p>
                   12465:                   <pre class="programlisting">
1.51      rillig   12466:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   12467:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    12468: </pre>
                   12469: 
                   12470:                   <p>Note that the library is changed to have a
1.45      wiz      12471:                   <code xmlns=
                   12472:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12473:                   "filename">.la</code> extension, and the objects
                   12474:                   are changed to have a <code xmlns=
                   12475:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12476:                   "filename">.lo</code> extension. Change
                   12477:                   <code class="varname">OBJS</code> as necessary.
                   12478:                   This automatically creates all of the
1.45      wiz      12479:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12480:                   class="filename">.a</code>, <code xmlns=
                   12481:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12482:                   "filename">.so.major.minor</code>, and ELF
                   12483:                   symlinks (if necessary) in the build directory.
                   12484:                   Be sure to include &#8220;<span class=
1.1       grant    12485:                   "quote">-version-info</span>&#8221;, especially
                   12486:                   when major and minor are zero, as libtool will
                   12487:                   otherwise strip off the shared library
                   12488:                   version.</p>
                   12489: 
                   12490:                   <p>From the libtool manual:</p>
                   12491:                   <pre class="programlisting">
1.51      rillig   12492:     So, libtool library versions are described by three integers:
1.1       grant    12493: 
1.51      rillig   12494:     CURRENT
                   12495:         The most recent interface number that this library implements.
1.1       grant    12496: 
1.51      rillig   12497:     REVISION
                   12498:         The implementation number of the CURRENT interface.
1.1       grant    12499: 
1.51      rillig   12500:     AGE
                   12501:         The difference between the newest and oldest interfaces that
                   12502:         this library implements.  In other words, the library implements
                   12503:         all the interface numbers in the range from number `CURRENT -
                   12504:         AGE' to `CURRENT'.
1.1       grant    12505:        
1.51      rillig   12506:     If two libraries have identical CURRENT and AGE numbers, then the
                   12507:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    12508: </pre>
                   12509: 
                   12510:                   <p>The &#8220;<span class=
                   12511:                   "quote">-release</span>&#8221; option will
                   12512:                   produce different results for a.out and ELF
                   12513:                   (excluding symlinks) in only one case. An ELF
                   12514:                   library of the form &#8220;<span class=
                   12515:                   "quote">libfoo-release.so.<span class=
                   12516:                   "emphasis"><em>x</em></span>.<span class=
                   12517:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12518:                   have a symlink of &#8220;<span class=
                   12519:                   "quote">libfoo.so.<span class=
                   12520:                   "emphasis"><em>x</em></span>.<span class=
                   12521:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12522:                   a.out platform. This is handled
                   12523:                   automatically.</p>
                   12524: 
                   12525:                   <p>The &#8220;<span class="quote">-rpath
                   12526:                   argument</span>&#8221; is the install directory
                   12527:                   of the library being built.</p>
                   12528: 
1.45      wiz      12529:                   <p>In the <code xmlns=
                   12530:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12531:                   "filename">PLIST</code>, include only the
                   12532:                   <code xmlns=
                   12533:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12534:                   "filename">.la</code> file, the other files will
                   12535:                   be added automatically.</p>
1.1       grant    12536:                 </li>
                   12537: 
                   12538:                 <li>
1.45      wiz      12539:                   <p>When linking shared object (<code xmlns=
                   12540:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12541:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12542:                   loaded via <a href=
                   12543:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12544:                   <span class="citerefentry"><span class=
                   12545:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12546:                   shared libraries, use &#8220;<span class=
                   12547:                   "quote">-module -avoid-version</span>&#8221; to
                   12548:                   prevent them getting version tacked on.</p>
1.1       grant    12549: 
1.45      wiz      12550:                   <p>The <code xmlns=
                   12551:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12552:                   "filename">PLIST</code> file gets the
                   12553:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12554:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12555:                 </li>
                   12556: 
                   12557:                 <li>
                   12558:                   <p>When linking programs that depend on these
                   12559:                   libraries <span class=
                   12560:                   "emphasis"><em>before</em></span> they are
                   12561:                   installed, preface the <a href=
                   12562:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12563:                   <span class="citerefentry"><span class=
                   12564:                   "refentrytitle">cc</span>(1)</span></a> or
                   12565:                   <a href=
                   12566:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12567:                   <span class="citerefentry"><span class=
                   12568:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12569:                   &#8220;<span class="quote">${LIBTOOL}
                   12570:                   --mode=link</span>&#8221;, and it will find the
                   12571:                   correct libraries (static or shared), but please
                   12572:                   be aware that libtool will not allow you to
                   12573:                   specify a relative path in -L (such as
                   12574:                   &#8220;<span class=
                   12575:                   "quote">-L../somelib</span>&#8221;), because it
                   12576:                   expects you to change that argument to be the
1.45      wiz      12577:                   <code xmlns=
                   12578:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12579:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12580:                   <pre class="programlisting">
1.51      rillig   12581:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    12582: </pre>
                   12583: 
                   12584:                   <p>should be changed to:</p>
                   12585:                   <pre class="programlisting">
1.51      rillig   12586:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  12587: "replaceable"><code>someprog</code></em> <em class=
                   12588: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12589: </pre>
                   12590: 
                   12591:                   <p>and it will do the right thing with the
                   12592:                   libraries.</p>
                   12593:                 </li>
                   12594: 
                   12595:                 <li>
                   12596:                   <p>When installing libraries, preface the
                   12597:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12598:                   <span class="citerefentry"><span class=
                   12599:                   "refentrytitle">install</span>(1)</span></a> or
                   12600:                   <a href=
                   12601:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12602:                   <span class="citerefentry"><span class=
                   12603:                   "refentrytitle">cp</span>(1)</span></a> command
                   12604:                   with &#8220;<span class="quote">${LIBTOOL}
                   12605:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12606:                   library name to <code xmlns=
                   12607:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12608:                   "filename">.la</code>. e.g.</p>
1.1       grant    12609:                   <pre class="programlisting">
1.51      rillig   12610:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    12611: </pre>
                   12612: 
1.45      wiz      12613:                   <p>This will install the static <code xmlns=
                   12614:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12615:                   "filename">.a</code>, shared library, any needed
1.1       grant    12616:                   symlinks, and run <a href=
                   12617:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12618:                   <span class="citerefentry"><span class=
                   12619:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12620:                 </li>
                   12621: 
                   12622:                 <li>
1.45      wiz      12623:                   <p>In your <code xmlns=
                   12624:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12625:                   "filename">PLIST</code>, include only the
                   12626:                   <code xmlns=
                   12627:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12628:                   "filename">.la</code> file (this is a change from
                   12629:                   previous behaviour).</p>
1.1       grant    12630:                 </li>
                   12631:               </ol>
                   12632:             </div>
                   12633:           </div>
                   12634: 
1.57      minskim  12635:           <div class="sect2" lang="en">
1.1       grant    12636:             <div class="titlepage">
                   12637:               <div>
                   12638:                 <div>
1.57      minskim  12639:                   <h3 class="title"><a name=
1.38      dillo    12640:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12641:                   GNU packages that already support libtool</h3>
1.1       grant    12642:                 </div>
                   12643:               </div>
                   12644:             </div>
                   12645: 
1.14      xtraeme  12646:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12647:             the package Makefile. This will override the package's
                   12648:             own libtool in most cases. For older libtool using
1.1       grant    12649:             packages, libtool is made by ltconfig script during the
                   12650:             do-configure step; you can check the libtool script
1.14      xtraeme  12651:             location by doing <span><strong class="command">make
                   12652:             configure; find work*/ -name
                   12653:             libtool</strong></span>.</p>
                   12654: 
                   12655:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12656:             specifies which libtool scripts, relative to
                   12657:             <code class="varname">WRKSRC</code>, to override. By
                   12658:             default, it is set to &#8220;<span class=
                   12659:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12660:             this does not match the location of the package's
                   12661:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12662: 
1.45      wiz      12663:             <p>If you do not need <code xmlns=
                   12664:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12665:             "filename">*.a</code> static libraries built and
                   12666:             installed, then use <code class=
                   12667:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12668: 
1.47      reed     12669:             <p>If your package makes use of the
                   12670:             platform-independent library for loading dynamic shared
                   12671:             objects, that comes with libtool (libltdl), you should
                   12672:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12673: 
                   12674:             <p>Some packages use libtool incorrectly so that the
                   12675:             package may not work or build in some circumstances.
                   12676:             Some of the more common errors are:</p>
                   12677: 
                   12678:             <div class="itemizedlist">
                   12679:               <ul type="disc">
                   12680:                 <li>
                   12681:                   <p>The inclusion of a shared object (-module) as
                   12682:                   a dependent library in an executable or library.
                   12683:                   This in itself isn't a problem if one of two
                   12684:                   things has been done:</p>
                   12685: 
                   12686:                   <div class="orderedlist">
                   12687:                     <ol type="1">
                   12688:                       <li>
                   12689:                         <p>The shared object is named correctly,
1.45      wiz      12690:                         i.e. <code xmlns=
                   12691:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12692:                         class="filename">libfoo.la</code>, not
                   12693:                         <code xmlns=
                   12694:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12695:                         class="filename">foo.la</code></p>
1.1       grant    12696:                       </li>
                   12697: 
                   12698:                       <li>
                   12699:                         <p>The -dlopen option is used when linking
                   12700:                         an executable.</p>
                   12701:                       </li>
                   12702:                     </ol>
                   12703:                   </div>
                   12704:                 </li>
                   12705: 
                   12706:                 <li>
                   12707:                   <p>The use of libltdl without the correct calls
                   12708:                   to initialisation routines. The function
                   12709:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12710:                   <code class=
                   12711:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12712:                   included in executables.</p>
                   12713:                 </li>
                   12714:               </ul>
                   12715:             </div>
                   12716:           </div>
                   12717: 
1.57      minskim  12718:           <div class="sect2" lang="en">
1.1       grant    12719:             <div class="titlepage">
                   12720:               <div>
                   12721:                 <div>
1.57      minskim  12722:                   <h3 class="title"><a name=
1.38      dillo    12723:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12724:                   Autoconf/Automake</h3>
                   12725:                 </div>
                   12726:               </div>
                   12727:             </div>
                   12728: 
                   12729:             <p>If a package needs GNU autoconf or automake to be
                   12730:             executed to regenerate the configure script and
                   12731:             Makefile.in makefile templates, then they should be
1.35      jmmv     12732:             executed in a pre-configure target.</p>
1.1       grant    12733: 
                   12734:             <p>For packages that need only autoconf:</p>
                   12735:             <pre class="programlisting">
1.51      rillig   12736:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   12737:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   12738:     ...
1.1       grant    12739: 
1.51      rillig   12740:     pre-configure:
                   12741:             cd ${WRKSRC}; autoconf
1.1       grant    12742: 
1.51      rillig   12743:     ...
1.1       grant    12744: </pre>
                   12745: 
                   12746:             <p>and for packages that need automake and
                   12747:             autoconf:</p>
                   12748:             <pre class="programlisting">
1.51      rillig   12749:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   12750:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   12751:     ...
1.1       grant    12752: 
1.51      rillig   12753:     pre-configure:
                   12754:             cd ${WRKSRC};                          \
                   12755:             aclocal; autoheader;                   \
                   12756:             automake -a --foreign -i; autoconf
                   12757: 
                   12758:     ...
1.1       grant    12759: </pre>
                   12760: 
                   12761:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12762:             certainly require GNU Make.</p>
1.1       grant    12763: 
                   12764:             <p>There are times when the configure process makes
                   12765:             additional changes to the generated files, which then
                   12766:             causes the build process to try to re-execute the
                   12767:             automake sequence. This is prevented by touching
                   12768:             various files in the configure stage. If this causes
1.14      xtraeme  12769:             problems with your package you can set <code class=
                   12770:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12771:             Makefile.</p>
                   12772:           </div>
                   12773:         </div>
                   12774: 
1.57      minskim  12775:         <div class="sect1" lang="en">
1.1       grant    12776:           <div class="titlepage">
                   12777:             <div>
                   12778:               <div>
                   12779:                 <h2 class="title" style="clear: both"><a name=
1.55      rillig   12780:                 "fixes-build"></a>15.4.&nbsp;Building the
                   12781:                 package</h2>
1.1       grant    12782:               </div>
                   12783:             </div>
                   12784:           </div>
                   12785: 
1.57      minskim  12786:           <div class="sect2" lang="en">
1.1       grant    12787:             <div class="titlepage">
                   12788:               <div>
                   12789:                 <div>
1.57      minskim  12790:                   <h3 class="title"><a name=
1.38      dillo    12791:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12792:                 </div>
                   12793:               </div>
                   12794:             </div>
                   12795: 
1.55      rillig   12796:             <p>Sometimes you need to compile different code
                   12797:             depending on the target platform. The C preprocessor
                   12798:             has a set of predefined macros that can be queried by
                   12799:             using <code class="varname">#ifdef FOO</code> or
                   12800:             <code class="varname">#if defined(FOO)</code>. Among
                   12801:             these macros are usually ones that describe the target
                   12802:             CPU and operating system. Depending of which of the
                   12803:             macros are defined, you can write code that uses
                   12804:             features unique to a specific platform. The best way to
                   12805:             handle these differences is to use the GNU autotools
                   12806:             (automake, autoconf, etc.) to check for specific
                   12807:             features (like the existence of a header file, a
                   12808:             function or a library).</p>
                   12809: 
                   12810:             <p>If that is not possible you can use the predefined
                   12811:             macros below to configure your code to the platform it
                   12812:             runs on. Almost every operating system, hardware
                   12813:             architecture and compiler has its own macro. For
                   12814:             example, if the macros <code class=
                   12815:             "varname">__GNUC__</code>, <code class=
                   12816:             "varname">__i386__</code> and <code class=
                   12817:             "varname">__NetBSD__</code> are all defined, you know
                   12818:             that you are using NetBSD on an Intel CPU, and your
                   12819:             compiler is GCC.</p>
                   12820: 
1.57      minskim  12821:             <div class="sect3" lang="en">
1.55      rillig   12822:               <div class="titlepage">
                   12823:                 <div>
                   12824:                   <div>
                   12825:                     <h4 class="title"><a name=
                   12826:                     "fixes-build-cpp-opsys"></a>15.4.1.1.&nbsp;CPP
                   12827:                     defines for operating systems</h4>
                   12828:                   </div>
                   12829:                 </div>
                   12830:               </div>
                   12831: 
                   12832:               <p>To distinguish between 4.4 BSD-derived systems and
                   12833:               the rest of the world, you should use the following
                   12834:               code.</p>
                   12835:               <pre class="programlisting">
1.51      rillig   12836:     #include &lt;sys/param.h&gt;
1.55      rillig   12837:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   12838:       /* your BSD-specific code goes here */
                   12839:     #else
                   12840:       /* non-BSD-specific code */
                   12841:     #endif
1.1       grant    12842: </pre>
                   12843: 
1.55      rillig   12844:               <p>If this distinction is not fine enough, you can
                   12845:               also use the following defines.</p>
                   12846:               <pre class="programlisting">
                   12847:     FreeBSD     __FreeBSD__
1.56      rillig   12848:     DragonFly   __DragonFly__
1.57      minskim  12849:     Interix     __INTERIX
1.55      rillig   12850:     Linux       linux, __linux, __linux__
                   12851:     NetBSD      __NetBSD__
                   12852:     OpenBSD     __OpenBSD__
                   12853:     Solaris     sun, __sun (GCC and SunPro), __sun__ (only GCC)
1.1       grant    12854: </pre>
1.55      rillig   12855:             </div>
1.1       grant    12856: 
1.57      minskim  12857:             <div class="sect3" lang="en">
1.55      rillig   12858:               <div class="titlepage">
                   12859:                 <div>
                   12860:                   <div>
1.57      minskim  12861:                     <h4 class="title"><a name=
                   12862:                     "fixes-build-cpp-cpu"></a>15.4.1.2.&nbsp;CPP
1.55      rillig   12863:                     defines for CPUs</h4>
                   12864:                   </div>
                   12865:                 </div>
                   12866:               </div>
                   12867:               <pre class="programlisting">
                   12868:     i386        i386, __i386, __i386__
                   12869:     MIPS        __mips
                   12870:     SPARC       sparc, __sparc
                   12871: </pre>
                   12872:             </div>
                   12873: 
1.57      minskim  12874:             <div class="sect3" lang="en">
1.55      rillig   12875:               <div class="titlepage">
                   12876:                 <div>
                   12877:                   <div>
                   12878:                     <h4 class="title"><a name=
                   12879:                     "fixes-build-cpp-compiler"></a>15.4.1.3.&nbsp;CPP
                   12880:                     defines for compilers</h4>
                   12881:                   </div>
                   12882:                 </div>
                   12883:               </div>
                   12884:               <pre class="programlisting">
                   12885:     GCC         __GNUC__ (major version), __GNUC_MINOR__
                   12886: </pre>
                   12887:             </div>
1.1       grant    12888:           </div>
1.51      rillig   12889: 
1.57      minskim  12890:           <div class="sect2" lang="en">
1.51      rillig   12891:             <div class="titlepage">
                   12892:               <div>
                   12893:                 <div>
1.57      minskim  12894:                   <h3 class="title"><a name=
1.51      rillig   12895:                   "cpp-list"></a>15.4.2.&nbsp;Getting a list of CPP
                   12896:                   defines</h3>
                   12897:                 </div>
                   12898:               </div>
                   12899:             </div>
                   12900: 
                   12901:             <p>When your system uses the GNU C Compiler, you can
                   12902:             get a list of symbols that are defined by default, e.g.
                   12903:             to identify the platform, with the following
                   12904:             command:</p>
                   12905:             <pre class="programlisting">
                   12906:     gcc -E -dM - &lt; /dev/null 
                   12907: </pre>
                   12908:           </div>
1.1       grant    12909:         </div>
                   12910: 
1.57      minskim  12911:         <div class="sect1" lang="en">
1.1       grant    12912:           <div class="titlepage">
                   12913:             <div>
                   12914:               <div>
                   12915:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    12916:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    12917:                 specific actions</h2>
                   12918:               </div>
                   12919:             </div>
                   12920:           </div>
                   12921: 
1.57      minskim  12922:           <div class="sect2" lang="en">
1.1       grant    12923:             <div class="titlepage">
                   12924:               <div>
                   12925:                 <div>
1.57      minskim  12926:                   <h3 class="title"><a name=
1.38      dillo    12927:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  12928:                   interaction</h3>
1.1       grant    12929:                 </div>
                   12930:               </div>
                   12931:             </div>
                   12932: 
                   12933:             <p>Occasionally, packages require interaction from the
                   12934:             user, and this can be in a number of ways:</p>
                   12935: 
                   12936:             <div class="itemizedlist">
                   12937:               <ul type="disc">
                   12938:                 <li>
                   12939:                   <p>help in fetching the distfiles</p>
                   12940:                 </li>
                   12941: 
                   12942:                 <li>
                   12943:                   <p>help to configure the package before it is
                   12944:                   built</p>
                   12945:                 </li>
                   12946: 
                   12947:                 <li>
                   12948:                   <p>help during the build process</p>
                   12949:                 </li>
                   12950: 
                   12951:                 <li>
                   12952:                   <p>help during the installation of a package</p>
                   12953:                 </li>
                   12954:               </ul>
                   12955:             </div>
                   12956: 
1.14      xtraeme  12957:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    12958:             definition is provided to notify the pkgsrc mechanism
                   12959:             of an interactive stage which will be needed, and this
1.45      wiz      12960:             should be set in the package's <code xmlns=
                   12961:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12962:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    12963:             <pre class="programlisting">
1.51      rillig   12964:     INTERACTIVE_STAGE=      build
1.1       grant    12965: </pre>
                   12966: 
                   12967:             <p>Multiple interactive stages can be specified:</p>
                   12968:             <pre class="programlisting">
1.51      rillig   12969:     INTERACTIVE_STAGE=      configure install
1.1       grant    12970: </pre>
                   12971:           </div>
                   12972: 
1.57      minskim  12973:           <div class="sect2" lang="en">
1.1       grant    12974:             <div class="titlepage">
                   12975:               <div>
                   12976:                 <div>
1.57      minskim  12977:                   <h3 class="title"><a name=
1.38      dillo    12978:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    12979:                   licenses</h3>
                   12980:                 </div>
                   12981:               </div>
                   12982:             </div>
                   12983: 
1.44      gdt      12984:             <p>A package may be covered by a license which the user
                   12985:             has or has not agreed to accept. For these cases,
                   12986:             pkgsrc contains a mechanism to note that a package is
                   12987:             covered by a particular license, and the package cannot
                   12988:             be built unless the user has accepted the license.
                   12989:             (Installation of binary packages are not currently
                   12990:             subject to this mechanism.) Packages with licenses that
                   12991:             are either Open Source according to the Open Source
                   12992:             Initiative or Free according to the Free Software
                   12993:             Foundation will not be marked with a license tag.
                   12994:             Packages with licenses that have not been determined to
                   12995:             meet either definition will be marked with a license
                   12996:             tag referring to the license. This will prevent
                   12997:             building unless pkgsrc is informed that the license is
                   12998:             acceptable, and enables displaying the license.</p>
                   12999: 
                   13000:             <p>The license tag mechanism is intended to address
                   13001:             copyright-related issues surrounding building,
                   13002:             installing and using a package, and not to address
                   13003:             redistribution issues (see <code class=
                   13004:             "varname">RESTRICTED</code> and <code class=
                   13005:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13006:             above definition of licenses for which tags are not
                   13007:             needed implies that packages with redistribution
                   13008:             restrictions should have tags.</p>
                   13009: 
                   13010:             <p>Denoting that a package is covered by a particular
1.45      wiz      13011:             license is done by placing the license in <code xmlns=
                   13012:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13013:             "filename">pkgsrc/licenses</code> and setting the
                   13014:             <code class="varname">LICENSE</code> variable to a
                   13015:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13016:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13017:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13018:             target="_top"><code xmlns="" class=
                   13019:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13020:             <pre class="programlisting">
1.51      rillig   13021:     LICENSE=        xv-license
1.1       grant    13022: </pre>
                   13023: 
                   13024:             <p>When trying to build, the user will get a notice
1.44      gdt      13025:             that the package is covered by a license which has not
                   13026:             been accepted:</p>
1.1       grant    13027:             <pre class="programlisting">
1.51      rillig   13028:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13029: "userinput"><code>make</code></strong>
1.51      rillig   13030:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13031:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13032:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13033:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13034:     *** Error code 1
1.1       grant    13035: </pre>
                   13036: 
1.14      xtraeme  13037:             <p>The license can be viewed with <span><strong class=
                   13038:             "command">make show-license</strong></span>, and if it
                   13039:             is considered appropriate, the line printed above can
1.45      wiz      13040:             be added to <code xmlns=
                   13041:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13042:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13043:             of the particular license:</p>
1.1       grant    13044:             <pre class="programlisting">
1.51      rillig   13045:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13046: </pre>
                   13047: 
                   13048:             <p>When adding a package with a new license, the
1.45      wiz      13049:             license text should be added to <code xmlns=
                   13050:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13051:             "filename">pkgsrc/licenses</code> for displaying. A
                   13052:             list of known licenses can be seen in this directory as
                   13053:             well as by looking at the list of (commented out)
                   13054:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13055:             variable settings in <code xmlns=
                   13056:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13057:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13058: 
1.44      gdt      13059:             <p>The use of <code class=
                   13060:             "varname">LICENSE=shareware</code>, <code class=
                   13061:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13062:             language is deprecated because it does not crisply
                   13063:             refer to a particular license text. Another problem
                   13064:             with such usage is that it does not enable a user to
                   13065:             denote acceptance of the license for a single package
                   13066:             without accepting the same license text for another
                   13067:             package. In particular, this can be inappropriate when
                   13068:             e.g. one accepts a particular license to indicate to
                   13069:             pkgsrc that a fee has been paid.</p>
1.1       grant    13070:           </div>
                   13071: 
1.57      minskim  13072:           <div class="sect2" lang="en">
1.1       grant    13073:             <div class="titlepage">
                   13074:               <div>
                   13075:                 <div>
1.30      wiz      13076:                   <h3 class="title"><a name=
1.38      dillo    13077:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      13078:                   score files</h3>
1.1       grant    13079:                 </div>
                   13080:               </div>
                   13081:             </div>
                   13082: 
                   13083:             <p>Certain packages, most of them in the games
                   13084:             category, install a score file that allows all users on
                   13085:             the system to record their highscores. In order for
                   13086:             this to work, the binaries need to be installed setgid
                   13087:             and the score files owned by the appropriate group
                   13088:             and/or owner (traditionally the "games" user/group).
                   13089:             The following variables, documented in more detail in
1.45      wiz      13090:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13091:             class="filename">mk/defaults/mk.conf</code>, control
                   13092:             this behaviour: <code class=
1.14      xtraeme  13093:             "varname">SETGIDGAME</code>, <code class=
                   13094:             "varname">GAMEDATAMODE</code>, <code class=
                   13095:             "varname">GAMEGRP</code>, <code class=
                   13096:             "varname">GAMEMODE</code>, <code class=
                   13097:             "varname">GAMEOWN</code>.</p>
1.1       grant    13098: 
                   13099:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13100:             is disabled; setting <code class=
                   13101:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13102:             variables accordingly.</p>
                   13103: 
                   13104:             <p>A package should therefor never hard code file
1.14      xtraeme  13105:             ownership or access permissions but rely on
                   13106:             <code class="varname">INSTALL_GAME</code> and
                   13107:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13108:             these correctly.</p>
1.1       grant    13109:           </div>
                   13110: 
1.57      minskim  13111:           <div class="sect2" lang="en">
1.1       grant    13112:             <div class="titlepage">
                   13113:               <div>
                   13114:                 <div>
1.57      minskim  13115:                   <h3 class="title"><a name=
1.38      dillo    13116:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      13117:                   containing perl scripts</h3>
1.1       grant    13118:                 </div>
                   13119:               </div>
                   13120:             </div>
                   13121: 
                   13122:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13123:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13124:             that the proper interpreter path is set. <code class=
                   13125:             "varname">REPLACE_PERL</code> should contain a list of
                   13126:             scripts, relative to <code class=
                   13127:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13128:           </div>
                   13129: 
1.57      minskim  13130:           <div class="sect2" lang="en">
1.1       grant    13131:             <div class="titlepage">
                   13132:               <div>
                   13133:                 <div>
1.57      minskim  13134:                   <h3 class="title"><a name=
1.38      dillo    13135:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    13136:                   hardcoded paths to other interpreters</h3>
                   13137:                 </div>
                   13138:               </div>
                   13139:             </div>
                   13140: 
                   13141:             <p>Your package may also contain scripts with hardcoded
                   13142:             paths to other interpreters besides (or as well as)
                   13143:             perl. To correct the full pathname to the script
                   13144:             interpreter, you need to set the following definitions
1.45      wiz      13145:             in your <code xmlns=
                   13146:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13147:             "filename">Makefile</code> (we shall use
                   13148:             <span><strong class="command">tclsh</strong></span> in
                   13149:             this example):</p>
1.1       grant    13150:             <pre class="programlisting">
1.51      rillig   13151:     REPLACE_INTERPRETER+=   tcl
                   13152:     _REPLACE.tcl.old=       .*/bin/tclsh
                   13153:     _REPLACE.tcl.new=       ${PREFIX}/bin/tclsh
                   13154:     _REPLACE_FILES.tcl=     # list of tcl scripts which need to be fixed,
                   13155:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    13156: </pre>
                   13157:           </div>
                   13158: 
1.57      minskim  13159:           <div class="sect2" lang="en">
1.1       grant    13160:             <div class="titlepage">
                   13161:               <div>
                   13162:                 <div>
1.57      minskim  13163:                   <h3 class="title"><a name=
1.38      dillo    13164:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      13165:                   installing perl modules</h3>
1.1       grant    13166:                 </div>
                   13167:               </div>
                   13168:             </div>
                   13169: 
                   13170:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      13171:             include the Makefile fragment <code xmlns=
                   13172:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13173:             "filename">../../lang/perl5/module.mk</code>. It
                   13174:             provides a <span><strong class=
                   13175:             "command">do-configure</strong></span> target for the
                   13176:             standard perl configuration for such modules as well as
                   13177:             various hooks to tune this configuration. See comments
                   13178:             in this file for details.</p>
1.1       grant    13179: 
                   13180:             <p>Perl5 modules will install into different places
                   13181:             depending on the version of perl used during the build
                   13182:             process. To address this, pkgsrc will append lines to
1.45      wiz      13183:             the <code xmlns=
                   13184:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13185:             "filename">PLIST</code> corresponding to the files
                   13186:             listed in the installed <code xmlns=
                   13187:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13188:             "filename">.packlist</code> file generated by most
                   13189:             perl5 modules. This is invoked by defining <code class=
                   13190:             "varname">PERL5_PACKLIST</code> to a space-separated
                   13191:             list of paths to packlist files, e.g.:</p>
1.1       grant    13192:             <pre class="programlisting">
1.51      rillig   13193:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    13194: </pre>
                   13195: 
1.14      xtraeme  13196:             <p>The variables <code class=
                   13197:             "varname">PERL5_SITELIB</code>, <code class=
                   13198:             "varname">PERL5_SITEARCH</code>, and <code class=
                   13199:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    13200:             locations in which perl5 modules may be installed, and
                   13201:             may be used by perl5 packages that don't have a
                   13202:             packlist. These three variables are also substituted
1.45      wiz      13203:             for in the <code xmlns=
                   13204:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13205:             "filename">PLIST</code>.</p>
1.1       grant    13206:           </div>
                   13207: 
1.57      minskim  13208:           <div class="sect2" lang="en">
1.1       grant    13209:             <div class="titlepage">
                   13210:               <div>
                   13211:                 <div>
1.57      minskim  13212:                   <h3 class="title"><a name=
1.38      dillo    13213:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    13214:                   installing info files</h3>
                   13215:                 </div>
                   13216:               </div>
                   13217:             </div>
                   13218: 
                   13219:             <p>Some packages install info files or use the
                   13220:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   13221:             &#8220;<span class="quote">install-info</span>&#8221;
                   13222:             commands. Each of the info files:</p>
                   13223: 
                   13224:             <div class="itemizedlist">
                   13225:               <ul type="disc">
                   13226:                 <li>
                   13227:                   <p>is considered to be installed in the directory
1.45      wiz      13228:                   <code xmlns=
                   13229:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13230:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    13231:                 </li>
                   13232: 
                   13233:                 <li>
                   13234:                   <p>is registered in the Info directory file
1.45      wiz      13235:                   <code xmlns=
                   13236:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13237:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    13238:                 </li>
                   13239: 
                   13240:                 <li>
                   13241:                   <p>and must be listed as a filename in the
1.14      xtraeme  13242:                   <code class="varname">INFO_FILES</code> variable
                   13243:                   in the package Makefile.</p>
1.1       grant    13244:                 </li>
                   13245:               </ul>
                   13246:             </div>
                   13247: 
1.14      xtraeme  13248:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    13249:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      13250:             be overridden in the package Makefile. <code xmlns=
                   13251:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13252:             "filename">INSTALL</code> and <code xmlns=
                   13253:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13254:             "filename">DEINSTALL</code> scripts will be generated
                   13255:             to handle registration of the info files in the Info
1.1       grant    13256:             directory file. The &#8220;<span class=
                   13257:             "quote">install-info</span>&#8221; command used for the
                   13258:             info files registration is either provided by the
                   13259:             system, or by a special purpose package automatically
                   13260:             added as dependency if needed.</p>
                   13261: 
                   13262:             <p>A package which needs the &#8220;<span class=
                   13263:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  13264:             must define the variable <code class=
                   13265:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    13266:             minimum version of the &#8220;<span class=
                   13267:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  13268:             should be noted with the <code class=
                   13269:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      13270:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13271:             class="filename">Makefile</code>. By default, a minimum
                   13272:             version of 3.12 is required. If the system does not
                   13273:             provide a <span><strong class=
1.14      xtraeme  13274:             "command">makeinfo</strong></span> command or if it
                   13275:             does not match the required minimum, a build dependency
                   13276:             on the <a xmlns=
                   13277:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    13278:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      13279:             target="_top"><code xmlns="" class=
                   13280:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      13281:             added automatically.</p>
1.1       grant    13282: 
                   13283:             <p>The build and installation process of the software
                   13284:             provided by the package should not use the
1.14      xtraeme  13285:             <span><strong class=
                   13286:             "command">install-info</strong></span> command as the
                   13287:             registration of info files is the task of the package
1.45      wiz      13288:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13289:             class="filename">INSTALL</code> script, and it must use
                   13290:             the appropriate <span><strong class=
1.14      xtraeme  13291:             "command">makeinfo</strong></span> command.</p>
1.1       grant    13292: 
1.47      reed     13293:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  13294:             creates overriding scripts for the <span><strong class=
                   13295:             "command">install-info</strong></span> and
                   13296:             <span><strong class="command">makeinfo</strong></span>
                   13297:             commands in a directory listed early in <code class=
                   13298:             "varname">PATH</code>.</p>
1.1       grant    13299: 
1.14      xtraeme  13300:             <p>The script overriding <span><strong class=
                   13301:             "command">install-info</strong></span> has no effect
                   13302:             except the logging of a message. The script overriding
                   13303:             <span><strong class="command">makeinfo</strong></span>
                   13304:             logs a message and according to the value of
                   13305:             <code class="varname">USE_MAKEINFO</code> and
                   13306:             <code class="varname">TEXINFO_REQD</code> either run
                   13307:             the appropriate <span><strong class=
                   13308:             "command">makeinfo</strong></span> command or exit on
                   13309:             error.</p>
1.1       grant    13310:           </div>
                   13311: 
1.57      minskim  13312:           <div class="sect2" lang="en">
                   13313:             <div class="titlepage">
                   13314:               <div>
                   13315:                 <div>
                   13316:                   <h3 class="title"><a name=
                   13317:                   "manpages"></a>15.5.8.&nbsp;Packages installing
                   13318:                   man pages</h3>
                   13319:                 </div>
                   13320:               </div>
                   13321:             </div>
                   13322: 
                   13323:             <p>Many packages install manual pages. The man pages
                   13324:             are installed under <code class=
                   13325:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   13326:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13327:             class="filename">/usr/pkg/man</code> by default.
                   13328:             <code class="varname">PKGMANDIR</code> defaults to
                   13329:             &#8220;<span class="quote">man</span>&#8221;. For
                   13330:             example, you can set <code class=
                   13331:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   13332:             "quote">share/man</span>&#8221; to have man pages
                   13333:             install under <code xmlns=
                   13334:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13335:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   13336: 
                   13337:             <div class="note" style=
                   13338:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13339:               <h3 class="title">Note</h3>
                   13340: 
                   13341:               <p>The support for a custom <code class=
                   13342:               "varname">PKGMANDIR</code> is not complete.</p>
                   13343:             </div>
                   13344: 
                   13345:             <p>The <code xmlns=
                   13346:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13347:             "filename">PLIST</code> files can just use <code xmlns=
                   13348:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13349:             "filename">man/</code> as the top level directory for
                   13350:             the man page file entries and the pkgsrc framework will
                   13351:             convert as needed.</p>
                   13352: 
                   13353:             <p>Packages that are configured with <code class=
                   13354:             "varname">GNU_CONFIGURE</code> set as
                   13355:             &#8220;<span class="quote">yes</span>&#8221;, by
                   13356:             default will use the <code xmlns=
                   13357:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13358:             "filename">./configure</code> --mandir switch to set
                   13359:             where the man pages should be installed. The path is
                   13360:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   13361:             defaults to <code class=
                   13362:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   13363: 
                   13364:             <p>Packages that use <code class=
                   13365:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   13366:             can set <code class=
                   13367:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   13368:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   13369:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13370:             class="filename">./configure</code> script uses a
                   13371:             non-standard use of --mandir, you can set <code class=
                   13372:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   13373: 
                   13374:             <p>See <a href="#manpage-compression" title=
                   13375:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   13376:             &#8220;Man page compression&#8221;</a> for information
                   13377:             on installation of compressed manual pages.</p>
                   13378:           </div>
                   13379: 
                   13380:           <div class="sect2" lang="en">
1.1       grant    13381:             <div class="titlepage">
                   13382:               <div>
                   13383:                 <div>
1.57      minskim  13384:                   <h3 class="title"><a name=
                   13385:                   "gconf2-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      13386:                   installing GConf2 data files</h3>
1.1       grant    13387:                 </div>
                   13388:               </div>
                   13389:             </div>
                   13390: 
1.45      wiz      13391:             <p>If a package installs <code xmlns=
                   13392:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13393:             "filename">.schemas</code> or <code xmlns=
                   13394:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13395:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    13396:             need to take some extra steps to make sure they get
                   13397:             registered in the database:</p>
                   13398: 
                   13399:             <div class="orderedlist">
                   13400:               <ol type="1">
                   13401:                 <li>
1.45      wiz      13402:                   <p>Include <code xmlns=
                   13403:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13404:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      13405:                   instead of its <code xmlns=
                   13406:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13407:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13408:                   care of rebuilding the GConf2 database at
                   13409:                   installation and deinstallation time, and tells
                   13410:                   the package where to install GConf2 data files
                   13411:                   using some standard configure arguments. It also
                   13412:                   disallows any access to the database directly
                   13413:                   from the package.</p>
                   13414:                 </li>
                   13415: 
                   13416:                 <li>
                   13417:                   <p>Ensure that the package installs its
1.45      wiz      13418:                   <code xmlns=
                   13419:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13420:                   "filename">.schemas</code> files under
                   13421:                   <code xmlns=
                   13422:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13423:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      13424:                   If they get installed under <code xmlns=
                   13425:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13426:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    13427:                   manually patch the package.</p>
                   13428:                 </li>
                   13429: 
                   13430:                 <li>
                   13431:                   <p>Check the PLIST and remove any entries under
                   13432:                   the etc/gconf directory, as they will be handled
                   13433:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    13434:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   13435:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     13436:                   location of configuration files?&#8221;</a> for
                   13437:                   more information.</p>
1.1       grant    13438:                 </li>
                   13439: 
                   13440:                 <li>
1.14      xtraeme  13441:                   <p>Define the <code class=
                   13442:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      13443:                   <code xmlns=
                   13444:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13445:                   "filename">Makefile</code> with a list of all
                   13446:                   <code xmlns=
                   13447:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13448:                   "filename">.schemas</code> files installed by the
                   13449:                   package, if any. Names must not contain any
                   13450:                   directories in them.</p>
1.1       grant    13451:                 </li>
                   13452: 
                   13453:                 <li>
1.14      xtraeme  13454:                   <p>Define the <code class=
                   13455:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      13456:                   <code xmlns=
                   13457:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13458:                   "filename">Makefile</code> with a list of all
                   13459:                   <code xmlns=
                   13460:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13461:                   "filename">.entries</code> files installed by the
                   13462:                   package, if any. Names must not contain any
                   13463:                   directories in them.</p>
1.1       grant    13464:                 </li>
                   13465:               </ol>
                   13466:             </div>
                   13467:           </div>
                   13468: 
1.57      minskim  13469:           <div class="sect2" lang="en">
1.1       grant    13470:             <div class="titlepage">
                   13471:               <div>
                   13472:                 <div>
1.30      wiz      13473:                   <h3 class="title"><a name=
1.57      minskim  13474:                   "scrollkeeper-data-files"></a>15.5.10.&nbsp;Packages
1.30      wiz      13475:                   installing scrollkeeper data files</h3>
1.1       grant    13476:                 </div>
                   13477:               </div>
                   13478:             </div>
                   13479: 
1.45      wiz      13480:             <p>If a package installs <code xmlns=
                   13481:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13482:             "filename">.omf</code> files, used by scrollkeeper, you
                   13483:             need to take some extra steps to make sure they get
                   13484:             registered in the database:</p>
1.1       grant    13485: 
                   13486:             <div class="orderedlist">
                   13487:               <ol type="1">
                   13488:                 <li>
1.45      wiz      13489:                   <p>Include <code xmlns=
                   13490:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13491:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      13492:                   instead of its <code xmlns=
                   13493:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13494:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    13495:                   care of rebuilding the scrollkeeper database at
                   13496:                   installation and deinstallation time, and
                   13497:                   disallows any access to it directly from the
                   13498:                   package.</p>
                   13499:                 </li>
                   13500: 
                   13501:                 <li>
                   13502:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13503:                   the <code xmlns=
                   13504:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13505:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    13506:                   as they will be handled automatically.</p>
                   13507:                 </li>
                   13508: 
                   13509:                 <li>
1.45      wiz      13510:                   <p>Remove the <code xmlns=
                   13511:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13512:                   "filename">share/omf</code> directory from the
                   13513:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    13514:                 </li>
                   13515:               </ol>
                   13516:             </div>
                   13517:           </div>
                   13518: 
1.57      minskim  13519:           <div class="sect2" lang="en">
1.1       grant    13520:             <div class="titlepage">
                   13521:               <div>
                   13522:                 <div>
1.57      minskim  13523:                   <h3 class="title"><a name=
                   13524:                   "x11-fonts"></a>15.5.11.&nbsp;Packages installing
1.1       grant    13525:                   X11 fonts</h3>
                   13526:                 </div>
                   13527:               </div>
                   13528:             </div>
                   13529: 
                   13530:             <p>If a package installs font files, you will need to
                   13531:             rebuild the fonts database in the directory where they
                   13532:             get installed at installation and deinstallation time.
1.45      wiz      13533:             This can be automatically done by using <code xmlns=
                   13534:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13535:             "filename">mk/fonts.mk</code>, which you need to
1.45      wiz      13536:             include in your <code xmlns=
                   13537:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13538:             "filename">Makefile</code>.</p>
1.1       grant    13539: 
                   13540:             <p>When the file is included, you can list the
1.14      xtraeme  13541:             directories where fonts are installed in the
                   13542:             <code class="varname">FONTS_<em class=
                   13543:             "replaceable"><code>type</code></em>_DIRS</code>
                   13544:             variables, where <em class=
                   13545:             "replaceable"><code>type</code></em> can be one of
                   13546:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    13547:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   13548:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.45      wiz      13549:             sure that the database file <code xmlns=
                   13550:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13551:             "filename">fonts.dir</code> is not listed in the
1.1       grant    13552:             PLIST.</p>
                   13553: 
                   13554:             <p>Note that you should not create new directories for
                   13555:             fonts; instead use the standard ones to avoid that the
                   13556:             user needs to manually configure his X server to find
                   13557:             them.</p>
                   13558:           </div>
                   13559: 
1.57      minskim  13560:           <div class="sect2" lang="en">
1.1       grant    13561:             <div class="titlepage">
                   13562:               <div>
                   13563:                 <div>
1.57      minskim  13564:                   <h3 class="title"><a name=
                   13565:                   "gtk2-modules"></a>15.5.12.&nbsp;Packages
1.30      wiz      13566:                   installing GTK2 modules</h3>
1.1       grant    13567:                 </div>
                   13568:               </div>
                   13569:             </div>
                   13570: 
1.47      reed     13571:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    13572:             need to take some extra steps to get them registered in
                   13573:             the GTK2 database properly:</p>
                   13574: 
                   13575:             <div class="orderedlist">
                   13576:               <ol type="1">
                   13577:                 <li>
1.45      wiz      13578:                   <p>Include <code xmlns=
                   13579:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13580:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      13581:                   instead of its <code xmlns=
                   13582:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13583:                   "filename">buildlink3.mk</code> file. This takes
                   13584:                   care of rebuilding the database at installation
                   13585:                   and deinstallation time.</p>
1.1       grant    13586:                 </li>
                   13587: 
                   13588:                 <li>
1.14      xtraeme  13589:                   <p>Set <code class=
                   13590:                   "varname">GTK2_IMMODULES=YES</code> if your
                   13591:                   package installs GTK2 immodules.</p>
1.1       grant    13592:                 </li>
                   13593: 
                   13594:                 <li>
1.14      xtraeme  13595:                   <p>Set <code class=
                   13596:                   "varname">GTK2_LOADERS=YES</code> if your package
                   13597:                   installs GTK2 loaders.</p>
1.1       grant    13598:                 </li>
                   13599: 
                   13600:                 <li>
1.47      reed     13601:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    13602:                   databases directly. These are:</p>
                   13603: 
                   13604:                   <div class="itemizedlist">
                   13605:                     <ul type="disc">
                   13606:                       <li>
1.45      wiz      13607:                         <p><code xmlns=
                   13608:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13609:                         class=
1.14      xtraeme  13610:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    13611:                       </li>
                   13612: 
                   13613:                       <li>
1.45      wiz      13614:                         <p><code xmlns=
                   13615:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13616:                         class=
1.14      xtraeme  13617:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    13618:                       </li>
                   13619:                     </ul>
                   13620:                   </div>
                   13621:                 </li>
                   13622: 
                   13623:                 <li>
                   13624:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13625:                   the <code xmlns=
                   13626:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13627:                   "filename">libdata/gtk-2.0</code> directory, as
                   13628:                   they will be handled automatically.</p>
1.1       grant    13629:                 </li>
                   13630:               </ol>
                   13631:             </div>
                   13632:           </div>
                   13633: 
1.57      minskim  13634:           <div class="sect2" lang="en">
1.1       grant    13635:             <div class="titlepage">
                   13636:               <div>
                   13637:                 <div>
1.57      minskim  13638:                   <h3 class="title"><a name=
                   13639:                   "sgml-xml-data"></a>15.5.13.&nbsp;Packages
1.30      wiz      13640:                   installing SGML or XML data</h3>
1.1       grant    13641:                 </div>
                   13642:               </div>
                   13643:             </div>
                   13644: 
                   13645:             <p>If a package installs SGML or XML data files that
                   13646:             need to be registered in system-wide catalogs (like
                   13647:             DTDs, sub-catalogs, etc.), you need to take some extra
                   13648:             steps:</p>
                   13649: 
                   13650:             <div class="orderedlist">
                   13651:               <ol type="1">
                   13652:                 <li>
1.45      wiz      13653:                   <p>Include <code xmlns=
                   13654:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13655:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      13656:                   in your <code xmlns=
                   13657:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13658:                   "filename">Makefile</code>, which takes care of
                   13659:                   registering those files in system-wide catalogs
                   13660:                   at installation and deinstallation time.</p>
1.1       grant    13661:                 </li>
                   13662: 
                   13663:                 <li>
1.14      xtraeme  13664:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13665:                   to the full path of any SGML catalogs installed
                   13666:                   by the package.</p>
1.1       grant    13667:                 </li>
                   13668: 
                   13669:                 <li>
1.14      xtraeme  13670:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13671:                   to the full path of any XML catalogs installed by
1.1       grant    13672:                   the package.</p>
                   13673:                 </li>
                   13674: 
                   13675:                 <li>
1.14      xtraeme  13676:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13677:                   to individual entries to be added to the SGML
1.1       grant    13678:                   catalog. These come in groups of three strings;
                   13679:                   see xmlcatmgr(1) for more information
                   13680:                   (specifically, arguments recognized by the 'add'
                   13681:                   action). Note that you will normally not use this
                   13682:                   variable.</p>
                   13683:                 </li>
                   13684: 
                   13685:                 <li>
1.14      xtraeme  13686:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13687:                   to individual entries to be added to the XML
1.1       grant    13688:                   catalog. These come in groups of three strings;
                   13689:                   see xmlcatmgr(1) for more information
                   13690:                   (specifically, arguments recognized by the 'add'
                   13691:                   action). Note that you will normally not use this
                   13692:                   variable.</p>
                   13693:                 </li>
                   13694:               </ol>
                   13695:             </div>
                   13696:           </div>
                   13697: 
1.57      minskim  13698:           <div class="sect2" lang="en">
1.1       grant    13699:             <div class="titlepage">
                   13700:               <div>
                   13701:                 <div>
1.57      minskim  13702:                   <h3 class="title"><a name=
                   13703:                   "mime-database"></a>15.5.14.&nbsp;Packages
1.30      wiz      13704:                   installing extensions to the MIME database</h3>
1.1       grant    13705:                 </div>
                   13706:               </div>
                   13707:             </div>
                   13708: 
                   13709:             <p>If a package provides extensions to the MIME
1.45      wiz      13710:             database by installing <code xmlns=
                   13711:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13712:             "filename">.xml</code> files inside <code xmlns=
                   13713:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13714:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13715:             need to take some extra steps to ensure that the
                   13716:             database is kept consistent with respect to these new
                   13717:             files:</p>
1.1       grant    13718: 
                   13719:             <div class="orderedlist">
                   13720:               <ol type="1">
                   13721:                 <li>
1.45      wiz      13722:                   <p>Include <code xmlns=
                   13723:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13724:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13725:                   (avoid using the <code xmlns=
                   13726:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13727:                   "filename">buildlink3.mk</code> file from this
                   13728:                   same directory, which is reserved for inclusion
1.45      wiz      13729:                   from other <code xmlns=
                   13730:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13731:                   "filename">buildlink3.mk</code> files). It takes
                   13732:                   care of rebuilding the MIME database at
                   13733:                   installation and deinstallation time, and
                   13734:                   disallows any access to it directly from the
1.1       grant    13735:                   package.</p>
                   13736:                 </li>
                   13737: 
                   13738:                 <li>
                   13739:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13740:                   the <code xmlns=
                   13741:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13742:                   "filename">share/mime</code> directory,
                   13743:                   <span class="emphasis"><em>except</em></span> for
                   13744:                   files saved under <code xmlns=
                   13745:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13746:                   "filename">share/mime/packages</code>. The former
1.1       grant    13747:                   are handled automatically by the
1.47      reed     13748:                   update-mime-database program, but the latter are
1.1       grant    13749:                   package-dependent and must be removed by the
                   13750:                   package that installed them in the first
                   13751:                   place.</p>
                   13752:                 </li>
                   13753: 
                   13754:                 <li>
1.45      wiz      13755:                   <p>Remove any <code xmlns=
                   13756:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13757:                   "filename">share/mime/*</code> directories from
                   13758:                   the PLIST. They will be handled by the
1.1       grant    13759:                   shared-mime-info package.</p>
                   13760:                 </li>
                   13761:               </ol>
                   13762:             </div>
                   13763:           </div>
                   13764: 
1.57      minskim  13765:           <div class="sect2" lang="en">
1.1       grant    13766:             <div class="titlepage">
                   13767:               <div>
                   13768:                 <div>
1.57      minskim  13769:                   <h3 class="title"><a name=
                   13770:                   "intltool"></a>15.5.15.&nbsp;Packages using
1.1       grant    13771:                   intltool</h3>
                   13772:                 </div>
                   13773:               </div>
                   13774:             </div>
                   13775: 
                   13776:             <p>If a package uses intltool during its build, include
1.45      wiz      13777:             the <code xmlns=
                   13778:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13779:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    13780:             file, which forces it to use the intltool package
                   13781:             provided by pkgsrc, instead of the one bundled with the
                   13782:             distribution file.</p>
                   13783: 
                   13784:             <p>This tracks intltool's build-time dependencies and
                   13785:             uses the latest available version; this way, the
                   13786:             package benefits of any bug fixes that may have
                   13787:             appeared since it was released.</p>
                   13788:           </div>
1.18      xtraeme  13789: 
1.57      minskim  13790:           <div class="sect2" lang="en">
1.18      xtraeme  13791:             <div class="titlepage">
                   13792:               <div>
                   13793:                 <div>
1.57      minskim  13794:                   <h3 class="title"><a name=
                   13795:                   "startup-scripts"></a>15.5.16.&nbsp;Packages
1.30      wiz      13796:                   installing startup scripts</h3>
1.18      xtraeme  13797:                 </div>
                   13798:               </div>
                   13799:             </div>
                   13800: 
                   13801:             <p>If a package contains a rc.d script, it won't be
                   13802:             copied into the startup directory by default, but you
                   13803:             can enable it, by adding the option <code class=
1.45      wiz      13804:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   13805:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13806:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      13807:             the scripts into <code xmlns=
                   13808:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13809:             "filename">/etc/rc.d</code> when a package is
                   13810:             installed, and it will automatically remove the scripts
                   13811:             when the package is deinstalled.</p>
                   13812:           </div>
1.57      minskim  13813: 
                   13814:           <div class="sect2" lang="en">
                   13815:             <div class="titlepage">
                   13816:               <div>
                   13817:                 <div>
                   13818:                   <h3 class="title"><a name=
                   13819:                   "tex-packages"></a>15.5.17.&nbsp;Packages
                   13820:                   installing TeX modules</h3>
                   13821:                 </div>
                   13822:               </div>
                   13823:             </div>
                   13824: 
                   13825:             <p>If a package installs TeX packages into the texmf
                   13826:             tree, the <code xmlns=
                   13827:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13828:             "filename">ls-R</code> database of the tree needs to be
                   13829:             updated.</p>
                   13830: 
                   13831:             <div class="note" style=
                   13832:             "margin-left: 0.5in; margin-right: 0.5in;">
                   13833:               <h3 class="title">Note</h3>
                   13834: 
                   13835:               <p>Except the main TeX packages such as teTeX-texmf,
                   13836:               packages should install files into <code class=
                   13837:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   13838:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   13839:             </div>
                   13840: 
                   13841:             <div class="orderedlist">
                   13842:               <ol type="1">
                   13843:                 <li>
                   13844:                   <p>Include <code xmlns=
                   13845:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13846:                   "filename">../../print/teTeX/module.mk</code>
                   13847:                   instead of <code xmlns=
                   13848:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13849:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   13850:                   This takes care of rebuilding the <code xmlns=
                   13851:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13852:                   "filename">ls-R</code> database at installation
                   13853:                   and deinstallation time.</p>
                   13854:                 </li>
                   13855: 
                   13856:                 <li>
                   13857:                   <p>If your package installs files into a texmf
                   13858:                   tree other than the one at <code class=
                   13859:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   13860:                   <code class="varname">TEXMFDIRS</code> to the
                   13861:                   list of all texmf trees that need database
                   13862:                   update.</p>
                   13863:                 </li>
                   13864: 
                   13865:                 <li>
                   13866:                   <p>Make sure that none of <code xmlns=
                   13867:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13868:                   "filename">ls-R</code> databases are included in
                   13869:                   <code xmlns=
                   13870:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13871:                   "filename">PLIST</code>, as they will be removed
                   13872:                   only by the teTeX-bin package.</p>
                   13873:                 </li>
                   13874:               </ol>
                   13875:             </div>
                   13876:           </div>
1.1       grant    13877:         </div>
                   13878: 
1.57      minskim  13879:         <div class="sect1" lang="en">
1.1       grant    13880:           <div class="titlepage">
                   13881:             <div>
                   13882:               <div>
                   13883:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    13884:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      13885:                 author</h2>
1.1       grant    13886:               </div>
                   13887:             </div>
                   13888:           </div>
                   13889: 
                   13890:           <p>If you have found any bugs in the package you make
                   13891:           available, if you had to do special steps to make it run
                   13892:           under NetBSD or if you enhanced the software in various
                   13893:           other ways, be sure to report these changes back to the
                   13894:           original author of the program! With that kind of
                   13895:           support, the next release of the program can incorporate
                   13896:           these fixes, and people not using the NetBSD packages
                   13897:           system can win from your efforts.</p>
                   13898: 
                   13899:           <p>Support the idea of free software!</p>
                   13900:         </div>
                   13901:       </div>
                   13902: 
1.57      minskim  13903:       <div class="chapter" lang="en">
1.1       grant    13904:         <div class="titlepage">
                   13905:           <div>
                   13906:             <div>
1.57      minskim  13907:               <h2 class="title"><a name=
1.38      dillo    13908:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    13909:             </div>
                   13910:           </div>
                   13911:         </div>
                   13912: 
                   13913:         <p>To check out all the gotchas when building a package,
                   13914:         here are the steps that I do in order to get a package
                   13915:         working. Please note this is basically the same as what was
                   13916:         explained in the previous sections, only with some
                   13917:         debugging aids.</p>
                   13918: 
                   13919:         <div class="itemizedlist">
                   13920:           <ul type="disc">
                   13921:             <li>
1.14      xtraeme  13922:               <p>Be sure to set <code class=
1.45      wiz      13923:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   13924:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13925:               "filename">/etc/mk.conf</code></p>
1.1       grant    13926:             </li>
                   13927: 
                   13928:             <li>
                   13929:               <p>Install <a xmlns=
                   13930:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13931:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      13932:               target="_top"><code xmlns="" class=
                   13933:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      13934:               directory for a new package, change into it, then run
                   13935:               <span><strong class=
                   13936:               "command">url2pkg</strong></span>:</p>
1.1       grant    13937:               <pre class="screen">
1.14      xtraeme  13938: <code class="prompt">%</code> <strong class=
                   13939: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   13940: "replaceable"><code>category</code></em>/<em class=
                   13941: "replaceable"><code>examplepkg</code></em></code></strong>
                   13942: <code class="prompt">%</code> <strong class=
                   13943: "userinput"><code>cd /usr/pkgsrc/<em class=
                   13944: "replaceable"><code>category</code></em>/<em class=
                   13945: "replaceable"><code>examplepkg</code></em></code></strong>
                   13946: <code class="prompt">%</code> <strong class=
                   13947: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    13948: </pre>
                   13949:             </li>
                   13950: 
                   13951:             <li>
1.45      wiz      13952:               <p>Edit the <code xmlns=
                   13953:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13954:               "filename">Makefile</code> as requested.</p>
1.1       grant    13955:             </li>
                   13956: 
                   13957:             <li>
1.45      wiz      13958:               <p>Fill in the <code xmlns=
                   13959:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13960:               "filename">DESCR</code> file</p>
1.1       grant    13961:             </li>
                   13962: 
                   13963:             <li>
1.14      xtraeme  13964:               <p>Run <span><strong class="command">make
                   13965:               configure</strong></span></p>
1.1       grant    13966:             </li>
                   13967: 
                   13968:             <li>
                   13969:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      13970:               and the configure step to the package's <code xmlns=
                   13971:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13972:               "filename">Makefile</code>.</p>
1.1       grant    13973:             </li>
                   13974: 
                   13975:             <li>
                   13976:               <p>Make the package compile, doing multiple rounds
                   13977:               of</p>
                   13978:               <pre class="screen">
1.14      xtraeme  13979: <code class="prompt">%</code> <strong class=
                   13980: "userinput"><code>make</code></strong>
                   13981: <code class="prompt">%</code> <strong class=
                   13982: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   13983: <code class="prompt">%</code> <strong class=
                   13984: "userinput"><code>mkpatches</code></strong>
                   13985: <code class="prompt">%</code> <strong class=
                   13986: "userinput"><code>patchdiff</code></strong>
                   13987: <code class="prompt">%</code> <strong class=
                   13988: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   13989: <code class="prompt">%</code> <strong class=
                   13990: "userinput"><code>make mps</code></strong>
                   13991: <code class="prompt">%</code> <strong class=
                   13992: "userinput"><code>make clean</code></strong>
1.1       grant    13993: </pre>
                   13994: 
                   13995:               <p>Doing as non-root user will ensure that no files
                   13996:               are modified that shouldn't be, especially during the
1.14      xtraeme  13997:               build phase. <span><strong class=
                   13998:               "command">mkpatches</strong></span>,
                   13999:               <span><strong class=
                   14000:               "command">patchdiff</strong></span> and
                   14001:               <span><strong class="command">pkgvi</strong></span>
                   14002:               are from the <a xmlns=
1.1       grant    14003:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14004:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14005:               target="_top"><code xmlns="" class=
                   14006:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14007:             </li>
                   14008: 
                   14009:             <li>
1.45      wiz      14010:               <p>Look at the <code xmlns=
                   14011:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14012:               "filename">Makefile</code>, fix if necessary; see
                   14013:               <a href="#components.Makefile" title=
1.38      dillo    14014:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14015:               &#8220;<code xmlns=
                   14016:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14017:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14018:             </li>
                   14019: 
                   14020:             <li>
1.45      wiz      14021:               <p>Generate a <code xmlns=
                   14022:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14023:               "filename">PLIST</code>:</p>
1.1       grant    14024:               <pre class="screen">
1.14      xtraeme  14025: <code class="prompt">#</code> <strong class=
                   14026: "userinput"><code>make install</code></strong>
                   14027: <code class="prompt">#</code> <strong class=
                   14028: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14029: <code class="prompt">#</code> <strong class=
                   14030: "userinput"><code>make deinstall</code></strong>
                   14031: <code class="prompt">#</code> <strong class=
                   14032: "userinput"><code>make install</code></strong>
                   14033: <code class="prompt">#</code> <strong class=
                   14034: "userinput"><code>make deinstall</code></strong>
1.1       grant    14035: </pre>
                   14036: 
1.45      wiz      14037:               <p>You usually need to be <code xmlns=
                   14038:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14039:               "username">root</code> to do this. Look if there are
1.1       grant    14040:               any files left:</p>
                   14041:               <pre class="screen">
1.14      xtraeme  14042: <code class="prompt">#</code> <strong class=
                   14043: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14044: </pre>
                   14045: 
                   14046:               <p>If this reveals any files that are missing in
1.45      wiz      14047:               <code xmlns=
                   14048:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14049:               "filename">PLIST</code>, add them.</p>
1.1       grant    14050:             </li>
                   14051: 
                   14052:             <li>
1.45      wiz      14053:               <p>Now that the <code xmlns=
                   14054:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14055:               "filename">PLIST</code> is OK, install the package
                   14056:               again and make a binary package:</p>
1.1       grant    14057:               <pre class="screen">
1.14      xtraeme  14058: <code class="prompt">#</code> <strong class=
                   14059: "userinput"><code>make reinstall</code></strong>
                   14060: <code class="prompt">#</code> <strong class=
                   14061: "userinput"><code>make package</code></strong>
1.1       grant    14062: </pre>
                   14063:             </li>
                   14064: 
                   14065:             <li>
                   14066:               <p>Delete the installed package:</p>
                   14067:               <pre class="screen">
1.14      xtraeme  14068: <code class="prompt">#</code> <strong class=
                   14069: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14070: </pre>
                   14071:             </li>
                   14072: 
                   14073:             <li>
1.14      xtraeme  14074:               <p>Repeat the above <span><strong class=
                   14075:               "command">make print-PLIST</strong></span> command,
                   14076:               which shouldn't find anything now:</p>
1.1       grant    14077:               <pre class="screen">
1.14      xtraeme  14078: <code class="prompt">#</code> <strong class=
                   14079: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14080: </pre>
                   14081:             </li>
                   14082: 
                   14083:             <li>
                   14084:               <p>Reinstall the binary package:</p>
                   14085:               <pre class="screen">
1.14      xtraeme  14086: <code class="prompt">#</code> <strong class=
                   14087: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14088: </pre>
                   14089:             </li>
                   14090: 
                   14091:             <li>
                   14092:               <p>Play with it. Make sure everything works.</p>
                   14093:             </li>
                   14094: 
                   14095:             <li>
1.14      xtraeme  14096:               <p>Run <span><strong class=
                   14097:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14098:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14099:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14100:               target="_top"><code xmlns="" class=
                   14101:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14102:               problems it reports:</p>
1.1       grant    14103:               <pre class="screen">
1.14      xtraeme  14104: <code class="prompt">#</code> <strong class=
                   14105: "userinput"><code>pkglint</code></strong>
1.1       grant    14106: </pre>
                   14107:             </li>
                   14108: 
                   14109:             <li>
                   14110:               <p>Submit (or commit, if you have cvs access); see
                   14111:               <a href="#submit" title=
1.38      dillo    14112:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    14113:               <i>Submitting and Committing</i></a>.</p>
                   14114:             </li>
                   14115:           </ul>
                   14116:         </div>
                   14117:       </div>
                   14118: 
1.57      minskim  14119:       <div class="chapter" lang="en">
1.1       grant    14120:         <div class="titlepage">
                   14121:           <div>
                   14122:             <div>
1.57      minskim  14123:               <h2 class="title"><a name=
1.38      dillo    14124:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    14125:               Committing</h2>
                   14126:             </div>
                   14127:           </div>
                   14128:         </div>
                   14129: 
                   14130:         <div class="toc">
                   14131:           <p><b>Table of Contents</b></p>
                   14132: 
                   14133:           <dl>
1.30      wiz      14134:             <dt><span class="sect1"><a href=
1.38      dillo    14135:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      14136:             packages</a></span></dt>
1.1       grant    14137: 
1.30      wiz      14138:             <dt><span class="sect1"><a href=
1.41      wiz      14139:             "#general-notes-for-changes">17.2. General notes when
                   14140:             adding, updating, or removing packages</a></span></dt>
                   14141: 
                   14142:             <dt><span class="sect1"><a href=
                   14143:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      14144:             package into CVS</a></span></dt>
1.1       grant    14145: 
1.30      wiz      14146:             <dt><span class="sect1"><a href=
1.41      wiz      14147:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      14148:             version</a></span></dt>
1.1       grant    14149: 
1.41      wiz      14150:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  14151:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    14152:           </dl>
                   14153:         </div>
                   14154: 
1.57      minskim  14155:         <div class="sect1" lang="en">
1.1       grant    14156:           <div class="titlepage">
                   14157:             <div>
                   14158:               <div>
                   14159:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    14160:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      14161:                 your packages</h2>
1.1       grant    14162:               </div>
                   14163:             </div>
                   14164:           </div>
                   14165: 
                   14166:           <p>You have to separate between binary and
                   14167:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   14168:           packages here:</p>
                   14169: 
                   14170:           <div class="itemizedlist">
                   14171:             <ul type="disc">
                   14172:               <li>
                   14173:                 <p>precompiled binary packages</p>
                   14174: 
                   14175:                 <p>Our policy is that we accept binaries only from
                   14176:                 pkgsrc developers to guarantee that the packages
                   14177:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  14178:                 annoy anyone but rather to protect our users!
1.1       grant    14179:                 You're still free to put up your home-made binary
1.13      hubertf  14180:                 packages and tell the world where to get them.
                   14181:                 NetBSD developers doing bulk builds and wanting to
                   14182:                 upload them please see <a href="#bulk-upload"
1.38      dillo    14183:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   14184:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  14185:                 bulk build&#8221;</a>.</p>
1.1       grant    14186:               </li>
                   14187: 
                   14188:               <li>
                   14189:                 <p>packages</p>
                   14190: 
                   14191:                 <p>First, check that your package is complete,
                   14192:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    14193:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    14194:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      14195:                 Next, generate an uuencoded gzipped <a href=
                   14196:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   14197:                 <span class="citerefentry"><span class=
                   14198:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    14199:                 preferably with all files in a single directory.
1.14      xtraeme  14200:                 Finally, <span><strong class=
                   14201:                 "command">send-pr</strong></span> with category
1.1       grant    14202:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   14203:                 synopsis which includes the package name and
                   14204:                 version number, a short description of your package
                   14205:                 (contents of the COMMENT variable or DESCR file are
                   14206:                 OK) and attach the archive to your PR.</p>
                   14207: 
                   14208:                 <p>If you want to submit several packages, please
                   14209:                 send a separate PR for each one, it's easier for us
                   14210:                 to track things that way.</p>
                   14211: 
                   14212:                 <p>Alternatively, you can also import new packages
                   14213:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   14214:                 work-in-progress</span>&#8221;); see the homepage
                   14215:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   14216:                 target=
                   14217:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   14218:                 details.</p>
                   14219:               </li>
                   14220:             </ul>
                   14221:           </div>
                   14222:         </div>
                   14223: 
1.57      minskim  14224:         <div class="sect1" lang="en">
1.1       grant    14225:           <div class="titlepage">
                   14226:             <div>
                   14227:               <div>
                   14228:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14229:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   14230:                 notes when adding, updating, or removing
                   14231:                 packages</h2>
                   14232:               </div>
                   14233:             </div>
                   14234:           </div>
                   14235: 
                   14236:           <p>Please note all package additions, updates, moves, and
1.45      wiz      14237:           removals in <code xmlns=
                   14238:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14239:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   14240:           to keep this file up to date and conforming to the
                   14241:           existing format, because it will be used by scripts to
                   14242:           automatically update pages on <a href=
                   14243:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      14244:           and other sites. Additionally, check the <code xmlns=
                   14245:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14246:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   14247:           entry for the package you updated or removed, in case it
                   14248:           was mentioned there.</p>
                   14249: 
                   14250:           <p>There is a make target that helps in creating proper
1.45      wiz      14251:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14252:           class="filename">CHANGES</code> entries:
1.41      wiz      14253:           <span><strong class="command">make
                   14254:           changes-entry</strong></span>. It uses the optional
                   14255:           <code class="varname">CTYPE</code> and <code class=
                   14256:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      14257:           usage is to first make sure that your <code xmlns=
                   14258:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14259:           "filename">CHANGES</code> file is up-to-date (to avoid
                   14260:           having to resolve conflicts later-on) and then to
                   14261:           <span><strong class="command">cd</strong></span> to the
                   14262:           package directory. For package updates,
                   14263:           <span><strong class="command">make
                   14264:           changes-entry</strong></span> is enough. For new
                   14265:           packages, or package moves or removals, set the
                   14266:           <code class="varname">CTYPE</code> variable on the
                   14267:           command line to "Added", "Moved", or "Removed". You can
                   14268:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      14269:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14270:           class="filename">/etc/mk.conf</code> if your local login
                   14271:           name is not the same as your NetBSD login name. Don't
                   14272:           forget to commit the changes to <code xmlns=
                   14273:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      14274:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   14275:         </div>
                   14276: 
1.57      minskim  14277:         <div class="sect1" lang="en">
1.41      wiz      14278:           <div class="titlepage">
                   14279:             <div>
                   14280:               <div>
                   14281:                 <h2 class="title" style="clear: both"><a name=
                   14282:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      14283:                 Importing a package into CVS</h2>
1.1       grant    14284:               </div>
                   14285:             </div>
                   14286:           </div>
                   14287: 
                   14288:           <p>This section is only of interest for pkgsrc developers
                   14289:           with write access to the pkgsrc repository. Please
                   14290:           remember that cvs imports files relative to the current
                   14291:           working directory, and that the pathname that you give
1.14      xtraeme  14292:           the <span><strong class="command">cvs
                   14293:           import</strong></span> command is so that it knows where
                   14294:           to place the files in the repository. Newly created
                   14295:           packages should be imported with a vendor tag of
                   14296:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   14297:           release tag of &#8220;<span class=
                   14298:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    14299:           <pre class="programlisting">
1.51      rillig   14300:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   14301:     <code class=
                   14302: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    14303: </pre>
                   14304: 
                   14305:           <p>Remember to move the directory from which you imported
                   14306:           out of the way, or cvs will complain the next time you
                   14307:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   14308:           source tree. Also don't forget to add the new package to
1.45      wiz      14309:           the category's <code xmlns=
                   14310:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14311:           "filename">Makefile</code>.</p>
1.1       grant    14312: 
                   14313:           <p>The commit message of the initial import should
1.45      wiz      14314:           include part of the <code xmlns=
                   14315:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   14316:           "filename">DESCR</code> file, so people reading the
                   14317:           mailing lists know what the package is/does.</p>
1.1       grant    14318: 
                   14319:           <p>For new packages, &#8220;<span class="quote">cvs
                   14320:           import</span>&#8221; is preferred to &#8220;<span class=
                   14321:           "quote">cvs add</span>&#8221; because the former gets
                   14322:           everything with a single command, and provides a
                   14323:           consistent tag.</p>
                   14324:         </div>
                   14325: 
1.57      minskim  14326:         <div class="sect1" lang="en">
1.1       grant    14327:           <div class="titlepage">
                   14328:             <div>
                   14329:               <div>
                   14330:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14331:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      14332:                 package to a newer version</h2>
1.1       grant    14333:               </div>
                   14334:             </div>
                   14335:           </div>
                   14336: 
                   14337:           <p>Please always put a concise, appropriate and relevant
                   14338:           summary of the changes between old and new versions into
                   14339:           the commit log when updating a package. There are various
                   14340:           reasons for this:</p>
                   14341: 
                   14342:           <div class="itemizedlist">
                   14343:             <ul type="disc">
                   14344:               <li>
                   14345:                 <p>A URL is volatile, and can change over time. It
                   14346:                 may go away completely or its information may be
                   14347:                 overwritten by newer information.</p>
                   14348:               </li>
                   14349: 
                   14350:               <li>
                   14351:                 <p>Having the change information between old and
                   14352:                 new versions in our CVS repository is very useful
                   14353:                 for people who use either cvs or anoncvs.</p>
                   14354:               </li>
                   14355: 
                   14356:               <li>
                   14357:                 <p>Having the change information between old and
                   14358:                 new versions in our CVS repository is very useful
                   14359:                 for people who read the pkgsrc-changes mailing
                   14360:                 list, so that they can make tactical decisions
                   14361:                 about when to upgrade the package.</p>
                   14362:               </li>
                   14363:             </ul>
                   14364:           </div>
                   14365: 
1.18      xtraeme  14366:           <p>Please also recognize that, just because a new version
1.1       grant    14367:           of a package has been released, it should not
                   14368:           automatically be upgraded in the CVS repository. We
                   14369:           prefer to be conservative in the packages that are
                   14370:           included in pkgsrc - development or beta packages are not
                   14371:           really the best thing for most places in which pkgsrc is
                   14372:           used. Please use your judgement about what should go into
                   14373:           pkgsrc, and bear in mind that stability is to be
                   14374:           preferred above new and possibly untested features.</p>
                   14375:         </div>
                   14376: 
1.57      minskim  14377:         <div class="sect1" lang="en">
1.1       grant    14378:           <div class="titlepage">
                   14379:             <div>
                   14380:               <div>
                   14381:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      14382:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      14383:                 pkgsrc</h2>
1.1       grant    14384:               </div>
                   14385:             </div>
                   14386:           </div>
                   14387: 
                   14388:           <div class="orderedlist">
                   14389:             <ol type="1">
                   14390:               <li>
                   14391:                 <p>Make a copy of the directory somewhere else.</p>
                   14392:               </li>
                   14393: 
                   14394:               <li>
                   14395:                 <p>Remove all CVS dirs.</p>
                   14396: 
                   14397:                 <p>Alternatively to the first two steps you can
                   14398:                 also do:</p>
                   14399:                 <pre class="screen">
1.14      xtraeme  14400: <code class="prompt">%</code> <strong class=
                   14401: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    14402: </pre>
                   14403: 
                   14404:                 <p>and use that for further work.</p>
                   14405:               </li>
                   14406: 
                   14407:               <li>
1.14      xtraeme  14408:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   14409:                 any <code class="varname">DEPENDS</code> paths that
                   14410:                 just did &#8220;<span class=
1.1       grant    14411:                 "quote">../package</span>&#8221; instead of
                   14412:                 &#8220;<span class=
                   14413:                 "quote">../../category/package</span>&#8221;.</p>
                   14414:               </li>
                   14415: 
                   14416:               <li>
1.14      xtraeme  14417:                 <p><span><strong class="command">cvs
                   14418:                 import</strong></span> the modified package in the
                   14419:                 new place.</p>
1.1       grant    14420:               </li>
                   14421: 
                   14422:               <li>
                   14423:                 <p>Check if any package depends on it:</p>
                   14424:                 <pre class="screen">
1.14      xtraeme  14425: <code class="prompt">%</code> <strong class=
                   14426: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   14427: <code class="prompt">%</code> <strong class=
                   14428: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    14429: </pre>
                   14430:               </li>
                   14431: 
                   14432:               <li>
                   14433:                 <p>Fix paths in packages from step 5 to point to
                   14434:                 new location.</p>
                   14435:               </li>
                   14436: 
                   14437:               <li>
1.14      xtraeme  14438:                 <p><span><strong class="command">cvs rm
                   14439:                 (-f)</strong></span> the package at the old
                   14440:                 location.</p>
1.1       grant    14441:               </li>
                   14442: 
                   14443:               <li>
1.45      wiz      14444:                 <p>Remove from <code xmlns=
                   14445:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14446:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    14447:               </li>
                   14448: 
                   14449:               <li>
1.45      wiz      14450:                 <p>Add to <code xmlns=
                   14451:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14452:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    14453:               </li>
                   14454: 
                   14455:               <li>
                   14456:                 <p>Commit the changed and removed files:</p>
                   14457:                 <pre class="screen">
1.14      xtraeme  14458: <code class="prompt">%</code> <strong class=
                   14459: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    14460: </pre>
                   14461: 
                   14462:                 <p>(and any packages from step 5, of course).</p>
                   14463:               </li>
                   14464:             </ol>
                   14465:           </div>
                   14466:         </div>
                   14467:       </div>
                   14468:     </div>
                   14469: 
1.57      minskim  14470:     <div class="appendix" lang="en">
1.1       grant    14471:       <div class="titlepage">
                   14472:         <div>
                   14473:           <div>
1.57      minskim  14474:             <h2 class="title"><a name=
1.46      gdt      14475:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    14476:             package: bison</h2>
                   14477:           </div>
                   14478:         </div>
                   14479:       </div>
                   14480: 
                   14481:       <div class="toc">
                   14482:         <p><b>Table of Contents</b></p>
                   14483: 
                   14484:         <dl>
1.46      gdt      14485:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    14486:           files</a></span></dt>
                   14487: 
                   14488:           <dd>
                   14489:             <dl>
1.30      wiz      14490:               <dt><span class="sect2"><a href=
1.46      gdt      14491:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    14492: 
1.30      wiz      14493:               <dt><span class="sect2"><a href=
1.46      gdt      14494:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    14495: 
1.30      wiz      14496:               <dt><span class="sect2"><a href=
1.46      gdt      14497:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    14498: 
1.30      wiz      14499:               <dt><span class="sect2"><a href=
1.46      gdt      14500:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      14501:               package with <span><strong class=
1.14      xtraeme  14502:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    14503:             </dl>
                   14504:           </dd>
                   14505: 
1.46      gdt      14506:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      14507:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    14508:         </dl>
                   14509:       </div>
                   14510: 
                   14511:       <p>We checked to find a piece of software that wasn't in the
                   14512:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  14513:       would want to have <span><strong class=
                   14514:       "command">bison</strong></span> when Berkeley
                   14515:       <span><strong class="command">yacc</strong></span> is already
                   14516:       present in the tree is beyond us, but it's useful for the
                   14517:       purposes of this exercise.</p>
1.1       grant    14518: 
1.57      minskim  14519:       <div class="sect1" lang="en">
1.1       grant    14520:         <div class="titlepage">
                   14521:           <div>
                   14522:             <div>
                   14523:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14524:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    14525:             </div>
                   14526:           </div>
                   14527:         </div>
                   14528: 
1.57      minskim  14529:         <div class="sect2" lang="en">
1.1       grant    14530:           <div class="titlepage">
                   14531:             <div>
                   14532:               <div>
1.57      minskim  14533:                 <h3 class="title"><a name=
1.46      gdt      14534:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    14535:               </div>
                   14536:             </div>
                   14537:           </div>
                   14538:           <pre class="programlisting">
1.51      rillig   14539:     # $NetBSD$
                   14540:     #
1.1       grant    14541: 
1.51      rillig   14542:     DISTNAME=       bison-1.25
                   14543:     CATEGORIES=     devel
                   14544:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    14545: 
1.51      rillig   14546:     MAINTAINER=     thorpej@NetBSD.org
                   14547:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   14548:     COMMENT=        GNU yacc clone
1.1       grant    14549: 
1.51      rillig   14550:     GNU_CONFIGURE=  yes
                   14551:     INFO_FILES=     bison.info
1.1       grant    14552: 
1.51      rillig   14553:     .include "../../mk/bsd.pkg.mk"
1.1       grant    14554: </pre>
                   14555:         </div>
                   14556: 
1.57      minskim  14557:         <div class="sect2" lang="en">
1.1       grant    14558:           <div class="titlepage">
                   14559:             <div>
                   14560:               <div>
1.57      minskim  14561:                 <h3 class="title"><a name=
1.46      gdt      14562:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    14563:               </div>
                   14564:             </div>
                   14565:           </div>
                   14566:           <pre class="programlisting">
1.51      rillig   14567:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   14568:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    14569: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51      rillig   14570:     of the NetBSD source tree is beyond me.
1.1       grant    14571: </pre>
                   14572:         </div>
                   14573: 
1.57      minskim  14574:         <div class="sect2" lang="en">
1.1       grant    14575:           <div class="titlepage">
                   14576:             <div>
                   14577:               <div>
1.57      minskim  14578:                 <h3 class="title"><a name=
1.46      gdt      14579:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    14580:               </div>
                   14581:             </div>
                   14582:           </div>
                   14583:           <pre class="programlisting">
1.51      rillig   14584:     @comment $NetBSD$
                   14585:     bin/bison
                   14586:     man/man1/bison.1.gz
                   14587:     share/bison.simple
                   14588:     share/bison.hairy
1.1       grant    14589: </pre>
                   14590:         </div>
                   14591: 
1.57      minskim  14592:         <div class="sect2" lang="en">
1.1       grant    14593:           <div class="titlepage">
                   14594:             <div>
                   14595:               <div>
1.30      wiz      14596:                 <h3 class="title"><a name=
1.46      gdt      14597:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      14598:                 a package with <span><strong class=
1.14      xtraeme  14599:                 "command">pkglint</strong></span></h3>
1.1       grant    14600:               </div>
                   14601:             </div>
                   14602:           </div>
                   14603: 
                   14604:           <p>The NetBSD package system comes with <a xmlns=
                   14605:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   14606:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14607:           target="_top"><code xmlns="" class=
                   14608:           "filename">pkgtools/pkglint</code></a> which helps to
                   14609:           check the contents of these files. After installation it
                   14610:           is quite easy to use, just change to the directory of the
1.20      ben      14611:           package you wish to examine and execute
                   14612:           <span><strong class=
                   14613:           "command">pkglint</strong></span>:</p>
1.1       grant    14614:           <pre class="screen">
1.14      xtraeme  14615: <code class="prompt">$</code> <strong class=
                   14616: "userinput"><code>pkglint</code></strong>
1.1       grant    14617: looks fine.
                   14618: </pre>
                   14619: 
                   14620:           <p>Depending on the supplied command line arguments (see
1.47      reed     14621:           pkglint(1)), more verbose checks will be performed. Use
1.14      xtraeme  14622:           e.g. <span><strong class="command">pkglint
                   14623:           -v</strong></span> for a very verbose check.</p>
1.1       grant    14624:         </div>
                   14625:       </div>
                   14626: 
1.57      minskim  14627:       <div class="sect1" lang="en">
1.1       grant    14628:         <div class="titlepage">
                   14629:           <div>
                   14630:             <div>
                   14631:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14632:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      14633:               installing, packaging</h2>
1.1       grant    14634:             </div>
                   14635:           </div>
                   14636:         </div>
                   14637: 
                   14638:         <p>Create the directory where the package lives, plus any
                   14639:         auxiliary directories:</p>
                   14640:         <pre class="screen">
1.14      xtraeme  14641: <code class="prompt">#</code> <strong class=
                   14642: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   14643: <code class="prompt">#</code> <strong class=
                   14644: "userinput"><code>mkdir bison</code></strong>
                   14645: <code class="prompt">#</code> <strong class=
                   14646: "userinput"><code>cd bison</code></strong>
                   14647: <code class="prompt">#</code> <strong class=
                   14648: "userinput"><code>mkdir patches</code></strong>
1.1       grant    14649: </pre>
                   14650: 
1.45      wiz      14651:         <p>Create <code xmlns=
                   14652:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14653:         "filename">Makefile</code>, <code xmlns=
                   14654:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   14655:         "filename">DESCR</code> and <code xmlns=
                   14656:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14657:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    14658:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.57      minskim  14659:         Chapter&nbsp;8, <i>Package components - files, directories
                   14660:         and contents</i></a>) then continue with fetching the
1.1       grant    14661:         distfile:</p>
                   14662:         <pre class="screen">
1.14      xtraeme  14663: <code class="prompt">#</code> <strong class=
                   14664: "userinput"><code>make fetch</code></strong>
1.1       grant    14665: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   14666: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   14667: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14668: ftp: Error retrieving file: 500 Internal error
                   14669: 
                   14670: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   14671: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14672: ftp: Error retrieving file: 500 Internal error
                   14673: 
                   14674: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   14675: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   14676: Successfully retrieved file.
                   14677: </pre>
                   14678: 
1.45      wiz      14679:         <p>Generate the checksum of the distfile into <code xmlns=
                   14680:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14681:         "filename">distinfo</code>:</p>
1.1       grant    14682:         <pre class="screen">
1.14      xtraeme  14683: <code class="prompt">#</code> <strong class=
                   14684: "userinput"><code>make makesum</code></strong>
1.1       grant    14685: </pre>
                   14686: 
                   14687:         <p>Now compile:</p>
                   14688:         <pre class="screen">
1.14      xtraeme  14689: <code class="prompt">#</code> <strong class=
                   14690: "userinput"><code>make</code></strong>
1.1       grant    14691: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14692: ===&gt;  Extracting for bison-1.25
                   14693: ===&gt;  Patching for bison-1.25
                   14694: ===&gt;   Ignoring empty patch directory
                   14695: ===&gt;  Configuring for bison-1.25
                   14696: creating cache ./config.cache
                   14697: checking for gcc... cc
                   14698: checking whether we are using GNU C... yes
                   14699: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   14700: checking how to run the C preprocessor... cc -E
                   14701: checking for minix/config.h... no
                   14702: checking for POSIXized ISC... no
                   14703: checking whether cross-compiling... no
                   14704: checking for ANSI C header files... yes
                   14705: checking for string.h... yes
                   14706: checking for stdlib.h... yes
                   14707: checking for memory.h... yes
                   14708: checking for working const... yes
                   14709: checking for working alloca.h... no
                   14710: checking for alloca... yes
                   14711: checking for strerror... yes
                   14712: updating cache ./config.cache
                   14713: creating ./config.status
                   14714: creating Makefile
                   14715: ===&gt;  Building for bison-1.25
                   14716: 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
                   14717: 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
                   14718: 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
                   14719: 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
                   14720: 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
                   14721: 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 
                   14722: 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
                   14723: 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
                   14724: 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
                   14725: 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
                   14726: 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
                   14727: 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
                   14728: 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
                   14729: 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
                   14730: 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
                   14731: 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
                   14732: 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
                   14733: 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
                   14734: 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
                   14735: 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
                   14736: 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
                   14737: 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
                   14738: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   14739: rm -f bison.s1
                   14740: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   14741: </pre>
                   14742: 
                   14743:         <p>Everything seems OK, so install the files:</p>
                   14744:         <pre class="screen">
1.14      xtraeme  14745: <code class="prompt">#</code> <strong class=
                   14746: "userinput"><code>make install</code></strong>
1.1       grant    14747: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14748: ===&gt;  Installing for bison-1.25
                   14749: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   14750: rm -f /usr/pkg/bin/bison
                   14751: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   14752: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   14753: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   14754: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   14755: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   14756: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   14757: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   14758: ===&gt;  Registering installation for bison-1.25
                   14759: </pre>
                   14760: 
                   14761:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  14762:         remove it with <span><strong class="command">pkg_delete
                   14763:         bison</strong></span>. Should you decide that you want a
                   14764:         binary package, do this now:</p>
1.1       grant    14765:         <pre class="screen">
1.14      xtraeme  14766: <code class="prompt">#</code> <strong class=
                   14767: "userinput"><code>make package</code></strong>
1.1       grant    14768: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14769: ===&gt;  Building package for bison-1.25
                   14770: Creating package bison-1.25.tgz
                   14771: Registering depends:.
                   14772: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   14773: </pre>
                   14774: 
                   14775:         <p>Now that you don't need the source and object files any
                   14776:         more, clean up:</p>
                   14777:         <pre class="screen">
1.14      xtraeme  14778: <code class="prompt">#</code> <strong class=
                   14779: "userinput"><code>make clean</code></strong>
1.1       grant    14780: ===&gt;  Cleaning for bison-1.25
                   14781: </pre>
                   14782:       </div>
                   14783:     </div>
                   14784: 
1.57      minskim  14785:     <div class="appendix" lang="en">
1.1       grant    14786:       <div class="titlepage">
                   14787:         <div>
                   14788:           <div>
1.57      minskim  14789:             <h2 class="title"><a name=
1.46      gdt      14790:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    14791:           </div>
                   14792:         </div>
                   14793:       </div>
                   14794: 
                   14795:       <div class="toc">
                   14796:         <p><b>Table of Contents</b></p>
                   14797: 
                   14798:         <dl>
1.46      gdt      14799:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    14800:           Building figlet</a></span></dt>
                   14801: 
1.46      gdt      14802:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    14803:           Packaging figlet</a></span></dt>
                   14804:         </dl>
                   14805:       </div>
                   14806: 
1.57      minskim  14807:       <div class="sect1" lang="en">
1.1       grant    14808:         <div class="titlepage">
                   14809:           <div>
                   14810:             <div>
                   14811:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14812:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    14813:             </div>
                   14814:           </div>
                   14815:         </div>
                   14816:         <pre class="screen">
1.14      xtraeme  14817: <code class="prompt">#</code> <strong class=
                   14818: "userinput"><code>make</code></strong>
1.1       grant    14819: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14820: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   14821: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   14822: =&gt; [172219 bytes]
                   14823: Connected to ftp.plig.net.
                   14824: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   14825: 331 Guest login ok, send your complete e-mail address as password.
                   14826: 230-You are user #5 of 500 simultaneous users allowed.
                   14827: 230-
                   14828: 230-  ___ _             _ _                   
                   14829: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   14830: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   14831: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   14832: 230-         |_|   |_|     |___|         |___|
                   14833: 230-
                   14834: 230-** Welcome to ftp.plig.org **
                   14835: 230-
                   14836: 230-Please note that all transfers from this FTP site are logged. If you
                   14837: 230-do not like this, please disconnect now.
                   14838: 230-
                   14839: 230-This arhive is available via
                   14840: 230-
                   14841: 230-HTTP:  http://ftp.plig.org/
                   14842: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   14843: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   14844: 230-
                   14845: 230-Please email comments, bug reports and requests for packages to be
                   14846: 230-mirrored to ftp-admin@plig.org.   
                   14847: 230-
                   14848: 230-
                   14849: 230 Logged in anonymously.
                   14850: Remote system type is UNIX.
                   14851: Using binary mode to transfer files.
                   14852: 200 Type okay.
                   14853: 250 "/pub" is new cwd.
                   14854: 250-"/pub/figlet" is new cwd.
                   14855: 250-
                   14856: 250-Welcome to the figlet archive at ftp.figlet.org
                   14857: 250-    
                   14858: 250-    ftp://ftp.figlet.org/pub/figlet/
                   14859: 250-
                   14860: 250-The official FIGlet web page is:
                   14861: 250-    http://www.figlet.org/
                   14862: 250-
                   14863: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   14864: 250-contribute a font or something else, you can email us.
                   14865: 250 
                   14866: 250 "/pub/figlet/program" is new cwd.
                   14867: 250 "/pub/figlet/program/unix" is new cwd.
                   14868: local: figlet221.tar.gz remote: figlet221.tar.gz
                   14869: 502 Unimplemented command.
                   14870: 227 Entering Passive Mode (195,40,6,41,246,104)
                   14871: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   14872: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   14873: 226 Transfer completed.
                   14874: 172219 bytes received in 00:02 (75.99 KB/s)
                   14875: 221 Goodbye.
                   14876: =&gt; Checksum OK for figlet221.tar.gz.
                   14877: ===&gt; Extracting for figlet-2.2.1nb2
                   14878: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   14879: ===&gt; Patching for figlet-2.2.1nb2
                   14880: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   14881: ===&gt; Overriding tools for figlet-2.2.1nb2
                   14882: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   14883: ===&gt; Configuring for figlet-2.2.1nb2
                   14884: ===&gt; Building for figlet-2.2.1nb2
                   14885: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   14886: chmod a+x figlet
                   14887: gcc -O2 -o chkfont chkfont.c
                   14888: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  14889: <code class="prompt">#</code>
                   14890: <code class="prompt">#</code> <strong class=
                   14891: "userinput"><code>make install</code></strong>
1.1       grant    14892: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14893: ===&gt; Installing for figlet-2.2.1nb2
                   14894: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   14895: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   14896: mkdir -p /usr/pkg/share/figlet
                   14897: cp figlet /usr/pkg/bin
                   14898: cp chkfont /usr/pkg/bin
                   14899: chmod 555 figlist showfigfonts
                   14900: cp figlist /usr/pkg/bin
                   14901: cp showfigfonts /usr/pkg/bin
                   14902: cp fonts/*.flf /usr/pkg/share/figlet
                   14903: cp fonts/*.flc /usr/pkg/share/figlet
                   14904: cp figlet.6 /usr/pkg/man/man6
                   14905: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  14906: <code class="prompt">#</code>
1.1       grant    14907: </pre>
                   14908:       </div>
                   14909: 
1.57      minskim  14910:       <div class="sect1" lang="en">
1.1       grant    14911:         <div class="titlepage">
                   14912:           <div>
                   14913:             <div>
                   14914:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14915:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    14916:             </div>
                   14917:           </div>
                   14918:         </div>
                   14919:         <pre class="screen">
1.14      xtraeme  14920: <code class="prompt">#</code> <strong class=
                   14921: "userinput"><code>make package</code></strong>
1.1       grant    14922: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14923: ===&gt; Packaging figlet-2.2.1nb2
                   14924: ===&gt; Building binary package for figlet-2.2.1nb2
                   14925: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   14926: Using SrcDir value of /usr/pkg
                   14927: Registering depends:.  
1.14      xtraeme  14928: <code class="prompt">#</code>
1.1       grant    14929: </pre>
                   14930:       </div>
                   14931:     </div>
                   14932: 
1.57      minskim  14933:     <div class="appendix" lang="en">
1.1       grant    14934:       <div class="titlepage">
                   14935:         <div>
                   14936:           <div>
1.57      minskim  14937:             <h2 class="title"><a name=
1.46      gdt      14938:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    14939:             FTP server's package archive</h2>
                   14940:           </div>
                   14941:         </div>
                   14942:       </div>
                   14943: 
                   14944:       <p>Layout for precompiled binary packages on
                   14945:       ftp.NetBSD.org:</p>
                   14946:       <pre class="programlisting">
1.51      rillig   14947:     /pub/NetBSD/packages/
                   14948:         distfiles/
1.1       grant    14949: 
1.51      rillig   14950:         # Unpacked pkgsrc trees
                   14951:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   14952:         pkgsrc-2003Q4 -&gt; N/A
                   14953:         pkgsrc-2004Q1/pkgsrc
                   14954: 
                   14955:         # pkgsrc archives
                   14956:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   14957:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   14958:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   14959: 
                   14960:         # Per pkgsrc-release/OS-release/arch package archives
                   14961:         pkgsrc-2003Q4/
                   14962:             NetBSD-1.6.2/
                   14963:                 i386/
                   14964:                     All/
                   14965:                     archivers/
                   14966:                         foo -&gt; ../All/foo
                   14967:                     ...
                   14968:         pkgsrc-2004Q1/
                   14969:             NetBSD-1.6.2/
                   14970:                 i386/
                   14971:                     All/
                   14972:                     ...
                   14973:             NetBSD-2.0/
                   14974:                 i386/
                   14975:                     All/
                   14976:                     ...
                   14977:             SunOS-5.9/
                   14978:                 sparc/
                   14979:                     All/
                   14980:                     ...
                   14981:                 x86/
                   14982:                     All/
                   14983:                     ...
                   14984: 
                   14985:         # Per os-release package archive convenience links
                   14986:         NetBSD-1.6.2 -&gt; 1.6.2
                   14987:         1.6.2/
                   14988:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   14989:             m68k/
                   14990:                 All/
                   14991:                 archivers/
                   14992:                     foo -&gt; ../All/foo
                   14993:                 ...
                   14994:             amiga -&gt; m68k
                   14995:             atari -&gt; m68k
                   14996:             ...
                   14997: 
                   14998:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   14999:         NetBSD-2.0/
                   15000:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   15001:         SunOS-5.9/
                   15002:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   15003:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    15004: </pre>
                   15005: 
                   15006:       <p>To create:</p>
                   15007: 
                   15008:       <div class="orderedlist">
                   15009:         <ol type="1">
                   15010:           <li>
                   15011:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.57      minskim  15012:             "6.3.&nbsp;Doing a bulk build of all packages">Section&nbsp;6.3,
                   15013:             &#8220;Doing a bulk build of all
1.1       grant    15014:             packages&#8221;</a></p>
                   15015:           </li>
                   15016: 
                   15017:           <li>
                   15018:             <p>Upload /usr/pkgsrc/packages to</p>
                   15019:             <pre class="programlisting">
                   15020:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   15021:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   15022:         `uname -s`-`uname -r`/\     # OS &amp; version
                   15023:         `uname -p`                  # architecture
1.1       grant    15024: </pre>
                   15025:           </li>
                   15026: 
                   15027:           <li>
1.14      xtraeme  15028:             <p>If necessary, create a symlink <span><strong class=
                   15029:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   15030:             (amiga -&gt; m68k, ...)</p>
1.1       grant    15031:           </li>
                   15032:         </ol>
                   15033:       </div>
                   15034:     </div>
1.2       hubertf  15035: 
1.57      minskim  15036:     <div class="appendix" lang="en">
1.2       hubertf  15037:       <div class="titlepage">
                   15038:         <div>
                   15039:           <div>
1.57      minskim  15040:             <h2 class="title"><a name=
1.46      gdt      15041:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  15042:             for the pkgsrc guide</h2>
                   15043:           </div>
                   15044:         </div>
                   15045:       </div>
                   15046: 
                   15047:       <div class="toc">
                   15048:         <p><b>Table of Contents</b></p>
                   15049: 
                   15050:         <dl>
1.46      gdt      15051:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  15052:           Targets</a></span></dt>
                   15053: 
1.46      gdt      15054:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  15055:           Procedure</a></span></dt>
                   15056:         </dl>
                   15057:       </div>
                   15058: 
                   15059:       <p>This section contains information on editing the pkgsrc
                   15060:       guide itself.</p>
                   15061: 
1.57      minskim  15062:       <div class="sect1" lang="en">
1.2       hubertf  15063:         <div class="titlepage">
                   15064:           <div>
                   15065:             <div>
                   15066:               <h2 class="title" style="clear: both"><a name=
1.57      minskim  15067:               "targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  15068:             </div>
                   15069:           </div>
                   15070:         </div>
                   15071: 
1.45      wiz      15072:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   15073:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15074:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  15075:         are created from it:</p>
                   15076: 
                   15077:         <div class="itemizedlist">
                   15078:           <ul type="disc">
                   15079:             <li>
1.45      wiz      15080:               <p><code xmlns=
                   15081:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      15082:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  15083:             </li>
                   15084: 
                   15085:             <li>
1.45      wiz      15086:               <p><code xmlns=
                   15087:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15088:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  15089:             </li>
                   15090: 
                   15091:             <li>
1.45      wiz      15092:               <p><code xmlns=
                   15093:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15094:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  15095:               the documentation on the NetBSD website will be built
                   15096:               from pkgsrc and kept up to date on the web server
                   15097:               itself. This means you <span class=
                   15098:               "emphasis"><em>must</em></span> make sure that your
                   15099:               changes haven't broken the build!</p>
                   15100:             </li>
1.6       hubertf  15101: 
                   15102:             <li>
1.45      wiz      15103:               <p><code xmlns=
                   15104:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15105:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  15106:               PDF version of the pkgsrc guide.</p>
                   15107:             </li>
                   15108: 
                   15109:             <li>
1.45      wiz      15110:               <p><code xmlns=
                   15111:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15112:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  15113:               PostScript version of the pkgsrc guide.</p>
                   15114:             </li>
1.2       hubertf  15115:           </ul>
                   15116:         </div>
                   15117:       </div>
                   15118: 
1.57      minskim  15119:       <div class="sect1" lang="en">
1.2       hubertf  15120:         <div class="titlepage">
                   15121:           <div>
                   15122:             <div>
                   15123:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15124:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  15125:             </div>
                   15126:           </div>
                   15127:         </div>
                   15128: 
                   15129:         <p>The procedure to edit the pkgsrc guide is:</p>
                   15130: 
                   15131:         <div class="itemizedlist">
                   15132:           <ul type="disc">
                   15133:             <li>
1.6       hubertf  15134:               <p>Make sure you have the packages needed to
                   15135:               re-generate the pkgsrc guide (and other XML-based
                   15136:               NetBSD documentation) installed. These are
1.11      ben      15137:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     15138:               for creating the ASCII and HTML versions, and
1.6       hubertf  15139:               &#8220;<span class=
1.47      reed     15140:               "quote">netbsd-doc-print</span>&#8221; for the
                   15141:               PostScript and PDF versions. You will need both
1.6       hubertf  15142:               packages installed, to make sure documentation is
                   15143:               consistent across all formats. The packages can be
1.45      wiz      15144:               found in <code xmlns=
                   15145:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15146:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      15147:               <code xmlns=
                   15148:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15149:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  15150:             </li>
                   15151: 
                   15152:             <li>
1.45      wiz      15153:               <p>Edit the XML file(s) in <code xmlns=
                   15154:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15155:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  15156:             </li>
                   15157: 
                   15158:             <li>
1.14      xtraeme  15159:               <p>Run <span><strong class="command">make extract
                   15160:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      15161:               <code xmlns=
                   15162:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15163:               "filename">pkgsrc/doc/guide</code> to check the XML
                   15164:               syntax, and fix it if needed.</p>
1.4       hubertf  15165:             </li>
                   15166: 
                   15167:             <li>
1.14      xtraeme  15168:               <p>Run <span><strong class=
1.45      wiz      15169:               "command">make</strong></span> in <code xmlns=
                   15170:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15171:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   15172:               and ASCII version.</p>
1.2       hubertf  15173:             </li>
                   15174: 
                   15175:             <li>
1.14      xtraeme  15176:               <p>If all is well, run <span><strong class=
                   15177:               "command">make install-doc</strong></span> to put the
1.45      wiz      15178:               generated files into <code xmlns=
                   15179:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15180:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  15181:             </li>
                   15182: 
                   15183:             <li>
1.14      xtraeme  15184:               <p><span><strong class="command">cvs commit
                   15185:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  15186:             </li>
                   15187: 
                   15188:             <li>
1.14      xtraeme  15189:               <p><span><strong class="command">cvs commit -m
                   15190:               re-generate
                   15191:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  15192:             </li>
1.4       hubertf  15193: 
                   15194:             <li>
                   15195:               <p>Until the webserver on www.NetBSD.org is really
                   15196:               updated automatically to pick up changes to the
1.14      xtraeme  15197:               pkgsrc guide automatically, also run
1.18      xtraeme  15198:               <span><strong class="command">make install-htdocs
1.14      xtraeme  15199:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   15200:               similar, adjust <code class=
                   15201:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  15202:             </li>
                   15203: 
                   15204:             <li>
1.14      xtraeme  15205:               <p><span><strong class="command">cvs commit
                   15206:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  15207:             </li>
1.2       hubertf  15208:           </ul>
                   15209:         </div>
                   15210:       </div>
                   15211:     </div>
1.1       grant    15212:   </div>
                   15213: </body>
                   15214: </html>

CVSweb <webmaster@jp.NetBSD.org>