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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.20      ben         4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.30      wiz        22:           <h1 class="title"><a name="the-pkgsrc-guide" id=
                     23:           "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
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>
                     91:         <dt><span class="chapter"><a href="#introduction">1.
                     92:         Introduction</a></span></dt>
                     93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.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.38      dillo     683:                 "#build.prefix">14.1. Program
1.1       grant     684:                 location</a></span></dt>
                    685: 
1.30      wiz       686:                 <dt><span class="sect1"><a href=
1.38      dillo     687:                 "#main-targets">14.2. Main targets</a></span></dt>
1.1       grant     688: 
                    689:                 <dt><span class="sect1"><a href=
1.38      dillo     690:                 "#build.helpful-targets">14.3. Other helpful
1.1       grant     691:                 targets</a></span></dt>
                    692:               </dl>
                    693:             </dd>
                    694: 
1.38      dillo     695:             <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1       grant     696:             fixes for packages</a></span></dt>
                    697: 
                    698:             <dd>
                    699:               <dl>
1.30      wiz       700:                 <dt><span class="sect1"><a href=
1.38      dillo     701:                 "#general-operation">15.1. General
1.30      wiz       702:                 operation</a></span></dt>
1.1       grant     703: 
                    704:                 <dd>
                    705:                   <dl>
                    706:                     <dt><span class="sect2"><a href=
1.38      dillo     707:                     "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz       708:                     pull in variables from
                    709:                     /etc/mk.conf</a></span></dt>
1.1       grant     710: 
                    711:                     <dt><span class="sect2"><a href=
1.38      dillo     712:                     "#where-to-install-documentation">15.1.2. Where
1.31      wiz       713:                     to install documentation</a></span></dt>
                    714: 
                    715:                     <dt><span class="sect2"><a href=
1.38      dillo     716:                     "#restricted-packages">15.1.3. Restricted
1.1       grant     717:                     packages</a></span></dt>
                    718: 
                    719:                     <dt><span class="sect2"><a href=
1.38      dillo     720:                     "#dependencies">15.1.4. Handling
1.1       grant     721:                     dependencies</a></span></dt>
                    722: 
                    723:                     <dt><span class="sect2"><a href=
1.38      dillo     724:                     "#conflicts">15.1.5. Handling conflicts with
1.1       grant     725:                     other packages</a></span></dt>
                    726: 
                    727:                     <dt><span class="sect2"><a href=
1.38      dillo     728:                     "#not-building-packages">15.1.6. Packages that
1.30      wiz       729:                     cannot or should not be built</a></span></dt>
1.1       grant     730: 
                    731:                     <dt><span class="sect2"><a href=
1.38      dillo     732:                     "#undeletable-packages">15.1.7. Packages which
1.30      wiz       733:                     should not be deleted, once
                    734:                     installed</a></span></dt>
1.1       grant     735: 
                    736:                     <dt><span class="sect2"><a href=
1.38      dillo     737:                     "#security-handling">15.1.8. Handling packages
1.1       grant     738:                     with security problems</a></span></dt>
                    739: 
                    740:                     <dt><span class="sect2"><a href=
1.38      dillo     741:                     "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant     742:                     bugs</a></span></dt>
                    743: 
                    744:                     <dt><span class="sect2"><a href=
1.38      dillo     745:                     "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz       746:                     incrementing versions when fixing an existing
1.1       grant     747:                     package</a></span></dt>
                    748: 
                    749:                     <dt><span class="sect2"><a href=
1.38      dillo     750:                     "#portability-of-packages">15.1.11. Portability
1.30      wiz       751:                     of packages</a></span></dt>
1.1       grant     752:                   </dl>
                    753:                 </dd>
                    754: 
1.30      wiz       755:                 <dt><span class="sect1"><a href=
1.38      dillo     756:                 "#downloading-issues">15.2. Possible downloading
1.30      wiz       757:                 issues</a></span></dt>
1.1       grant     758: 
                    759:                 <dd>
                    760:                   <dl>
                    761:                     <dt><span class="sect2"><a href=
1.38      dillo     762:                     "#no-plain-download">15.2.1. Packages whose
1.30      wiz       763:                     distfiles aren't available for plain
1.1       grant     764:                     downloading</a></span></dt>
                    765: 
                    766:                     <dt><span class="sect2"><a href=
1.38      dillo     767:                     "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz       768:                     handle modified distfiles with the 'old'
                    769:                     name</a></span></dt>
1.1       grant     770:                   </dl>
                    771:                 </dd>
                    772: 
1.30      wiz       773:                 <dt><span class="sect1"><a href=
1.38      dillo     774:                 "#configuration-gotchas">15.3. Configuration
1.30      wiz       775:                 gotchas</a></span></dt>
1.1       grant     776: 
                    777:                 <dd>
                    778:                   <dl>
                    779:                     <dt><span class="sect2"><a href=
1.38      dillo     780:                     "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant     781:                     libtool</a></span></dt>
                    782: 
                    783:                     <dt><span class="sect2"><a href=
1.38      dillo     784:                     "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant     785:                     packages that already support
                    786:                     libtool</a></span></dt>
                    787: 
                    788:                     <dt><span class="sect2"><a href=
1.38      dillo     789:                     "#autoconf-automake">15.3.3. GNU
1.1       grant     790:                     Autoconf/Automake</a></span></dt>
                    791:                   </dl>
                    792:                 </dd>
                    793: 
1.30      wiz       794:                 <dt><span class="sect1"><a href=
1.38      dillo     795:                 "#building-considerations">15.4. Building
1.30      wiz       796:                 considerations</a></span></dt>
1.1       grant     797: 
                    798:                 <dd>
                    799:                   <dl>
                    800:                     <dt><span class="sect2"><a href=
1.38      dillo     801:                     "#cpp-defines">15.4.1. CPP
1.1       grant     802:                     defines</a></span></dt>
                    803:                   </dl>
                    804:                 </dd>
                    805: 
1.30      wiz       806:                 <dt><span class="sect1"><a href=
1.38      dillo     807:                 "#package-specific-actions">15.5. Package specific
1.30      wiz       808:                 actions</a></span></dt>
1.1       grant     809: 
                    810:                 <dd>
                    811:                   <dl>
                    812:                     <dt><span class="sect2"><a href=
1.38      dillo     813:                     "#user-interaction">15.5.1. User
1.2       hubertf   814:                     interaction</a></span></dt>
1.1       grant     815: 
                    816:                     <dt><span class="sect2"><a href=
1.38      dillo     817:                     "#handling-licenses">15.5.2. Handling
1.1       grant     818:                     licenses</a></span></dt>
                    819: 
                    820:                     <dt><span class="sect2"><a href=
1.38      dillo     821:                     "#installing-score-files">15.5.3. Installing
1.30      wiz       822:                     score files</a></span></dt>
1.1       grant     823: 
                    824:                     <dt><span class="sect2"><a href=
1.38      dillo     825:                     "#perl-scripts">15.5.4. Packages containing
1.30      wiz       826:                     perl scripts</a></span></dt>
1.1       grant     827: 
                    828:                     <dt><span class="sect2"><a href=
1.38      dillo     829:                     "#hardcoded-paths">15.5.5. Packages with
1.30      wiz       830:                     hardcoded paths to other
                    831:                     interpreters</a></span></dt>
1.1       grant     832: 
                    833:                     <dt><span class="sect2"><a href=
1.38      dillo     834:                     "#perl-modules">15.5.6. Packages installing
1.30      wiz       835:                     perl modules</a></span></dt>
1.1       grant     836: 
                    837:                     <dt><span class="sect2"><a href=
1.38      dillo     838:                     "#faq.info-files">15.5.7. Packages installing
1.1       grant     839:                     info files</a></span></dt>
                    840: 
                    841:                     <dt><span class="sect2"><a href=
1.38      dillo     842:                     "#gconf2-data-files">15.5.8. Packages
1.30      wiz       843:                     installing GConf2 data files</a></span></dt>
1.1       grant     844: 
                    845:                     <dt><span class="sect2"><a href=
1.38      dillo     846:                     "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz       847:                     installing scrollkeeper data
                    848:                     files</a></span></dt>
1.1       grant     849: 
                    850:                     <dt><span class="sect2"><a href=
1.38      dillo     851:                     "#x11-fonts">15.5.10. Packages installing X11
1.1       grant     852:                     fonts</a></span></dt>
                    853: 
                    854:                     <dt><span class="sect2"><a href=
1.38      dillo     855:                     "#gtk2-modules">15.5.11. Packages installing
1.30      wiz       856:                     GTK2 modules</a></span></dt>
1.1       grant     857: 
                    858:                     <dt><span class="sect2"><a href=
1.38      dillo     859:                     "#sgml-xml-data">15.5.12. Packages installing
1.30      wiz       860:                     SGML or XML data</a></span></dt>
1.1       grant     861: 
                    862:                     <dt><span class="sect2"><a href=
1.38      dillo     863:                     "#mime-database">15.5.13. Packages installing
1.1       grant     864:                     extensions to the MIME database</a></span></dt>
                    865: 
                    866:                     <dt><span class="sect2"><a href=
1.38      dillo     867:                     "#intltool">15.5.14. Packages using
1.1       grant     868:                     intltool</a></span></dt>
1.18      xtraeme   869: 
                    870:                     <dt><span class="sect2"><a href=
1.38      dillo     871:                     "#startup-scripts">15.5.15. Packages installing
1.18      xtraeme   872:                     startup scripts</a></span></dt>
1.1       grant     873:                   </dl>
                    874:                 </dd>
                    875: 
1.30      wiz       876:                 <dt><span class="sect1"><a href=
1.38      dillo     877:                 "#feedback-to-author">15.6. Feedback to the
1.30      wiz       878:                 author</a></span></dt>
1.1       grant     879:               </dl>
                    880:             </dd>
                    881: 
1.38      dillo     882:             <dt><span class="chapter"><a href="#debug">16.
1.1       grant     883:             Debugging</a></span></dt>
                    884: 
1.38      dillo     885:             <dt><span class="chapter"><a href="#submit">17.
1.1       grant     886:             Submitting and Committing</a></span></dt>
                    887: 
                    888:             <dd>
                    889:               <dl>
1.30      wiz       890:                 <dt><span class="sect1"><a href=
1.38      dillo     891:                 "#submitting-your-package">17.1. Submitting your
1.30      wiz       892:                 packages</a></span></dt>
1.1       grant     893: 
1.30      wiz       894:                 <dt><span class="sect1"><a href=
1.41      wiz       895:                 "#general-notes-for-changes">17.2. General notes
                    896:                 when adding, updating, or removing
                    897:                 packages</a></span></dt>
                    898: 
                    899:                 <dt><span class="sect1"><a href=
                    900:                 "#committing-importing">17.3. Committing: Importing
1.30      wiz       901:                 a package into CVS</a></span></dt>
1.1       grant     902: 
1.30      wiz       903:                 <dt><span class="sect1"><a href=
1.41      wiz       904:                 "#updating-package">17.4. Updating a package to a
1.30      wiz       905:                 newer version</a></span></dt>
1.1       grant     906: 
1.30      wiz       907:                 <dt><span class="sect1"><a href=
1.41      wiz       908:                 "#moving-package">17.5. Moving a package in
1.30      wiz       909:                 pkgsrc</a></span></dt>
1.1       grant     910:               </dl>
                    911:             </dd>
                    912:           </dl>
                    913:         </dd>
                    914: 
1.46      gdt       915:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant     916:         example package: bison</a></span></dt>
                    917: 
                    918:         <dd>
                    919:           <dl>
1.46      gdt       920:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant     921:             files</a></span></dt>
                    922: 
                    923:             <dd>
                    924:               <dl>
1.30      wiz       925:                 <dt><span class="sect2"><a href=
1.46      gdt       926:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant     927: 
1.30      wiz       928:                 <dt><span class="sect2"><a href=
1.46      gdt       929:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant     930: 
1.30      wiz       931:                 <dt><span class="sect2"><a href=
1.46      gdt       932:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant     933: 
1.30      wiz       934:                 <dt><span class="sect2"><a href=
1.46      gdt       935:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz       936:                 package with <span><strong class=
1.14      xtraeme   937:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     938:               </dl>
                    939:             </dd>
                    940: 
1.46      gdt       941:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz       942:             Steps for building, installing,
                    943:             packaging</a></span></dt>
1.1       grant     944:           </dl>
                    945:         </dd>
                    946: 
1.46      gdt       947:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant     948:         logs</a></span></dt>
                    949: 
                    950:         <dd>
                    951:           <dl>
1.46      gdt       952:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant     953:             Building figlet</a></span></dt>
                    954: 
1.46      gdt       955:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant     956:             Packaging figlet</a></span></dt>
                    957:           </dl>
                    958:         </dd>
                    959: 
1.46      gdt       960:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant     961:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   962: 
1.46      gdt       963:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf   964:         guidelines for the pkgsrc guide</a></span></dt>
                    965: 
                    966:         <dd>
                    967:           <dl>
1.46      gdt       968:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf   969:             Targets</a></span></dt>
                    970: 
1.46      gdt       971:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf   972:             Procedure</a></span></dt>
                    973:           </dl>
                    974:         </dd>
1.1       grant     975:       </dl>
                    976:     </div>
                    977: 
                    978:     <div class="chapter" lang="en" xml:lang="en">
                    979:       <div class="titlepage">
                    980:         <div>
                    981:           <div>
                    982:             <h2 class="title"><a name="introduction" id=
                    983:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    984:           </div>
                    985:         </div>
                    986:       </div>
                    987: 
                    988:       <div class="toc">
                    989:         <p><b>Table of Contents</b></p>
                    990: 
                    991:         <dl>
1.30      wiz       992:           <dt><span class="sect1"><a href=
                    993:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant     994: 
                    995:           <dt><span class="sect1"><a href="#overview">1.2.
                    996:           Overview</a></span></dt>
                    997: 
                    998:           <dt><span class="sect1"><a href="#terminology">1.3.
                    999:           Terminology</a></span></dt>
                   1000: 
                   1001:           <dt><span class="sect1"><a href="#typography">1.4.
                   1002:           Typography</a></span></dt>
                   1003:         </dl>
                   1004:       </div>
                   1005: 
                   1006:       <div class="sect1" lang="en" xml:lang="en">
                   1007:         <div class="titlepage">
                   1008:           <div>
                   1009:             <div>
                   1010:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1011:               "introduction-section" id=
                   1012:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1013:             </div>
                   1014:           </div>
                   1015:         </div>
                   1016: 
1.47      reed     1017:         <p>There is a lot of software freely available for
                   1018:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1019:         Unix-flavoured systems, too, sometimes with some
                   1020:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1021:         incorporates any such changes necessary to make that
                   1022:         software run, and makes the installation (and
                   1023:         de-installation) of the software package easy by means of a
                   1024:         single command.</p>
                   1025: 
                   1026:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1027:         the <span><strong class="command">pkg_*</strong></span>
                   1028:         tools so that installation and de-installation, printing of
                   1029:         an inventory of all installed packages and retrieval of
                   1030:         one-line comments or more verbose descriptions are all
                   1031:         simple.</p>
1.1       grant    1032: 
                   1033:         <p>pkgsrc currently contains several thousand packages,
                   1034:         including:</p>
                   1035: 
                   1036:         <div class="itemizedlist">
                   1037:           <ul type="disc">
                   1038:             <li>
                   1039:               <p><a xmlns=
                   1040:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1041:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1042:               target="_top"><code xmlns="" class=
                   1043:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1044:               server</p>
1.1       grant    1045:             </li>
                   1046: 
                   1047:             <li>
                   1048:               <p><a xmlns=
                   1049:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1050:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1051:               target="_top"><code xmlns="" class=
                   1052:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1053:               browser</p>
1.1       grant    1054:             </li>
                   1055: 
                   1056:             <li>
                   1057:               <p><a xmlns=
                   1058:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1059:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1060:               target="_top"><code xmlns="" class=
                   1061:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1062:               Desktop Environment</p>
1.1       grant    1063:             </li>
                   1064: 
                   1065:             <li>
                   1066:               <p><a xmlns=
                   1067:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1068:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1069:               target="_top"><code xmlns="" class=
                   1070:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1071:               Environment</p>
1.1       grant    1072:             </li>
                   1073:           </ul>
                   1074:         </div>
                   1075: 
                   1076:         <p>...just to name a few.</p>
                   1077: 
                   1078:         <p>pkgsrc has built-in support for handling varying
                   1079:         dependencies, such as pthreads and X11, and extended
                   1080:         features such as IPv6 support on a range of platforms.</p>
                   1081: 
                   1082:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1083:         initially developed for NetBSD only. Since then, pkgsrc has
                   1084:         grown a lot, and now supports the following platforms:</p>
                   1085: 
                   1086:         <div class="itemizedlist">
                   1087:           <ul type="disc">
                   1088:             <li>
                   1089:               <p><a href="http://developer.apple.com/darwin/"
                   1090:               target="_top">Darwin</a> (<a href=
                   1091:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1092:               X</a>)</p>
                   1093:             </li>
                   1094: 
                   1095:             <li>
1.3       hubertf  1096:               <p><a href="http://www.DragonFlyBSD.org/" target=
                   1097:               "_top">DragonFlyBSD</a></p>
                   1098:             </li>
                   1099: 
                   1100:             <li>
1.1       grant    1101:               <p><a href="http://www.FreeBSD.org/" target=
                   1102:               "_top">FreeBSD</a></p>
                   1103:             </li>
                   1104: 
                   1105:             <li>
1.3       hubertf  1106:               <p>Microsoft Windows, via <a href=
                   1107:               "http://www.microsoft.com/windows/sfu/" target=
                   1108:               "_top">Interix</a></p>
1.1       grant    1109:             </li>
                   1110: 
                   1111:             <li>
                   1112:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1113:               target="_top">IRIX</a></p>
                   1114:             </li>
                   1115: 
                   1116:             <li>
                   1117:               <p><a href="http://www.linux.org/" target=
                   1118:               "_top">Linux</a></p>
                   1119:             </li>
                   1120: 
                   1121:             <li>
                   1122:               <p><a href="http://www.NetBSD.org/" target=
                   1123:               "_top">NetBSD</a> (of course)</p>
                   1124:             </li>
                   1125: 
                   1126:             <li>
1.17      sketch   1127:               <p><a href="http://h30097.www3.hp.com/" target=
                   1128:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1129:             </li>
                   1130: 
                   1131:             <li>
1.1       grant    1132:               <p><a href="http://www.openbsd.org/" target=
                   1133:               "_top">OpenBSD</a></p>
                   1134:             </li>
                   1135: 
                   1136:             <li>
                   1137:               <p><a href="http://www.sun.com/solaris/" target=
                   1138:               "_top">Solaris</a></p>
                   1139:             </li>
                   1140:           </ul>
                   1141:         </div>
                   1142:       </div>
                   1143: 
                   1144:       <div class="sect1" lang="en" xml:lang="en">
                   1145:         <div class="titlepage">
                   1146:           <div>
                   1147:             <div>
                   1148:               <h2 class="title" style="clear: both"><a name=
                   1149:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                   1150:             </div>
                   1151:           </div>
                   1152:         </div>
                   1153: 
                   1154:         <p>This document is divided into two parts. The first,
                   1155:         <a href="#users-guide" title=
1.46      gdt      1156:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1157:         user's guide</a>, describes how one can use one of the
                   1158:         packages in the Package Collection, either by installing a
                   1159:         precompiled binary package, or by building one's own copy
                   1160:         using the NetBSD package system. The second part, <a href=
1.1       grant    1161:         "#developers-guide" title=
1.46      gdt      1162:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1163:         pkgsrc developer's guide</a>, explains how to prepare a
                   1164:         package so it can be easily built by other NetBSD users
                   1165:         without knowing about the package's building details.</p>
1.1       grant    1166: 
                   1167:         <p>This document is available in various formats:</p>
                   1168: 
                   1169:         <div class="itemizedlist">
                   1170:           <ul type="disc">
                   1171:             <li>
                   1172:               <p><a href="index.html" target="_top">HTML</a></p>
                   1173:             </li>
                   1174: 
                   1175:             <li>
                   1176:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1177:             </li>
                   1178: 
                   1179:             <li>
                   1180:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1181:             </li>
                   1182: 
                   1183:             <li>
                   1184:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1185:             </li>
                   1186:           </ul>
                   1187:         </div>
                   1188:       </div>
                   1189: 
                   1190:       <div class="sect1" lang="en" xml:lang="en">
                   1191:         <div class="titlepage">
                   1192:           <div>
                   1193:             <div>
                   1194:               <h2 class="title" style="clear: both"><a name=
                   1195:               "terminology" id=
                   1196:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1197:             </div>
                   1198:           </div>
                   1199:         </div>
                   1200: 
                   1201:         <p>There has been a lot of talk about &#8220;<span class=
                   1202:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1203:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1204:         description of all the terminology used within this
                   1205:         document.</p>
                   1206: 
                   1207:         <div class="variablelist">
                   1208:           <dl>
                   1209:             <dt><span class="term">Package</span></dt>
                   1210: 
                   1211:             <dd>
                   1212:               <p>A set of files and building instructions that
                   1213:               describe what's necessary to build a certain piece of
                   1214:               software using pkgsrc. Packages are traditionally
1.45      wiz      1215:               stored under <code xmlns=
                   1216:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1217:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1218:             </dd>
                   1219: 
                   1220:             <dt><span class="term">The NetBSD package
                   1221:             system</span></dt>
                   1222: 
                   1223:             <dd>
                   1224:               <p>This is the former name of &#8220;<span class=
                   1225:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1226:               NetBSD operating system and can be bootstrapped to
                   1227:               run on non-NetBSD operating systems as well. It
                   1228:               handles building (compiling), installing, and
                   1229:               removing of packages.</p>
1.1       grant    1230:             </dd>
                   1231: 
                   1232:             <dt><span class="term">Distfile</span></dt>
                   1233: 
                   1234:             <dd>
                   1235:               <p>This term describes the file or files that are
                   1236:               provided by the author of the piece of software to
                   1237:               distribute his work. All the changes necessary to
                   1238:               build on NetBSD are reflected in the corresponding
                   1239:               package. Usually the distfile is in the form of a
                   1240:               compressed tar-archive, but other types are possible,
1.45      wiz      1241:               too. Distfiles are usually stored below <code xmlns=
                   1242:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1243:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1244:             </dd>
                   1245: 
                   1246:             <dt><span class="term">Port</span></dt>
                   1247: 
                   1248:             <dd>
                   1249:               <p>This is the term used by FreeBSD and OpenBSD
                   1250:               people for what we call a package. In NetBSD
                   1251:               terminology, &#8220;<span class=
                   1252:               "quote">port</span>&#8221; refers to a different
                   1253:               architecture.</p>
                   1254:             </dd>
                   1255: 
                   1256:             <dt><span class="term">Precompiled/binary
                   1257:             package</span></dt>
                   1258: 
                   1259:             <dd>
                   1260:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1261:               distfile and stuffed together in a single
1.45      wiz      1262:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1263:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1264:               installed on machines of the same machine
                   1265:               architecture without the need to recompile. Packages
1.45      wiz      1266:               are usually generated in <code xmlns=
                   1267:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1268:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1269:               an archive on <a href=
1.1       grant    1270:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1271:               "_top">ftp.NetBSD.org</a>.</p>
                   1272: 
                   1273:               <p>Sometimes, this is referred to by the term
                   1274:               &#8220;<span class="quote">package</span>&#8221; too,
                   1275:               especially in the context of precompiled
                   1276:               packages.</p>
                   1277:             </dd>
                   1278: 
                   1279:             <dt><span class="term">Program</span></dt>
                   1280: 
                   1281:             <dd>
                   1282:               <p>The piece of software to be installed which will
1.47      reed     1283:               be constructed from all the files in the distfile by
1.1       grant    1284:               the actions defined in the corresponding package.</p>
                   1285:             </dd>
                   1286:           </dl>
                   1287:         </div>
                   1288:       </div>
                   1289: 
                   1290:       <div class="sect1" lang="en" xml:lang="en">
                   1291:         <div class="titlepage">
                   1292:           <div>
                   1293:             <div>
                   1294:               <h2 class="title" style="clear: both"><a name=
                   1295:               "typography" id=
                   1296:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1297:             </div>
                   1298:           </div>
                   1299:         </div>
                   1300: 
                   1301:         <p>When giving examples for commands, shell prompts are
                   1302:         used to show if the command should/can be issued as root,
                   1303:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1304:         privileges are sufficient. We use a <code class=
                   1305:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1306:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1307:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1308:       </div>
                   1309:     </div>
                   1310: 
                   1311:     <div class="part" lang="en" xml:lang="en">
                   1312:       <div class="titlepage">
                   1313:         <div>
                   1314:           <div>
                   1315:             <h1 class="title"><a name="users-guide" id=
1.48      dillo    1316:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1317:             guide</h1>
1.1       grant    1318:           </div>
                   1319:         </div>
                   1320:       </div>
                   1321: 
                   1322:       <div class="toc">
                   1323:         <p><b>Table of Contents</b></p>
                   1324: 
                   1325:         <dl>
                   1326:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1327:           get pkgsrc</a></span></dt>
                   1328: 
                   1329:           <dd>
                   1330:             <dl>
1.30      wiz      1331:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1332:               As tar file</a></span></dt>
1.1       grant    1333: 
1.30      wiz      1334:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1335:               SUP</a></span></dt>
                   1336: 
1.30      wiz      1337:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1338:               CVS</a></span></dt>
                   1339:             </dl>
                   1340:           </dd>
                   1341: 
                   1342:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1343:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1344: 
                   1345:           <dd>
                   1346:             <dl>
1.30      wiz      1347:               <dt><span class="sect1"><a href=
                   1348:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1349:               pkgsrc</a></span></dt>
1.1       grant    1350: 
1.30      wiz      1351:               <dt><span class="sect1"><a href=
1.47      reed     1352:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1353:               notes</a></span></dt>
1.1       grant    1354: 
                   1355:               <dd>
                   1356:                 <dl>
1.30      wiz      1357:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1358:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1359: 
1.30      wiz      1360:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1361:                   FreeBSD</a></span></dt>
1.22      tv       1362: 
1.30      wiz      1363:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1364:                   Interix</a></span></dt>
1.1       grant    1365: 
1.30      wiz      1366:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1367:                   IRIX</a></span></dt>
1.1       grant    1368: 
1.30      wiz      1369:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1370:                   Linux</a></span></dt>
1.1       grant    1371: 
1.30      wiz      1372:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1373:                   OpenBSD</a></span></dt>
1.1       grant    1374: 
1.30      wiz      1375:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1376:                   Solaris</a></span></dt>
1.1       grant    1377:                 </dl>
                   1378:               </dd>
                   1379:             </dl>
                   1380:           </dd>
                   1381: 
                   1382:           <dt><span class="chapter"><a href="#using">4. Using
                   1383:           pkgsrc</a></span></dt>
                   1384: 
                   1385:           <dd>
                   1386:             <dl>
                   1387:               <dt><span class="sect1"><a href=
                   1388:               "#getting-started">4.1. Working with binary
                   1389:               packages</a></span></dt>
                   1390: 
                   1391:               <dd>
                   1392:                 <dl>
                   1393:                   <dt><span class="sect2"><a href=
1.30      wiz      1394:                   "#where-to-get-binary-packages">4.1.1. Where to
                   1395:                   get binary packages</a></span></dt>
1.1       grant    1396: 
                   1397:                   <dt><span class="sect2"><a href=
1.30      wiz      1398:                   "#how-to-use-binary-packages">4.1.2. How to use
                   1399:                   binary packages</a></span></dt>
1.1       grant    1400: 
                   1401:                   <dt><span class="sect2"><a href=
1.30      wiz      1402:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1403:                   warning</a></span></dt>
                   1404:                 </dl>
                   1405:               </dd>
                   1406: 
1.30      wiz      1407:               <dt><span class="sect1"><a href=
                   1408:               "#building-packages-from-source">4.2. Building
                   1409:               packages from source</a></span></dt>
1.1       grant    1410: 
                   1411:               <dd>
                   1412:                 <dl>
                   1413:                   <dt><span class="sect2"><a href=
1.30      wiz      1414:                   "#requirements">4.2.1.
                   1415:                   Requirements</a></span></dt>
1.1       grant    1416: 
                   1417:                   <dt><span class="sect2"><a href=
1.30      wiz      1418:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1419:                   distfiles</a></span></dt>
                   1420: 
                   1421:                   <dt><span class="sect2"><a href=
1.30      wiz      1422:                   "#how-to-build-and-install">4.2.3. How to build
                   1423:                   and install</a></span></dt>
1.1       grant    1424: 
                   1425:                   <dt><span class="sect2"><a href=
1.30      wiz      1426:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1427:                   compiler</a></span></dt>
                   1428:                 </dl>
                   1429:               </dd>
                   1430:             </dl>
                   1431:           </dd>
                   1432: 
1.38      dillo    1433:           <dt><span class="chapter"><a href="#configuring">5.
                   1434:           Configuring pkgsrc</a></span></dt>
                   1435: 
                   1436:           <dd>
                   1437:             <dl>
                   1438:               <dt><span class="sect1"><a href=
1.45      wiz      1439:               "#general-configuration">5.1. General
                   1440:               configuration</a></span></dt>
                   1441: 
                   1442:               <dt><span class="sect1"><a href=
                   1443:               "#variables-affecting-build">5.2. Variables affecting
                   1444:               the build process</a></span></dt>
                   1445: 
                   1446:               <dt><span class="sect1"><a href=
                   1447:               "#developer-advanced-settings">5.3.
                   1448:               Developer/advanced settings</a></span></dt>
                   1449: 
                   1450:               <dt><span class="sect1"><a href=
                   1451:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1452:               Options</a></span></dt>
1.38      dillo    1453:             </dl>
                   1454:           </dd>
                   1455: 
                   1456:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1457:           binary packages</a></span></dt>
                   1458: 
                   1459:           <dd>
                   1460:             <dl>
1.30      wiz      1461:               <dt><span class="sect1"><a href=
1.38      dillo    1462:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1463:               single binary package</a></span></dt>
1.1       grant    1464: 
1.30      wiz      1465:               <dt><span class="sect1"><a href=
1.38      dillo    1466:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1467:               Settings for creation of binary
                   1468:               packages</a></span></dt>
                   1469: 
1.38      dillo    1470:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1471:               Doing a bulk build of all packages</a></span></dt>
                   1472: 
                   1473:               <dd>
                   1474:                 <dl>
                   1475:                   <dt><span class="sect2"><a href=
1.38      dillo    1476:                   "#binary.configuration">6.3.1.
1.1       grant    1477:                   Configuration</a></span></dt>
                   1478: 
                   1479:                   <dt><span class="sect2"><a href=
1.38      dillo    1480:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1481:                   Other environmental
1.1       grant    1482:                   considerations</a></span></dt>
                   1483: 
                   1484:                   <dt><span class="sect2"><a href=
1.38      dillo    1485:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1486: 
                   1487:                   <dt><span class="sect2"><a href=
1.38      dillo    1488:                   "#what-it-does">6.3.4. What it
1.30      wiz      1489:                   does</a></span></dt>
1.1       grant    1490: 
                   1491:                   <dt><span class="sect2"><a href=
1.38      dillo    1492:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1493:                   requirements</a></span></dt>
                   1494: 
                   1495:                   <dt><span class="sect2"><a href=
1.38      dillo    1496:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1497:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1498: 
                   1499:                   <dt><span class="sect2"><a href=
1.38      dillo    1500:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1501:                   partial set of packages</a></span></dt>
1.13      hubertf  1502: 
                   1503:                   <dt><span class="sect2"><a href=
1.38      dillo    1504:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1505:                   build</a></span></dt>
1.1       grant    1506:                 </dl>
                   1507:               </dd>
                   1508: 
1.30      wiz      1509:               <dt><span class="sect1"><a href=
1.38      dillo    1510:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1511:               packages collection</a></span></dt>
1.1       grant    1512: 
                   1513:               <dd>
                   1514:                 <dl>
                   1515:                   <dt><span class="sect2"><a href=
1.38      dillo    1516:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1517:                   cdpack</a></span></dt>
                   1518:                 </dl>
                   1519:               </dd>
                   1520:             </dl>
                   1521:           </dd>
                   1522: 
1.38      dillo    1523:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1524:           Asked Questions</a></span></dt>
                   1525: 
                   1526:           <dd>
                   1527:             <dl>
1.30      wiz      1528:               <dt><span class="sect1"><a href=
1.38      dillo    1529:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1530:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1531: 
1.38      dillo    1532:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1533:               Where's the pkgviews documentation?</a></span></dt>
                   1534: 
1.38      dillo    1535:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1536:               Utilities for package management
                   1537:               (pkgtools)</a></span></dt>
                   1538: 
1.30      wiz      1539:               <dt><span class="sect1"><a href=
1.38      dillo    1540:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1541:               non-root</a></span></dt>
1.1       grant    1542: 
1.30      wiz      1543:               <dt><span class="sect1"><a href=
1.38      dillo    1544:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1545:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1546: 
1.30      wiz      1547:               <dt><span class="sect1"><a href=
1.38      dillo    1548:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1549:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1550: 
1.30      wiz      1551:               <dt><span class="sect1"><a href=
1.38      dillo    1552:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1553:               from pkgsrc?</a></span></dt>
1.1       grant    1554: 
1.30      wiz      1555:               <dt><span class="sect1"><a href=
1.38      dillo    1556:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1557:               behind a firewall</a></span></dt>
1.1       grant    1558: 
1.38      dillo    1559:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1560:               How do I tell <span><strong class="command">make
1.14      xtraeme  1561:               fetch</strong></span> to do passive
1.1       grant    1562:               FTP?</a></span></dt>
                   1563: 
1.30      wiz      1564:               <dt><span class="sect1"><a href=
1.38      dillo    1565:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1566:               distfiles at once</a></span></dt>
1.1       grant    1567: 
1.30      wiz      1568:               <dt><span class="sect1"><a href=
1.38      dillo    1569:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1570:               &#8220;<span class="quote">Don't know how to make
                   1571:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1572:               mean?</a></span></dt>
1.13      hubertf  1573: 
1.30      wiz      1574:               <dt><span class="sect1"><a href=
1.38      dillo    1575:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1576:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1577:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1578: 
1.30      wiz      1579:               <dt><span class="sect1"><a href=
1.38      dillo    1580:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1581:               pkgsrc</a></span></dt>
1.1       grant    1582: 
1.38      dillo    1583:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1584:               do I change the location of configuration
                   1585:               files?</a></span></dt>
1.1       grant    1586: 
                   1587:               <dt><span class="sect1"><a href=
1.38      dillo    1588:               "#audit-packages">7.15. Automated security
1.1       grant    1589:               checks</a></span></dt>
                   1590:             </dl>
                   1591:           </dd>
                   1592:         </dl>
                   1593:       </div>
                   1594: 
                   1595:       <div class="chapter" lang="en" xml:lang="en">
                   1596:         <div class="titlepage">
                   1597:           <div>
                   1598:             <div>
                   1599:               <h2 class="title"><a name="getting" id=
                   1600:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1601:               pkgsrc</h2>
                   1602:             </div>
                   1603:           </div>
                   1604:         </div>
                   1605: 
                   1606:         <div class="toc">
                   1607:           <p><b>Table of Contents</b></p>
                   1608: 
                   1609:           <dl>
1.30      wiz      1610:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1611:             tar file</a></span></dt>
                   1612: 
1.30      wiz      1613:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1614:             SUP</a></span></dt>
                   1615: 
1.30      wiz      1616:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1617:             CVS</a></span></dt>
                   1618:           </dl>
                   1619:         </div>
                   1620: 
                   1621:         <p>There are three ways to get pkgsrc. Either as a tar
                   1622:         file, via SUP, or via CVS. All three ways are described
                   1623:         here.</p>
                   1624: 
                   1625:         <div class="sect1" lang="en" xml:lang="en">
                   1626:           <div class="titlepage">
                   1627:             <div>
                   1628:               <div>
                   1629:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1630:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
1.1       grant    1631:                 file</h2>
                   1632:               </div>
                   1633:             </div>
                   1634:           </div>
                   1635: 
                   1636:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1637:           file from <a href=
1.11      ben      1638:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1639:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1640:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1641:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1642:         </div>
                   1643: 
                   1644:         <div class="sect1" lang="en" xml:lang="en">
                   1645:           <div class="titlepage">
                   1646:             <div>
                   1647:               <div>
                   1648:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1649:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1650:               </div>
                   1651:             </div>
                   1652:           </div>
                   1653: 
                   1654:           <p>As an alternative to the tar file, you can get pkgsrc
                   1655:           via the Software Update Protocol, SUP. To do so, make
                   1656:           sure your supfile has a line</p>
                   1657:           <pre class="programlisting">
                   1658: release=pkgsrc
                   1659: </pre>
                   1660: 
1.45      wiz      1661:           <p>in it, see the examples in <code xmlns=
                   1662:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1663:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1664:           the <code xmlns=
                   1665:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1666:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1667:           simply run <span><strong class="command">sup -v
                   1668:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1669:         </div>
                   1670: 
                   1671:         <div class="sect1" lang="en" xml:lang="en">
                   1672:           <div class="titlepage">
                   1673:             <div>
                   1674:               <div>
                   1675:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1676:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1677:               </div>
                   1678:             </div>
                   1679:           </div>
                   1680: 
                   1681:           <p>To get pkgsrc via CVS, make sure you have
                   1682:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1683:           To do an initial (full) checkout of pkgsrc, do the
                   1684:           following steps:</p>
1.1       grant    1685:           <pre class="screen">
1.14      xtraeme  1686: <code class="prompt">%</code> <strong class=
                   1687: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1688: <code class="prompt">%</code> <strong class=
                   1689: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1690: <code class="prompt">%</code> <strong class=
                   1691: "userinput"><code>cd /usr</code></strong>
                   1692: <code class="prompt">%</code> <strong class=
                   1693: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1694: </pre>
                   1695: 
1.45      wiz      1696:           <p>This will create the <code xmlns=
                   1697:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1698:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1699:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1700:           "filename">/usr</code>, and all the package source will
1.45      wiz      1701:           be stored under <code xmlns=
                   1702:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1703:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1704:           initial checkout, make sure you have <code class=
                   1705:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1706:           <pre class="screen">
1.14      xtraeme  1707: <code class="prompt">%</code> <strong class=
                   1708: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1709: <code class="prompt">%</code> <strong class=
                   1710: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1711: </pre>
                   1712: 
                   1713:           <p>Please also note that it is possible to have multiple
                   1714:           copies of the pkgsrc hierarchy in use at any one time -
                   1715:           all work is done relatively within the pkgsrc tree.</p>
                   1716:         </div>
                   1717:       </div>
                   1718: 
                   1719:       <div class="chapter" lang="en" xml:lang="en">
                   1720:         <div class="titlepage">
                   1721:           <div>
                   1722:             <div>
                   1723:               <h2 class="title"><a name="platforms" id=
                   1724:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1725:               systems other than NetBSD</h2>
                   1726:             </div>
                   1727:           </div>
                   1728:         </div>
                   1729: 
                   1730:         <div class="toc">
                   1731:           <p><b>Table of Contents</b></p>
                   1732: 
                   1733:           <dl>
1.30      wiz      1734:             <dt><span class="sect1"><a href=
                   1735:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1736:             pkgsrc</a></span></dt>
1.1       grant    1737: 
1.30      wiz      1738:             <dt><span class="sect1"><a href=
1.47      reed     1739:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1740:             notes</a></span></dt>
1.1       grant    1741: 
                   1742:             <dd>
                   1743:               <dl>
1.30      wiz      1744:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1745:                 Darwin (Mac OS X)</a></span></dt>
                   1746: 
1.30      wiz      1747:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1748:                 FreeBSD</a></span></dt>
                   1749: 
1.30      wiz      1750:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1751:                 Interix</a></span></dt>
                   1752: 
1.30      wiz      1753:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1754:                 IRIX</a></span></dt>
                   1755: 
1.30      wiz      1756:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1757:                 Linux</a></span></dt>
                   1758: 
1.30      wiz      1759:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1760:                 OpenBSD</a></span></dt>
                   1761: 
1.30      wiz      1762:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1763:                 Solaris</a></span></dt>
                   1764:               </dl>
                   1765:             </dd>
                   1766:           </dl>
                   1767:         </div>
                   1768: 
                   1769:         <div class="sect1" lang="en" xml:lang="en">
                   1770:           <div class="titlepage">
                   1771:             <div>
                   1772:               <div>
                   1773:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1774:                 "bootstrapping-pkgsrc" id=
                   1775:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1776:                 pkgsrc</h2>
1.1       grant    1777:               </div>
                   1778:             </div>
                   1779:           </div>
                   1780: 
1.27      rillig   1781:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1782:           bootstrap kit to build the required tools to use pkgsrc
                   1783:           on your platform. Besides support for native NetBSD,
                   1784:           pkgsrc and the bootstrap kit have support for the
                   1785:           following operating systems:</p>
                   1786: 
                   1787:           <div class="itemizedlist">
                   1788:             <ul type="disc">
                   1789:               <li>
                   1790:                 <p>Darwin (Mac OS X)</p>
                   1791:               </li>
                   1792: 
                   1793:               <li>
1.16      grant    1794:                 <p>DragonFlyBSD</p>
                   1795:               </li>
                   1796: 
                   1797:               <li>
1.1       grant    1798:                 <p>FreeBSD</p>
                   1799:               </li>
                   1800: 
                   1801:               <li>
                   1802:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1803:               </li>
                   1804: 
                   1805:               <li>
                   1806:                 <p>IRIX</p>
                   1807:               </li>
                   1808: 
                   1809:               <li>
                   1810:                 <p>Linux</p>
                   1811:               </li>
                   1812: 
                   1813:               <li>
                   1814:                 <p>OpenBSD</p>
                   1815:               </li>
                   1816: 
                   1817:               <li>
                   1818:                 <p>Solaris</p>
                   1819:               </li>
1.16      grant    1820: 
                   1821:               <li>
                   1822:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1823:               </li>
1.1       grant    1824:             </ul>
                   1825:           </div>
                   1826: 
                   1827:           <p>Support for other platforms is under development.</p>
                   1828: 
                   1829:           <p>Installing the bootstrap kit should be as simple
                   1830:           as:</p>
                   1831:           <pre class="screen">
1.14      xtraeme  1832: <code class="prompt">#</code> <strong class=
                   1833: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1834: <code class="prompt">#</code> <strong class=
                   1835: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1836: <code class="prompt">#</code> <strong class=
                   1837: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1838: </pre>
                   1839: 
                   1840:           <p>See <a href="#getting" title=
                   1841:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1842:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1843:           pkgsrc before bootstrapping. The given
                   1844:           <span><strong class="command">bootstrap</strong></span>
1.45      wiz      1845:           command will use the defaults of <code xmlns=
                   1846:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1847:           "filename">/usr/pkg</code> for the <span class=
                   1848:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      1849:           installed in, and <code xmlns=
                   1850:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1851:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1852:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1853:           However, these can also be set using command-line
1.27      rillig   1854:           arguments.</p>
1.1       grant    1855: 
                   1856:           <p>Binary packages for the pkgsrc tools and an initial
                   1857:           set of packages is available for supported platforms. An
                   1858:           up-to-date list of these can be found on <a href=
                   1859:           "http://www.pkgsrc.org/" target=
                   1860:           "_top">www.pkgsrc.org</a>.</p>
1.47      reed     1861: 
                   1862:           <div class="note" style=
                   1863:           "margin-left: 0.5in; margin-right: 0.5in;">
                   1864:             <h3 class="title">Note</h3>
                   1865: 
                   1866:             <p>The bootstrap installs a <span><strong class=
                   1867:             "command">bmake</strong></span> tool. Use this
                   1868:             <span><strong class="command">bmake</strong></span>
                   1869:             when building via pkgsrc. For examples in this guide,
                   1870:             use <span><strong class="command">bmake</strong></span>
                   1871:             instead of &#8220;<span class=
                   1872:             "quote">make</span>&#8221;.</p>
                   1873:           </div>
1.1       grant    1874:         </div>
                   1875: 
                   1876:         <div class="sect1" lang="en" xml:lang="en">
                   1877:           <div class="titlepage">
                   1878:             <div>
                   1879:               <div>
                   1880:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1881:                 "platform-specific-notes" id=
1.47      reed     1882:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   1883:                 notes</h2>
1.1       grant    1884:               </div>
                   1885:             </div>
                   1886:           </div>
                   1887: 
                   1888:           <p>Here are some platform-specific notes you should be
                   1889:           aware of.</p>
                   1890: 
                   1891:           <div class="sect2" lang="en" xml:lang="en">
                   1892:             <div class="titlepage">
                   1893:               <div>
                   1894:                 <div>
1.30      wiz      1895:                   <h3 class="title"><a name="darwin" id=
                   1896:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    1897:                 </div>
                   1898:               </div>
                   1899:             </div>
                   1900: 
                   1901:             <p>Darwin 5.x and 6.x are supported. There are two
                   1902:             methods of using pkgsrc on Mac OS X, by using a
                   1903:             <a href="#platform.osx-image" title=
                   1904:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1905:             <a href="#platform.osx-ufs" title=
                   1906:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1907:             partition</a>.</p>
                   1908: 
                   1909:             <p>Before you start, you will need to download and
                   1910:             install the Mac OS X Developer Tools from Apple's
                   1911:             Developer Connection. See <a href=
                   1912:             "http://developer.apple.com/macosx/" target=
                   1913:             "_top">http://developer.apple.com/macosx/</a> for
                   1914:             details. Also, make sure you install X11 for Mac OS X
                   1915:             and the X11 SDK from <a href=
                   1916:             "http://www.apple.com/macosx/x11/download/" target=
                   1917:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1918:             you intend to build packages that use the X11 Window
                   1919:             System.</p>
                   1920: 
                   1921:             <p>If you already have a UFS partition, or have a spare
                   1922:             partition that you can format as UFS, it is recommended
                   1923:             to use that instead of the disk image. It'll be
                   1924:             somewhat faster and will mount automatically at boot
                   1925:             time, where you must manually mount a disk image.</p>
                   1926: 
                   1927:             <div class="note" style=
                   1928:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1929:               <h3 class="title">Note</h3>
                   1930: 
                   1931:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     1932:               because pkgsrc currently requires the file system to
1.1       grant    1933:               be case-sensitive, and HFS+ is not.</p>
                   1934:             </div>
                   1935: 
                   1936:             <div class="sect3" lang="en" xml:lang="en">
                   1937:               <div class="titlepage">
                   1938:                 <div>
                   1939:                   <div>
                   1940:                     <h4 class="title"><a name="platform.osx-image"
                   1941:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1942:                     a disk image</h4>
                   1943:                   </div>
                   1944:                 </div>
                   1945:               </div>
                   1946: 
                   1947:               <p>Create the disk image:</p>
                   1948:               <pre class="screen">
1.14      xtraeme  1949: <code class="prompt">#</code> <strong class=
                   1950: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1951: <code class="prompt">#</code> <strong class=
                   1952: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1953: <code class="prompt">#</code> <strong class=
                   1954: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1955: <code class="prompt">#</code> <strong class=
                   1956: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1957: </pre>
                   1958: 
                   1959:               <p>That's it!</p>
                   1960:             </div>
                   1961: 
                   1962:             <div class="sect3" lang="en" xml:lang="en">
                   1963:               <div class="titlepage">
                   1964:                 <div>
                   1965:                   <div>
                   1966:                     <h4 class="title"><a name="platform.osx-ufs"
                   1967:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1968:                     UFS partition</h4>
                   1969:                   </div>
                   1970:                 </div>
                   1971:               </div>
                   1972: 
1.45      wiz      1973:               <p>By default, <code xmlns=
                   1974:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   1975:               "filename">/usr</code> will be on your root file
                   1976:               system, normally HFS+. It is possible to use the
                   1977:               default <span class="emphasis"><em>prefix</em></span>
                   1978:               of <code xmlns=
                   1979:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   1980:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   1981:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1982:               "filename">/usr/pkg</code> to a directory on a UFS
                   1983:               file system. Obviously, another symlink is required
                   1984:               if you want to place the package database directory
                   1985:               outside the <span class=
                   1986:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1987:               <pre class="screen">
1.14      xtraeme  1988: <code class="prompt">#</code> <strong class=
1.22      tv       1989: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1990: </pre>
                   1991: 
                   1992:               <p>If you created your partitions at the time of
                   1993:               installing Mac OS X and formatted the target
                   1994:               partition as UFS, it should automatically mount on
1.45      wiz      1995:               <code xmlns=
                   1996:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   1997:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   1998:               the machine boots. If you are (re)formatting a
                   1999:               partition as UFS, you need to ensure that the
                   2000:               partition map correctly reflects &#8220;<span class=
                   2001:               "quote">Apple_UFS</span>&#8221; and not
                   2002:               &#8220;<span class=
1.1       grant    2003:               "quote">Apple_HFS</span>&#8221;.</p>
                   2004: 
                   2005:               <p>The problem is that none of the disk tools will
                   2006:               let you touch a disk that is booted from. You can
                   2007:               unmount the partition, but even if you newfs it, the
                   2008:               partition type will be incorrect and the automounter
                   2009:               won't mount it. It can be mounted manually, but it
                   2010:               won't appear in Finder.</p>
                   2011: 
                   2012:               <p>You'll need to boot off of the OS X Installation
                   2013:               (User) CD. When the Installation program starts, go
                   2014:               up to the menu and select Disk Utility. Now, you will
                   2015:               be able to select the partition you want to be UFS,
                   2016:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2017:               the installer which will reboot your machine. The new
                   2018:               UFS file system will appear in Finder.</p>
                   2019: 
                   2020:               <p>Be aware that the permissions on the new file
                   2021:               system will be writable by root only.</p>
                   2022: 
                   2023:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2024:               earlier versions. Hopefully Apple will fix Disk
                   2025:               Utility in 10.3 (Panther).</p>
                   2026:             </div>
                   2027:           </div>
                   2028: 
                   2029:           <div class="sect2" lang="en" xml:lang="en">
                   2030:             <div class="titlepage">
                   2031:               <div>
                   2032:                 <div>
1.30      wiz      2033:                   <h3 class="title"><a name="freebsd" id=
                   2034:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2035:                 </div>
                   2036:               </div>
                   2037:             </div>
                   2038: 
                   2039:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2040:             supported, other versions may work.</p>
                   2041: 
                   2042:             <p>Care should be taken so that the tools that this kit
                   2043:             installs do not conflict with the FreeBSD userland
                   2044:             tools. There are several steps:</p>
                   2045: 
                   2046:             <div class="orderedlist">
                   2047:               <ol type="1">
                   2048:                 <li>
                   2049:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2050:                   <code xmlns=
                   2051:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2052:                   "filename">/var/db/pkg</code>. It is therefore
                   2053:                   recommended that you choose a different location
                   2054:                   (e.g. <code xmlns=
                   2055:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2056:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2057:                   --pkgdbdir option to the bootstrap script.</p>
                   2058:                 </li>
                   2059: 
                   2060:                 <li>
                   2061:                   <p>If you do not intend to use the FreeBSD ports
                   2062:                   tools, it's probably a good idea to move them out
                   2063:                   of the way to avoid confusion, e.g.</p>
                   2064:                   <pre class="screen">
1.14      xtraeme  2065: <code class="prompt">#</code> <strong class=
                   2066: "userinput"><code>cd /usr/sbin</code></strong>
                   2067: <code class="prompt">#</code> <strong class=
                   2068: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2069: <code class="prompt">#</code> <strong class=
                   2070: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2071: <code class="prompt">#</code> <strong class=
                   2072: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2073: <code class="prompt">#</code> <strong class=
                   2074: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2075: </pre>
                   2076:                 </li>
                   2077: 
                   2078:                 <li>
1.45      wiz      2079:                   <p>An example <code xmlns=
                   2080:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2081:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2082:                   placed in <code xmlns=
                   2083:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2084:                   "filename">/etc/mk.conf.example</code> file when
                   2085:                   you use the bootstrap script.</p>
1.1       grant    2086:                 </li>
                   2087:               </ol>
                   2088:             </div>
                   2089:           </div>
                   2090: 
                   2091:           <div class="sect2" lang="en" xml:lang="en">
                   2092:             <div class="titlepage">
                   2093:               <div>
                   2094:                 <div>
1.30      wiz      2095:                   <h3 class="title"><a name="interix" id=
                   2096:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2097:                 </div>
                   2098:               </div>
                   2099:             </div>
                   2100: 
1.47      reed     2101:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2102:             Windows NT kernel, providing a Unix-like environment
                   2103:             with a tighter kernel integration than available with
                   2104:             Cygwin. It is part of the Windows Services for Unix
                   2105:             package, available for free for any licensed copy of
1.22      tv       2106:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2107:             can be downloaded from <a href=
                   2108:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2109:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2110: 
                   2111:             <p>Services for Unix 3.5, current as of this writing,
                   2112:             has been tested. 3.0 or 3.1 may work, but are not
                   2113:             officially supported. (The main difference in 3.0/3.1
                   2114:             is lack of pthreads.)</p>
                   2115: 
                   2116:             <div class="sect3" lang="en" xml:lang="en">
                   2117:               <div class="titlepage">
                   2118:                 <div>
                   2119:                   <div>
                   2120:                     <h4 class="title"><a name=
                   2121:                     "platform.interix-sfu-install" id=
                   2122:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2123:                     installing Interix/SFU</h4>
1.1       grant    2124:                   </div>
                   2125:                 </div>
                   2126:               </div>
                   2127: 
                   2128:               <p>At an absolute minimum, the following packages
                   2129:               must be installed from the Windows Services for Unix
                   2130:               3.5 distribution in order to use pkgsrc:</p>
                   2131: 
                   2132:               <div class="itemizedlist">
                   2133:                 <ul type="disc">
                   2134:                   <li>
                   2135:                     <p>Utilities -&gt; Base Utilities</p>
                   2136:                   </li>
                   2137: 
                   2138:                   <li>
                   2139:                     <p>Interix GNU Components -&gt; (all)</p>
                   2140:                   </li>
                   2141: 
                   2142:                   <li>
                   2143:                     <p>Remote Connectivity</p>
                   2144:                   </li>
                   2145: 
                   2146:                   <li>
                   2147:                     <p>Interix SDK</p>
                   2148:                   </li>
                   2149:                 </ul>
                   2150:               </div>
                   2151: 
                   2152:               <p>When using pkgsrc on Interix, DO NOT install the
                   2153:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2154:               without shared module support, installed to
                   2155:               /usr/local, and will only cause confusion. Instead,
                   2156:               install Perl 5.8 from pkgsrc (or from a binary
                   2157:               package).</p>
                   2158: 
                   2159:               <p>The Remote Connectivity subcomponent "Windows
                   2160:               Remote Shell Service" does not need to be installed,
                   2161:               but Remote Connectivity itself should be installed in
                   2162:               order to have a working inetd.</p>
                   2163: 
                   2164:               <p>Finally, during installation you may be asked
                   2165:               whether to enable setuid behavior for Interix
                   2166:               programs, and whether to make pathnames default to
                   2167:               case-sensitive. Setuid should be enabled, and
                   2168:               case-sensitivity MUST be enabled. (Without
                   2169:               case-sensitivity, a large number of packages
                   2170:               including perl will not build.)</p>
                   2171:             </div>
                   2172: 
                   2173:             <div class="sect3" lang="en" xml:lang="en">
                   2174:               <div class="titlepage">
                   2175:                 <div>
                   2176:                   <div>
                   2177:                     <h4 class="title"><a name=
                   2178:                     "platform.interix-sfu-postinstall" id=
                   2179:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2180:                     to do if Interix/SFU is already installed</h4>
                   2181:                   </div>
                   2182:                 </div>
                   2183:               </div>
                   2184: 
                   2185:               <p>If SFU is already installed and you wish to alter
                   2186:               these settings to work with pkgsrc, note the
                   2187:               following things.</p>
                   2188: 
                   2189:               <div class="itemizedlist">
                   2190:                 <ul type="disc">
                   2191:                   <li>
                   2192:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2193:                     Programs, select Microsoft Windows Services for
                   2194:                     UNIX, then click Change. In the installer,
                   2195:                     choose Add or Remove, then uncheck
                   2196:                     Utilities-&gt;UNIX Perl.</p>
                   2197:                   </li>
                   2198: 
                   2199:                   <li>
1.47      reed     2200:                     <p>To enable case-sensitivity for the file
                   2201:                     system, run REGEDIT.EXE, and change the
1.1       grant    2202:                     following registry key:</p>
                   2203: 
                   2204:                     <p>
                   2205:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2206:                     Manager\kernel</p>
                   2207: 
                   2208:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2209:                     0; then reboot.</p>
                   2210:                   </li>
                   2211: 
                   2212:                   <li>
                   2213:                     <p>To enable setuid binaries (optional), run
                   2214:                     REGEDIT.EXE, and change the following registry
                   2215:                     key:</p>
                   2216: 
                   2217:                     <p>
                   2218:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2219:                     for UNIX</p>
                   2220: 
                   2221:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2222:                     to 1; then reboot.</p>
                   2223:                   </li>
                   2224:                 </ul>
                   2225:               </div>
                   2226:             </div>
                   2227: 
                   2228:             <div class="sect3" lang="en" xml:lang="en">
                   2229:               <div class="titlepage">
                   2230:                 <div>
                   2231:                   <div>
                   2232:                     <h4 class="title"><a name=
                   2233:                     "platform.interix-notes" id=
                   2234:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2235:                     notes for using pkgsrc</h4>
                   2236:                   </div>
                   2237:                 </div>
                   2238:               </div>
                   2239: 
                   2240:               <p>The package imanager (either the pkgsrc "su" user,
                   2241:               or the user running "pkg_add") must be a member of
                   2242:               the local Administrators group. Such a user must also
                   2243:               be used to run the bootstrap. This is slightly
                   2244:               relaxed from the normal pkgsrc requirement of
                   2245:               "root".</p>
                   2246: 
                   2247:               <p>The package manager should use a umask of 002.
                   2248:               "make install" will automatically complain if this is
                   2249:               not the case. This ensures that directories written
                   2250:               in /var/db/pkg are Administrators-group
                   2251:               writeable.</p>
                   2252: 
                   2253:               <p>The popular Interix binary packages from
                   2254:               http://www.interopsystems.com/ use an older version
                   2255:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2256:               used in conjunction with pkgsrc. If you choose to use
                   2257:               them at the same time as the pkgsrc packages, ensure
                   2258:               that you use the proper pkg_* tools for each type of
                   2259:               binary package.</p>
1.22      tv       2260: 
                   2261:               <p>The TERM setting used for DOS-type console windows
                   2262:               (including those invoked by the csh and ksh startup
                   2263:               shortcuts) is "interix". Most systems don't have a
                   2264:               termcap/terminfo entry for it, but the following
                   2265:               .termcap entry provides adequate emulation in most
                   2266:               cases:</p>
                   2267:               <pre class="programlisting">
                   2268: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   2269: </pre>
1.1       grant    2270:             </div>
                   2271:           </div>
                   2272: 
                   2273:           <div class="sect2" lang="en" xml:lang="en">
                   2274:             <div class="titlepage">
                   2275:               <div>
                   2276:                 <div>
1.30      wiz      2277:                   <h3 class="title"><a name="irix" id=
                   2278:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2279:                 </div>
                   2280:               </div>
                   2281:             </div>
                   2282: 
                   2283:             <p>You will need a working C compiler, either gcc or
                   2284:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2285:             the <code class="varname">CC</code> environment
                   2286:             variable according to your preference. If you do not
                   2287:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2288:             download a gcc tardist file from <a href=
                   2289:             "http://freeware.sgi.com/" target=
                   2290:             "_top">http://freeware.sgi.com/</a>.</p>
                   2291: 
                   2292:             <p>Please note that you will need IRIX 6.5.17 or
                   2293:             higher, as this is the earliest version of IRIX
1.24      wiz      2294:             providing support for <a href=
                   2295:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2296:             <span class="citerefentry"><span class=
                   2297:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2298:             <a href=
                   2299:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2300:             <span class="citerefentry"><span class=
                   2301:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2302:             etc.</p>
1.1       grant    2303: 
1.27      rillig   2304:             <p>At this point in time, pkgsrc only supports one ABI
                   2305:             at a time. That is, you can not switch between the old
                   2306:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2307:             you start out using "abi=n32", that's what all your
                   2308:             packages will be built with.</p>
1.1       grant    2309: 
                   2310:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2311:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2312:             environment or the <code xmlns=
                   2313:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2314:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2315:             that you do not try to link n32 object files with lib64
1.45      wiz      2316:             or vice versa. Check your <code xmlns=
                   2317:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2318:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2319: 
                   2320:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2321:             from a different host, please make sure to set
1.14      xtraeme  2322:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2323:             directory, as it appears that IRIX linker occasionally
1.47      reed     2324:             runs into issues when trying to link over a
                   2325:             network-mounted file system.</p>
1.1       grant    2326: 
                   2327:             <p>The bootstrapping process should set all the right
                   2328:             options for programs such as imake(1), but you may want
                   2329:             to set some options depending on your local setup.
1.45      wiz      2330:             Please see <code xmlns=
                   2331:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2332:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2333:             course, your compiler's man pages for details.</p>
1.22      tv       2334: 
                   2335:             <p>If you are using SGI's MIPSPro compiler, please
                   2336:             set</p>
                   2337:             <pre class="programlisting">
                   2338: PKGSRC_COMPILER=mipspro
                   2339: </pre>
                   2340: 
1.45      wiz      2341:             <p>in <code xmlns=
                   2342:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2343:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2344:             assume you are using gcc and may end up passing invalid
                   2345:             flags to the compiler. Note that bootstrap should
                   2346:             create an appropriate <code xmlns=
                   2347:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2348:             "filename">mk.conf.example</code> by default.</p>
                   2349: 
                   2350:             <p>If you have both the MIPSPro compiler chain
                   2351:             installed as well as gcc, but want to make sure that
                   2352:             MIPRPro is used, please set your <code class=
                   2353:             "varname">PATH</code> to <span class=
                   2354:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2355:             gcc (often <code xmlns=
                   2356:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2357:             "filename">/usr/freeware/bin</code>), and (important)
                   2358:             pass the '--preserve-path' flag.</p>
1.1       grant    2359:           </div>
                   2360: 
                   2361:           <div class="sect2" lang="en" xml:lang="en">
                   2362:             <div class="titlepage">
                   2363:               <div>
                   2364:                 <div>
1.30      wiz      2365:                   <h3 class="title"><a name="linux" id=
                   2366:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2367:                 </div>
                   2368:               </div>
                   2369:             </div>
                   2370: 
                   2371:             <p>Some versions of Linux (for example Debian
                   2372:             GNU/Linux) need either libtermcap or libcurses
                   2373:             (libncurses). Installing the distributions
                   2374:             libncurses-dev package (or equivalent) should fix the
                   2375:             problem.</p>
                   2376: 
                   2377:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2378:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2379:             8.0 and 8.1 on i386 have been tested.</p>
                   2380: 
                   2381:             <p>To bootstrap using icc, assuming the default icc
                   2382:             installation directory:</p>
                   2383:             <pre class="programlisting">
                   2384: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2385:                 ac_cv___attribute__=yes ./bootstrap
                   2386: </pre>
                   2387: 
                   2388:             <div class="note" style=
                   2389:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2390:               <h3 class="title">Note</h3>
                   2391: 
                   2392:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2393:               -static-libcxa.</p>
                   2394:             </div>
                   2395: 
                   2396:             <p>icc supports __attribute__, but the GNU configure
                   2397:             test uses a nested function, which icc does not
                   2398:             support. #undef'ing __attribute__ has the unfortunate
                   2399:             side-effect of breaking many of the Linux header files,
                   2400:             which cannot be compiled properly without
                   2401:             __attribute__. The test must be overridden so that
                   2402:             __attribute__ is assumed supported by the compiler.</p>
                   2403: 
                   2404:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2405:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2406:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2407:             "filename">/etc/mk.conf</code>:</p>
                   2408:             <pre class="programlisting">
                   2409: PKGSRC_COMPILER=icc
                   2410: </pre>
                   2411: 
                   2412:             <p>The default installation directory for icc is
1.45      wiz      2413:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2414:             class="filename">/opt/intel_cc_80</code>, which is also
                   2415:             the pkgsrc default. If you have installed it into a
                   2416:             different directory, set <code class=
                   2417:             "varname">ICCBASE</code> in <code xmlns=
                   2418:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2419:             "filename">/etc/mk.conf</code>:</p>
                   2420:             <pre class="programlisting">
                   2421: ICCBASE=/opt/icc
                   2422: </pre>
                   2423: 
                   2424:             <p>pkgsrc uses the static linking method of the runtime
                   2425:             libraries provided by icc, so binaries can be run on
                   2426:             other systems which do not have the shared libraries
                   2427:             installed.</p>
                   2428: 
                   2429:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2430:             the <a href=
                   2431:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2432:             <span class="citerefentry"><span class=
                   2433:             "refentrytitle">ld</span>(1)</span></a> command run
                   2434:             when linking a C++ shared library and records it,
                   2435:             throwing away the -Bstatic and -Bdynamic options
                   2436:             interspersed between the libraries. This means that
                   2437:             libtool-linked C++ shared libraries will have a runtime
                   2438:             dependency on the icc libraries until this is fixed in
                   2439:             libtool.</p>
1.22      tv       2440:           </div>
                   2441: 
                   2442:           <div class="sect2" lang="en" xml:lang="en">
                   2443:             <div class="titlepage">
                   2444:               <div>
                   2445:                 <div>
1.30      wiz      2446:                   <h3 class="title"><a name="openbsd" id=
                   2447:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2448:                 </div>
                   2449:               </div>
                   2450:             </div>
                   2451: 
                   2452:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2453: 
                   2454:             <p>Care should be taken so that the tools that this kit
                   2455:             installs do not conflict with the OpenBSD userland
                   2456:             tools. There are several steps:</p>
                   2457: 
                   2458:             <div class="orderedlist">
                   2459:               <ol type="1">
                   2460:                 <li>
                   2461:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2462:                   <code xmlns=
                   2463:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2464:                   "filename">/var/db/pkg</code>. It is therefore
                   2465:                   recommended that you choose a different location
                   2466:                   (e.g. <code xmlns=
                   2467:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2468:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2469:                   --pkgdbdir option to the bootstrap script.</p>
                   2470:                 </li>
                   2471: 
                   2472:                 <li>
                   2473:                   <p>If you do not intend to use the OpenBSD ports
                   2474:                   tools, it's probably a good idea to move them out
                   2475:                   of the way to avoid confusion, e.g.</p>
                   2476:                   <pre class="screen">
1.14      xtraeme  2477: <code class="prompt">#</code> <strong class=
                   2478: "userinput"><code>cd /usr/sbin</code></strong>
                   2479: <code class="prompt">#</code> <strong class=
                   2480: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2481: <code class="prompt">#</code> <strong class=
                   2482: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2483: <code class="prompt">#</code> <strong class=
                   2484: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2485: <code class="prompt">#</code> <strong class=
                   2486: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2487: </pre>
                   2488:                 </li>
                   2489: 
                   2490:                 <li>
1.45      wiz      2491:                   <p>An example <code xmlns=
                   2492:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2493:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2494:                   placed in <code xmlns=
                   2495:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2496:                   "filename">/etc/mk.conf.example</code> file when
                   2497:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2498:                   program uses <code xmlns=
                   2499:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2500:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2501:                   work around this by enclosing all the
                   2502:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2503:                   <pre class="programlisting">
                   2504: .ifdef BSD_PKG_MK
1.11      ben      2505: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2506: .else
                   2507: # OpenBSD stuff
                   2508: .endif
                   2509: </pre>
                   2510:                 </li>
                   2511:               </ol>
                   2512:             </div>
                   2513:           </div>
                   2514: 
                   2515:           <div class="sect2" lang="en" xml:lang="en">
                   2516:             <div class="titlepage">
                   2517:               <div>
                   2518:                 <div>
1.30      wiz      2519:                   <h3 class="title"><a name="solaris" id=
                   2520:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2521:                 </div>
                   2522:               </div>
                   2523:             </div>
                   2524: 
                   2525:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2526:             sparc. You will need a working C compiler. Both gcc
                   2527:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2528: 
                   2529:             <p>The following packages are required on Solaris 8 for
                   2530:             the bootstrap process and to build packages.</p>
                   2531: 
                   2532:             <div class="itemizedlist">
                   2533:               <ul type="disc">
                   2534:                 <li>
                   2535:                   <p>SUNWsprot</p>
                   2536:                 </li>
                   2537: 
                   2538:                 <li>
                   2539:                   <p>SUNWarc</p>
                   2540:                 </li>
                   2541: 
                   2542:                 <li>
                   2543:                   <p>SUNWbtool</p>
                   2544:                 </li>
                   2545: 
                   2546:                 <li>
                   2547:                   <p>SUNWtoo</p>
                   2548:                 </li>
                   2549: 
                   2550:                 <li>
                   2551:                   <p>SUNWlibm</p>
                   2552:                 </li>
                   2553:               </ul>
                   2554:             </div>
                   2555: 
                   2556:             <p>Please note the use of GNU binutils on Solaris is
                   2557:             <span class="emphasis"><em>not</em></span>
                   2558:             supported.</p>
                   2559: 
                   2560:             <div class="sect3" lang="en" xml:lang="en">
                   2561:               <div class="titlepage">
                   2562:                 <div>
                   2563:                   <div>
1.30      wiz      2564:                     <h4 class="title"><a name="solaris-gcc-note"
                   2565:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
                   2566:                     are using gcc</h4>
1.1       grant    2567:                   </div>
                   2568:                 </div>
                   2569:               </div>
                   2570: 
                   2571:               <p>It makes life much simpler if you only use the
                   2572:               same gcc consistently for building all packages.</p>
                   2573: 
                   2574:               <p>It is recommended that an external gcc be used
                   2575:               only for bootstrapping, then either build gcc from
                   2576:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2577:               href=
                   2578:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2579:               target="_top"><code xmlns="" class=
                   2580:               "filename">lang/gcc</code></a> or install a binary
                   2581:               gcc package, then remove gcc used during
1.20      ben      2582:               bootstrapping.</p>
1.1       grant    2583: 
                   2584:               <p>Binary packages of gcc can be found through
                   2585:               <a href=
                   2586:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2587:               target=
                   2588:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2589:             </div>
                   2590: 
                   2591:             <div class="sect3" lang="en" xml:lang="en">
                   2592:               <div class="titlepage">
                   2593:                 <div>
                   2594:                   <div>
1.30      wiz      2595:                     <h4 class="title"><a name=
                   2596:                     "solaris-sun-workshop-note" id=
                   2597:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2598:                     you are using Sun WorkShop</h4>
1.1       grant    2599:                   </div>
                   2600:                 </div>
                   2601:               </div>
                   2602: 
                   2603:               <p>You will need at least the following packages
                   2604:               installed (from WorkShop 5.0)</p>
                   2605: 
                   2606:               <div class="itemizedlist">
                   2607:                 <ul type="disc">
                   2608:                   <li>
                   2609:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2610:                   </li>
                   2611: 
                   2612:                   <li>
                   2613:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2614:                   </li>
                   2615: 
                   2616:                   <li>
                   2617:                     <p>SPROild - Sun WorkShop Incremental
                   2618:                     Linker</p>
                   2619:                   </li>
                   2620: 
                   2621:                   <li>
                   2622:                     <p>SPROlang - Sun WorkShop Compilers common
                   2623:                     components</p>
                   2624:                   </li>
                   2625:                 </ul>
                   2626:               </div>
                   2627: 
1.14      xtraeme  2628:               <p>You should set <code class="varname">CC</code>,
                   2629:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2630:               <code class="varname">CPP</code> in <code xmlns=
                   2631:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2632:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2633:               <pre class="programlisting">
1.27      rillig   2634: CC=     cc
1.1       grant    2635: CXX=    CC
                   2636: CPP=    /usr/ccs/lib/cpp
                   2637: </pre>
                   2638: 
                   2639:               <p>You may also want to build 64-bit binaries,
1.47      reed     2640:               e.g.:</p>
1.1       grant    2641:               <pre class="programlisting">
                   2642: CFLAGS= -xtarget=ultra -xarch=v9
                   2643: </pre>
                   2644: 
                   2645:               <p>Whichever compiler you use, please ensure the
                   2646:               compiler tools and your $prefix are in your
1.14      xtraeme  2647:               <code class="varname">PATH</code>. This includes
1.45      wiz      2648:               <code xmlns=
                   2649:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2650:               "filename">/usr/ccs/{bin,lib}</code> and e.g.
1.45      wiz      2651:               <code xmlns=
                   2652:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2653:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2654:             </div>
                   2655:           </div>
                   2656:         </div>
                   2657:       </div>
                   2658: 
                   2659:       <div class="chapter" lang="en" xml:lang="en">
                   2660:         <div class="titlepage">
                   2661:           <div>
                   2662:             <div>
                   2663:               <h2 class="title"><a name="using" id=
                   2664:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2665:             </div>
                   2666:           </div>
                   2667:         </div>
                   2668: 
                   2669:         <div class="toc">
                   2670:           <p><b>Table of Contents</b></p>
                   2671: 
                   2672:           <dl>
                   2673:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2674:             Working with binary packages</a></span></dt>
                   2675: 
                   2676:             <dd>
                   2677:               <dl>
1.30      wiz      2678:                 <dt><span class="sect2"><a href=
                   2679:                 "#where-to-get-binary-packages">4.1.1. Where to get
                   2680:                 binary packages</a></span></dt>
1.1       grant    2681: 
1.30      wiz      2682:                 <dt><span class="sect2"><a href=
                   2683:                 "#how-to-use-binary-packages">4.1.2. How to use
                   2684:                 binary packages</a></span></dt>
1.1       grant    2685: 
1.30      wiz      2686:                 <dt><span class="sect2"><a href=
                   2687:                 "#a-word-of-warning">4.1.3. A word of
                   2688:                 warning</a></span></dt>
1.1       grant    2689:               </dl>
                   2690:             </dd>
                   2691: 
1.30      wiz      2692:             <dt><span class="sect1"><a href=
                   2693:             "#building-packages-from-source">4.2. Building packages
                   2694:             from source</a></span></dt>
1.1       grant    2695: 
                   2696:             <dd>
                   2697:               <dl>
1.30      wiz      2698:                 <dt><span class="sect2"><a href=
                   2699:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2700: 
1.30      wiz      2701:                 <dt><span class="sect2"><a href=
                   2702:                 "#fetching-distfiles">4.2.2. Fetching
                   2703:                 distfiles</a></span></dt>
1.1       grant    2704: 
1.30      wiz      2705:                 <dt><span class="sect2"><a href=
                   2706:                 "#how-to-build-and-install">4.2.3. How to build and
                   2707:                 install</a></span></dt>
1.1       grant    2708: 
1.30      wiz      2709:                 <dt><span class="sect2"><a href=
                   2710:                 "#selecting-the-compiler">4.2.4. Selecting the
                   2711:                 compiler</a></span></dt>
1.1       grant    2712:               </dl>
                   2713:             </dd>
                   2714:           </dl>
                   2715:         </div>
                   2716: 
                   2717:         <div class="sect1" lang="en" xml:lang="en">
                   2718:           <div class="titlepage">
                   2719:             <div>
                   2720:               <div>
                   2721:                 <h2 class="title" style="clear: both"><a name=
                   2722:                 "getting-started" id=
                   2723:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2724:                 packages</h2>
                   2725:               </div>
                   2726:             </div>
                   2727:           </div>
                   2728: 
                   2729:           <p>This section describes how to find, retrieve and
                   2730:           install a precompiled binary package that someone else
                   2731:           already prepared for your type of machine.</p>
                   2732: 
                   2733:           <div class="sect2" lang="en" xml:lang="en">
                   2734:             <div class="titlepage">
                   2735:               <div>
                   2736:                 <div>
1.30      wiz      2737:                   <h3 class="title"><a name=
                   2738:                   "where-to-get-binary-packages" id=
                   2739:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
                   2740:                   to get binary packages</h3>
1.1       grant    2741:                 </div>
                   2742:               </div>
                   2743:             </div>
                   2744: 
                   2745:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.45      wiz      2746:             and its mirrors in the directory <code xmlns=
                   2747:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   2748:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   2749:             for anonymous FTP access. <code class=
                   2750:             "varname">OSVERSION</code> is the NetBSD version
                   2751:             (<span><strong class="command">uname
                   2752:             -r</strong></span>), <code class="varname">ARCH</code>
                   2753:             is the architecture (<span><strong class=
                   2754:             "command">uname -p</strong></span>). In that directory,
                   2755:             there is a subdirectory for each category plus a
1.45      wiz      2756:             subdirectory <code xmlns=
                   2757:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2758:             "filename">All</code> which includes the actual
                   2759:             binaries in <code xmlns=
                   2760:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   2761:             "filename">.tgz</code> files. The category
                   2762:             subdirectories use symbolic links to those files (this
1.45      wiz      2763:             is the same directory layout as in <code xmlns=
                   2764:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2765:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2766: 
1.47      reed     2767:             <p>This same directory layout applies for CD-ROM
1.1       grant    2768:             distributions, only that the directory may be rooted
1.45      wiz      2769:             somewhere else, probably somewhere below <code xmlns=
                   2770:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2771:             "filename">/cdrom</code>. Please consult your CD-ROMs
1.1       grant    2772:             documentation for the exact location.</p>
                   2773:           </div>
                   2774: 
                   2775:           <div class="sect2" lang="en" xml:lang="en">
                   2776:             <div class="titlepage">
                   2777:               <div>
                   2778:                 <div>
1.30      wiz      2779:                   <h3 class="title"><a name=
                   2780:                   "how-to-use-binary-packages" id=
                   2781:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
                   2782:                   to use binary packages</h3>
1.1       grant    2783:                 </div>
                   2784:               </div>
                   2785:             </div>
                   2786: 
1.47      reed     2787:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      2788:             to your hard disk, you can install them with the
1.27      rillig   2789:             following command (be sure to <span><strong class=
1.14      xtraeme  2790:             "command">su</strong></span> to root first):</p>
1.1       grant    2791:             <pre class="screen">
1.14      xtraeme  2792: <code class="prompt">#</code> <strong class=
                   2793: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2794: </pre>
                   2795: 
                   2796:             <p>If you have FTP access and you don't want to
                   2797:             download the packages via FTP prior to installation,
1.14      xtraeme  2798:             you can do this automatically by giving
                   2799:             <span><strong class="command">pkg_add</strong></span>
                   2800:             an FTP URL:</p>
1.1       grant    2801:             <pre class="screen">
1.14      xtraeme  2802: <code class="prompt">#</code> <strong class=
1.27      rillig   2803: "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    2804: </pre>
                   2805: 
1.27      rillig   2806:             <p>Note that any prerequisite packages needed to run
                   2807:             the package in question will be installed, too,
1.1       grant    2808:             assuming they are present where you install from.</p>
                   2809: 
1.23      wiz      2810:             <p>To save some typing, you can set the <code class=
                   2811:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     2812:             semicolon-separated list of paths (including remote
1.23      wiz      2813:             URLs); trailing slashes are not allowed.</p>
                   2814: 
1.45      wiz      2815:             <p>Additionally to the <code xmlns=
                   2816:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      2817:             "filename">All</code> directory there exists a
1.45      wiz      2818:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2819:             class="filename">vulnerable</code> directory to which
                   2820:             binary packages with known vulnerabilities are moved,
                   2821:             since removing them could cause missing dependencies.
                   2822:             To use these packages, add the <code xmlns=
                   2823:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2824:             "filename">vulnerable</code> directory to your
                   2825:             <code class="varname">PKG_PATH</code>. However, you
                   2826:             should run <a xmlns=
1.23      wiz      2827:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2828:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      2829:             target="_top"><code xmlns="" class=
                   2830:             "filename">security/audit-packages</code></a>
1.47      reed     2831:             regularly, especially after installing new packages,
                   2832:             and verify that the vulnerabilities are acceptable for
                   2833:             your configuration. An example <code class=
                   2834:             "varname">PKG_PATH</code> would be: <code xmlns=
                   2835:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   2836:             "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      2837:             Please note that semicolon (';') is a shell
                   2838:             meta-character, so you'll probably have to quote
                   2839:             it.</p>
                   2840: 
1.1       grant    2841:             <p>After you've installed packages, be sure to have
1.45      wiz      2842:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2843:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   2844:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2845:             "filename">/usr/pkg/sbin</code> in your <code class=
                   2846:             "varname">PATH</code> so you can actually start the
                   2847:             just installed program.</p>
1.1       grant    2848:           </div>
                   2849: 
                   2850:           <div class="sect2" lang="en" xml:lang="en">
                   2851:             <div class="titlepage">
                   2852:               <div>
                   2853:                 <div>
1.30      wiz      2854:                   <h3 class="title"><a name="a-word-of-warning" id=
                   2855:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    2856:                   warning</h3>
                   2857:                 </div>
                   2858:               </div>
                   2859:             </div>
                   2860: 
                   2861:             <p>Please pay very careful attention to the warnings
                   2862:             expressed in the <a href=
                   2863:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2864:             <span class="citerefentry"><span class=
                   2865:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2866:             page about the inherent dangers of installing binary
                   2867:             packages which you did not create yourself, and the
                   2868:             security holes that can be introduced onto your system
                   2869:             by indiscriminate adding of such files.</p>
                   2870:           </div>
                   2871:         </div>
                   2872: 
                   2873:         <div class="sect1" lang="en" xml:lang="en">
                   2874:           <div class="titlepage">
                   2875:             <div>
                   2876:               <div>
                   2877:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      2878:                 "building-packages-from-source" id=
                   2879:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    2880:                 packages from source</h2>
                   2881:               </div>
                   2882:             </div>
                   2883:           </div>
                   2884: 
                   2885:           <p>This assumes that the package is already in pkgsrc. If
                   2886:           it is not, see <a href="#developers-guide" title=
1.46      gdt      2887:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   2888:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   2889:           instructions how to create your own packages.</p>
1.1       grant    2890: 
                   2891:           <div class="sect2" lang="en" xml:lang="en">
                   2892:             <div class="titlepage">
                   2893:               <div>
                   2894:                 <div>
1.30      wiz      2895:                   <h3 class="title"><a name="requirements" id=
                   2896:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2897:                 </div>
                   2898:               </div>
                   2899:             </div>
                   2900: 
                   2901:             <p>To build packages from source on a NetBSD system the
                   2902:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2903:             &#8220;<span class="quote">text</span>&#8221;
                   2904:             distribution sets must be installed. If you want to
1.47      reed     2905:             build X11-related packages the &#8220;<span class=
1.1       grant    2906:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2907:             "quote">xcomp</span>&#8221; distribution sets are
                   2908:             required, too.</p>
                   2909:           </div>
                   2910: 
                   2911:           <div class="sect2" lang="en" xml:lang="en">
                   2912:             <div class="titlepage">
                   2913:               <div>
                   2914:                 <div>
1.30      wiz      2915:                   <h3 class="title"><a name="fetching-distfiles"
                   2916:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    2917:                   distfiles</h3>
                   2918:                 </div>
                   2919:               </div>
                   2920:             </div>
                   2921: 
1.27      rillig   2922:             <p>The first step for building a package is downloading
                   2923:             the distfiles (i.e. the unmodified source). If they
                   2924:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    2925:             automatically.</p>
                   2926: 
                   2927:             <p>You can overwrite some of the major distribution
                   2928:             sites to fit to sites that are close to your own. Have
1.45      wiz      2929:             a look at <code xmlns=
                   2930:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2931:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   2932:             some examples &#8212; in particular, look for the
1.14      xtraeme  2933:             <code class="varname">MASTER_SORT</code>, <code class=
                   2934:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2935:             "varname">INET_COUNTRY</code> definitions. This may
                   2936:             save some of your bandwidth and time.</p>
1.1       grant    2937: 
                   2938:             <p>You can change these settings either in your shell's
                   2939:             environment, or, if you want to keep the settings, by
1.45      wiz      2940:             editing the <code xmlns=
                   2941:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2942:             "filename">/etc/mk.conf</code> file, and adding the
                   2943:             definitions there.</p>
1.1       grant    2944: 
                   2945:             <p>If you don't have a permanent Internet connection
                   2946:             and you want to know which files to download,
1.14      xtraeme  2947:             <span><strong class="command">make
                   2948:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      2949:             need. Put these distfiles into <code xmlns=
                   2950:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2951:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2952:           </div>
                   2953: 
                   2954:           <div class="sect2" lang="en" xml:lang="en">
                   2955:             <div class="titlepage">
                   2956:               <div>
                   2957:                 <div>
1.30      wiz      2958:                   <h3 class="title"><a name=
                   2959:                   "how-to-build-and-install" id=
                   2960:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   2961:                   build and install</h3>
1.1       grant    2962:                 </div>
                   2963:               </div>
                   2964:             </div>
                   2965: 
                   2966:             <p>Assuming that the distfile has been fetched (see
                   2967:             previous section), become root and change into the
1.47      reed     2968:             relevant directory and run <span><strong class=
                   2969:             "command">make</strong></span>.</p>
                   2970: 
                   2971:             <div class="note" style=
                   2972:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2973:               <h3 class="title">Note</h3>
                   2974: 
                   2975:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   2976:               system, use the pkgsrc <span><strong class=
                   2977:               "command">bmake</strong></span> command instead of
                   2978:               &#8220;<span class="quote">make</span>&#8221; in the
                   2979:               examples in this guide.</p>
                   2980:             </div>
                   2981: 
                   2982:             <p>For example, type</p>
1.1       grant    2983:             <pre class="screen">
1.14      xtraeme  2984: <code class="prompt">%</code> <strong class=
                   2985: "userinput"><code>cd misc/figlet</code></strong>
                   2986: <code class="prompt">%</code> <strong class=
                   2987: "userinput"><code>make</code></strong>
1.1       grant    2988: </pre>
                   2989: 
                   2990:             <p>at the shell prompt to build the various components
                   2991:             of the package, and</p>
                   2992:             <pre class="screen">
1.14      xtraeme  2993: <code class="prompt">#</code> <strong class=
                   2994: "userinput"><code>make install</code></strong>
1.1       grant    2995: </pre>
                   2996: 
                   2997:             <p>to install the various components into the correct
                   2998:             places on your system. Installing the package on your
                   2999:             system requires you to be root. However, pkgsrc has a
                   3000:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3001:             feature, which allows you to only become root for the
                   3002:             actual installation step</p>
                   3003: 
                   3004:             <p>Taking the figlet utility as an example, we can
                   3005:             install it on our system by building as shown in
                   3006:             <a href="#logs" title=
1.46      gdt      3007:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
1.1       grant    3008:             logs</i></a>.</p>
                   3009: 
                   3010:             <p>The program is installed under the default root of
1.45      wiz      3011:             the packages tree - <code xmlns=
                   3012:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3013:             "filename">/usr/pkg</code>. Should this not conform to
                   3014:             your tastes, set the <code class=
                   3015:             "varname">LOCALBASE</code> variable in your
1.1       grant    3016:             environment, and it will use that value as the root of
1.45      wiz      3017:             your packages tree. So, to use <code xmlns=
                   3018:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3019:             "filename">/usr/local</code>, set <code class=
                   3020:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3021:             environment. Please note that you should use a
                   3022:             directory which is dedicated to packages and not shared
1.47      reed     3023:             with other programs (i.e., do not try and use
1.14      xtraeme  3024:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3025:             should not try to add any of your own files or
1.45      wiz      3026:             directories (such as <code xmlns=
                   3027:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3028:             "filename">src/</code>, <code xmlns=
                   3029:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3030:             "filename">obj/</code>, or <code xmlns=
                   3031:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3032:             "filename">pkgsrc/</code>) below the <code class=
                   3033:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3034:             possible conflicts between programs and other files
                   3035:             installed by the package system and whatever else may
                   3036:             have been installed there.</p>
                   3037: 
1.45      wiz      3038:             <p>Some packages look in <code xmlns=
                   3039:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3040:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3041:             configuration options at build time. Have a look at
1.45      wiz      3042:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3043:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3044:             get an overview of what will be set there by default.
1.14      xtraeme  3045:             Environment variables such as <code class=
1.45      wiz      3046:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3047:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3048:             "filename">/etc/mk.conf</code> to save having to
                   3049:             remember to set them each time you want to use
                   3050:             pkgsrc.</p>
1.1       grant    3051: 
                   3052:             <p>Occasionally, people want to &#8220;<span class=
                   3053:             "quote">look under the covers</span>&#8221; to see what
                   3054:             is going on when a package is building or being
                   3055:             installed. This may be for debugging purposes, or out
                   3056:             of simple curiosity. A number of utility values have
                   3057:             been added to help with this.</p>
                   3058: 
                   3059:             <div class="orderedlist">
                   3060:               <ol type="1">
                   3061:                 <li>
                   3062:                   <p>If you invoke the <a href=
                   3063:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3064:                   <span class="citerefentry"><span class=
                   3065:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3066:                   with <code class=
                   3067:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3068:                   amount of information will be displayed. For
                   3069:                   example,</p>
1.1       grant    3070:                   <pre class="screen">
1.14      xtraeme  3071: <strong class=
                   3072: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3073: </pre>
                   3074: 
                   3075:                   <p>will show all the commands that are invoked,
                   3076:                   up to and including the &#8220;<span class=
                   3077:                   "quote">patch</span>&#8221; stage.</p>
                   3078:                 </li>
                   3079: 
                   3080:                 <li>
                   3081:                   <p>If you want to know the value of a certain
1.22      tv       3082:                   <a href=
                   3083:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3084:                   <span class="citerefentry"><span class=
                   3085:                   "refentrytitle">make</span>(1)</span></a>
                   3086:                   definition, then the <code class=
1.14      xtraeme  3087:                   "varname">VARNAME</code> definition should be
                   3088:                   used, in conjunction with the show-var target.
                   3089:                   e.g. to show the expansion of the <a href=
1.1       grant    3090:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3091:                   <span class="citerefentry"><span class=
                   3092:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3093:                   variable <code class=
1.22      tv       3094:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3095:                   <pre class="screen">
1.14      xtraeme  3096: <code class="prompt">%</code> <strong class=
                   3097: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3098: /usr/pkg
1.14      xtraeme  3099: <code class="prompt">%</code>
1.1       grant    3100:           
                   3101: </pre>
                   3102:                 </li>
                   3103:               </ol>
                   3104:             </div>
                   3105: 
                   3106:             <p>If you want to install a binary package that you've
                   3107:             either created yourself (see next section), that you
                   3108:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3109:             a remote FTP server, you can use the "bin-install"
1.1       grant    3110:             target. This target will install a binary package - if
                   3111:             available - via <a href=
                   3112:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3113:             <span class="citerefentry"><span class=
                   3114:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3115:             <span><strong class="command">make
                   3116:             package</strong></span>. The list of remote FTP sites
                   3117:             searched is kept in the variable <code class=
                   3118:             "varname">BINPKG_SITES</code>, which defaults to
                   3119:             ftp.NetBSD.org. Any flags that should be added to
                   3120:             <a href=
1.1       grant    3121:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3122:             <span class="citerefentry"><span class=
                   3123:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3124:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3125:             See <code xmlns=
                   3126:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3127:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3128:             details.</p>
1.1       grant    3129: 
1.47      reed     3130:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3131:             has a non-standard setting for <code class=
                   3132:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3133:             any packages are installed, as you can not use several
                   3134:             directories for the same purpose. Doing so will result
                   3135:             in pkgsrc not being able to properly detect your
                   3136:             installed packages, and fail miserably. Note also that
                   3137:             precompiled binary packages are usually built with the
1.14      xtraeme  3138:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3139:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3140:             class="filename">/usr/pkg</code>, and that you should
                   3141:             <span class="emphasis"><em>not</em></span> install any
                   3142:             if you use a non-standard <code class=
1.14      xtraeme  3143:             "varname">LOCALBASE</code>.</p>
1.1       grant    3144:           </div>
                   3145: 
                   3146:           <div class="sect2" lang="en" xml:lang="en">
                   3147:             <div class="titlepage">
                   3148:               <div>
                   3149:                 <div>
1.30      wiz      3150:                   <h3 class="title"><a name=
                   3151:                   "selecting-the-compiler" id=
                   3152:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3153:                   the compiler</h3>
1.1       grant    3154:                 </div>
                   3155:               </div>
                   3156:             </div>
                   3157: 
                   3158:             <p>By default, pkgsrc will use GCC to build packages.
                   3159:             This may be overridden by setting the following
                   3160:             variables in /etc/mk.conf:</p>
                   3161: 
                   3162:             <div class="variablelist">
                   3163:               <dl>
1.14      xtraeme  3164:                 <dt><span class="term"><code class=
                   3165:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3166: 
                   3167:                 <dd>
                   3168:                   <p>This is a list of values specifying the chain
                   3169:                   of compilers to invoke when building packages.
                   3170:                   Valid values are:</p>
                   3171: 
                   3172:                   <div class="itemizedlist">
                   3173:                     <ul type="disc">
                   3174:                       <li>
1.14      xtraeme  3175:                         <p><code class="varname">distcc</code>:
1.1       grant    3176:                         distributed C/C++ (chainable)</p>
                   3177:                       </li>
                   3178: 
                   3179:                       <li>
1.14      xtraeme  3180:                         <p><code class="varname">ccache</code>:
1.1       grant    3181:                         compiler cache (chainable)</p>
                   3182:                       </li>
                   3183: 
                   3184:                       <li>
1.14      xtraeme  3185:                         <p><code class="varname">gcc</code>: GNU
                   3186:                         C/C++ Compiler</p>
1.1       grant    3187:                       </li>
                   3188: 
                   3189:                       <li>
1.14      xtraeme  3190:                         <p><code class="varname">mipspro</code>:
1.1       grant    3191:                         Silicon Graphics, Inc. MIPSpro
                   3192:                         (n32/n64)</p>
                   3193:                       </li>
                   3194: 
                   3195:                       <li>
1.14      xtraeme  3196:                         <p><code class="varname">mipspro</code>:
1.1       grant    3197:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3198:                       </li>
                   3199: 
                   3200:                       <li>
1.14      xtraeme  3201:                         <p><code class="varname">sunpro</code>:
1.1       grant    3202:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3203:                         Studio</p>
                   3204:                       </li>
                   3205:                     </ul>
                   3206:                   </div>
                   3207: 
                   3208:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3209:                   "quote"><code class=
                   3210:                   "varname">gcc</code></span>&#8221;. You can use
                   3211:                   <code class="varname">ccache</code> and/or
                   3212:                   <code class="varname">distcc</code> with an
                   3213:                   appropriate <code class=
                   3214:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3215:                   &#8220;<span class="quote"><code class=
                   3216:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3217:                   variable should always be terminated with a value
                   3218:                   for a real compiler.</p>
                   3219:                 </dd>
                   3220: 
1.14      xtraeme  3221:                 <dt><span class="term"><code class=
                   3222:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3223: 
                   3224:                 <dd>
                   3225:                   <p>This specifies the minimum version of GCC to
                   3226:                   use when building packages. If the system GCC
                   3227:                   doesn't satisfy this requirement, then pkgsrc
                   3228:                   will build and install one of the GCC packages to
                   3229:                   use instead.</p>
                   3230:                 </dd>
                   3231:               </dl>
                   3232:             </div>
                   3233:           </div>
                   3234:         </div>
                   3235:       </div>
                   3236: 
                   3237:       <div class="chapter" lang="en" xml:lang="en">
                   3238:         <div class="titlepage">
                   3239:           <div>
                   3240:             <div>
1.38      dillo    3241:               <h2 class="title"><a name="configuring" id=
                   3242:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3243:               pkgsrc</h2>
                   3244:             </div>
                   3245:           </div>
                   3246:         </div>
                   3247: 
                   3248:         <div class="toc">
                   3249:           <p><b>Table of Contents</b></p>
                   3250: 
                   3251:           <dl>
                   3252:             <dt><span class="sect1"><a href=
1.45      wiz      3253:             "#general-configuration">5.1. General
                   3254:             configuration</a></span></dt>
                   3255: 
                   3256:             <dt><span class="sect1"><a href=
                   3257:             "#variables-affecting-build">5.2. Variables affecting
                   3258:             the build process</a></span></dt>
                   3259: 
                   3260:             <dt><span class="sect1"><a href=
                   3261:             "#developer-advanced-settings">5.3. Developer/advanced
                   3262:             settings</a></span></dt>
                   3263: 
                   3264:             <dt><span class="sect1"><a href=
                   3265:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3266:             Options</a></span></dt>
1.38      dillo    3267:           </dl>
                   3268:         </div>
                   3269: 
                   3270:         <div class="sect1" lang="en" xml:lang="en">
                   3271:           <div class="titlepage">
                   3272:             <div>
                   3273:               <div>
                   3274:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3275:                 "general-configuration" id=
                   3276:                 "general-configuration"></a>5.1.&nbsp;General
                   3277:                 configuration</h2>
                   3278:               </div>
                   3279:             </div>
                   3280:           </div>
                   3281: 
1.47      reed     3282:           <p>In this section, you can find some variables that
                   3283:           apply to all pkgsrc packages. The preferred method of
                   3284:           setting these variables is by setting them in
                   3285:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3286:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3287: 
                   3288:           <div class="itemizedlist">
                   3289:             <ul type="disc">
                   3290:               <li>
                   3291:                 <p><code class="varname">LOCALBASE</code>: Where
                   3292:                 packages will be installed. The default is
                   3293:                 <code xmlns=
                   3294:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3295:                 "filename">/usr/pkg</code>. Do not mix binary
                   3296:                 packages with different <code class=
                   3297:                 "varname">LOCALBASE</code>s!</p>
                   3298:               </li>
                   3299: 
                   3300:               <li>
                   3301:                 <p><code class="varname">CROSSBASE</code>: Where
                   3302:                 &#8220;<span class="quote">cross</span>&#8221;
                   3303:                 category packages will be installed. The default is
                   3304:                 <code xmlns=
                   3305:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3306:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3307:               </li>
                   3308: 
                   3309:               <li>
                   3310:                 <p><code class="varname">X11BASE</code>: Where X11
                   3311:                 is installed on the system. The default is
                   3312:                 <code xmlns=
                   3313:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3314:                 "filename">/usr/X11R6</code>.</p>
                   3315:               </li>
                   3316: 
                   3317:               <li>
                   3318:                 <p><code class="varname">DISTDIR</code>: Where to
                   3319:                 store the downloaded copies of the original source
                   3320:                 distributions used for building pkgsrc packages.
                   3321:                 The default is <code xmlns=
                   3322:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3323:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3324:               </li>
                   3325: 
                   3326:               <li>
                   3327:                 <p><code class=
                   3328:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3329:                 override the packages' <code class=
                   3330:                 "varname">MASTER_SITES</code> with this value.</p>
                   3331:               </li>
                   3332: 
                   3333:               <li>
                   3334:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3335:                 Backup location(s) for distribution files and patch
                   3336:                 files if not found locally or in <code xmlns=
                   3337:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3338:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3339:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3340:                 "filename">${PATCH_SITES}</code> respectively. The
                   3341:                 defaults are <code xmlns=
                   3342:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3343:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3344:                 and <code xmlns=
                   3345:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3346:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3347:               </li>
                   3348: 
                   3349:               <li>
                   3350:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3351:                 of sites carrying binary pkgs.</p>
                   3352:               </li>
                   3353:             </ul>
                   3354:           </div>
                   3355:         </div>
                   3356: 
                   3357:         <div class="sect1" lang="en" xml:lang="en">
                   3358:           <div class="titlepage">
                   3359:             <div>
                   3360:               <div>
                   3361:                 <h2 class="title" style="clear: both"><a name=
                   3362:                 "variables-affecting-build" id=
                   3363:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3364:                 affecting the build process</h2>
                   3365:               </div>
                   3366:             </div>
                   3367:           </div>
                   3368: 
                   3369:           <p>XXX</p>
                   3370: 
                   3371:           <div class="itemizedlist">
                   3372:             <ul type="disc">
                   3373:               <li>
                   3374:                 <p><code class="varname">PACKAGES</code>: The top
                   3375:                 level directory for the binary packages. The
                   3376:                 default is <code xmlns=
                   3377:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3378:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3379:               </li>
                   3380: 
                   3381:               <li>
                   3382:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3383:                 level directory where, if defined, the separate
                   3384:                 working directories will get created, and
                   3385:                 symbolically linked to from <code xmlns=
                   3386:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3387:                 "filename">${WRKDIR}</code> (see below). This is
                   3388:                 useful for building packages on several
                   3389:                 architectures, then <code xmlns=
                   3390:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3391:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3392:                 while <code xmlns=
                   3393:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3394:                 "filename">${WRKOBJDIR}</code> is local to every
                   3395:                 architecture. (It should be noted that <code class=
                   3396:                 "varname">PKGSRCDIR</code> should not be set by the
                   3397:                 user &#8212; it is an internal definition which
                   3398:                 refers to the root of the pkgsrc tree. It is
                   3399:                 possible to have many pkgsrc tree instances.)</p>
                   3400:               </li>
                   3401: 
                   3402:               <li>
                   3403:                 <p><code class="varname">LOCALPATCHES</code>:
                   3404:                 Directory for local patches that aren't part of
                   3405:                 pkgsrc. See <a href="#components.patches" title=
                   3406:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3407:                 &#8220;patches/*&#8221;</a> for more information.
                   3408:                 <em class="replaceable"><code>rel</code></em> and
                   3409:                 <em class="replaceable"><code>arch</code></em> are
                   3410:                 replaced with OS release (&#8220;<span class=
                   3411:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3412:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3413:                 etc.).</p>
                   3414:               </li>
                   3415: 
                   3416:               <li>
                   3417:                 <p><code class="varname">PKGMAKECONF</code>:
                   3418:                 Location of the <code xmlns=
                   3419:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3420:                 "filename">mk.conf</code> file used by a package's
                   3421:                 BSD-style Makefile. If this is not set,
                   3422:                 <code class="varname">MAKECONF</code> is set to
                   3423:                 <code xmlns=
                   3424:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3425:                 "filename">/dev/null</code> to avoid picking up
                   3426:                 settings used by builds in <code xmlns=
                   3427:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3428:                 "filename">/usr/src</code>.</p>
                   3429:               </li>
                   3430:             </ul>
                   3431:           </div>
                   3432:         </div>
                   3433: 
                   3434:         <div class="sect1" lang="en" xml:lang="en">
                   3435:           <div class="titlepage">
                   3436:             <div>
                   3437:               <div>
                   3438:                 <h2 class="title" style="clear: both"><a name=
                   3439:                 "developer-advanced-settings" id=
                   3440:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3441:                 settings</h2>
                   3442:               </div>
                   3443:             </div>
                   3444:           </div>
                   3445: 
                   3446:           <p>XXX</p>
                   3447: 
                   3448:           <div class="itemizedlist">
                   3449:             <ul type="disc">
                   3450:               <li>
                   3451:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3452:                 some sanity checks that package developers
                   3453:                 want:</p>
                   3454: 
                   3455:                 <div class="itemizedlist">
                   3456:                   <ul type="circle">
                   3457:                     <li>
                   3458:                       <p>make sure patches apply with zero fuzz</p>
                   3459:                     </li>
                   3460: 
                   3461:                     <li>
                   3462:                       <p>run check-shlibs to see that all binaries
                   3463:                       will find their shared libs.</p>
                   3464:                     </li>
                   3465:                   </ul>
                   3466:                 </div>
                   3467:               </li>
                   3468: 
                   3469:               <li>
                   3470:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3471:                 The level of debugging output which is displayed
                   3472:                 whilst making and installing the package. The
                   3473:                 default value for this is 0, which will not display
                   3474:                 the commands as they are executed (normal, default,
                   3475:                 quiet operation); the value 1 will display all
                   3476:                 shell commands before their invocation, and the
                   3477:                 value 2 will display both the shell commands before
                   3478:                 their invocation, and their actual execution
                   3479:                 progress with <span><strong class="command">set
                   3480:                 -x</strong></span> will be displayed.</p>
                   3481:               </li>
                   3482:             </ul>
                   3483:           </div>
                   3484:         </div>
                   3485: 
                   3486:         <div class="sect1" lang="en" xml:lang="en">
                   3487:           <div class="titlepage">
                   3488:             <div>
                   3489:               <div>
                   3490:                 <h2 class="title" style="clear: both"><a name=
                   3491:                 "selecting-build-options" id=
                   3492:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   3493:                 Build Options</h2>
1.38      dillo    3494:               </div>
                   3495:             </div>
                   3496:           </div>
                   3497: 
                   3498:           <p>Some packages have build time options, usually to
                   3499:           select between different dependencies, enable optional
                   3500:           support for big dependencies or enable experimental
                   3501:           features.</p>
                   3502: 
                   3503:           <p>To see which options, if any, a package supports, and
                   3504:           which options are mutually exclusive, run
                   3505:           <span><strong class="command">make
                   3506:           show-options</strong></span>, for example:</p>
                   3507:           <pre class="programlisting">
1.44      gdt      3508:       The following options are supported by this package:
                   3509:       ssl      Enable SSL support.
                   3510:       Exactly one of the following gecko options is required:
                   3511:       firefox  Use firefox as gecko rendering engine.
                   3512:       mozilla  Use mozilla as gecko rendering engine.
                   3513:       At most one of the following database options may be selected:
                   3514:       mysql    Enable support for MySQL database.
                   3515:       pgsql    Enable support for PostgreSQL database.
1.38      dillo    3516: 
1.44      gdt      3517:       These options are enabled by default: firefox
                   3518:       These options are currently enabled: mozilla ssl
                   3519:     
1.38      dillo    3520: </pre>
                   3521: 
1.45      wiz      3522:           <p>The following variables can be defined in <code xmlns=
                   3523:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3524:           "filename">/etc/mk.conf</code> to select which options to
                   3525:           enable for a package: <code class=
                   3526:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   3527:           to select or disable options for all packages that
                   3528:           support them, and <code class=
                   3529:           "varname">PKG_OPTIONS.<em class=
                   3530:           "replaceable"><code>pkgbase</code></em></code>, which can
                   3531:           be used to select or disable options specifically for
                   3532:           package <em class=
                   3533:           "replaceable"><code>pkgbase</code></em>. Options listed
                   3534:           in these variables are selected, options preceded by
                   3535:           &#8220;<span class="quote">-</span>&#8221; are
                   3536:           disabled.</p>
                   3537: 
1.39      dillo    3538:           <p>The following settings are consulted in the order
                   3539:           given, and the last setting that selects or disables an
                   3540:           option is used:</p>
1.38      dillo    3541: 
                   3542:           <div class="orderedlist">
                   3543:             <ol type="1">
                   3544:               <li>
                   3545:                 <p>the default options as suggested by the package
                   3546:                 maintainer</p>
                   3547:               </li>
                   3548: 
                   3549:               <li>
                   3550:                 <p>the options implied by the settings of legacy
                   3551:                 variables (see below)</p>
                   3552:               </li>
                   3553: 
                   3554:               <li>
                   3555:                 <p><code class=
                   3556:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   3557:               </li>
                   3558: 
                   3559:               <li>
                   3560:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   3561:                 "replaceable"><code>pkgbase</code></em></code></p>
                   3562:               </li>
                   3563:             </ol>
                   3564:           </div>
                   3565: 
                   3566:           <p>For groups of mutually exclusive options, the last
                   3567:           option selected is used, all others are automatically
                   3568:           disabled. If an option of the group is explicitly
                   3569:           disabled, the previously selected option, if any, is
                   3570:           used. It is an error if no option from a required group
                   3571:           of options is selected, and building the package will
                   3572:           fail.</p>
                   3573: 
                   3574:           <p>Before the options framework was introduced, build
                   3575:           options were selected by setting a variable in
1.45      wiz      3576:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3577:           class="filename">/etc/mk.conf</code> for each option. To
                   3578:           ease transition to the options framework for the user,
                   3579:           these legacy variables are converted to the appropriate
                   3580:           options setting automatically. A warning is issued to
                   3581:           prompt the user to update <code xmlns=
                   3582:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    3583:           "filename">/etc/mk.conf</code> to use the options
                   3584:           framework directly. Support for these legacy variables
                   3585:           will be removed eventually.</p>
                   3586:         </div>
                   3587:       </div>
                   3588: 
                   3589:       <div class="chapter" lang="en" xml:lang="en">
                   3590:         <div class="titlepage">
                   3591:           <div>
                   3592:             <div>
1.1       grant    3593:               <h2 class="title"><a name="binary" id=
1.38      dillo    3594:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    3595:               packages</h2>
                   3596:             </div>
                   3597:           </div>
                   3598:         </div>
                   3599: 
                   3600:         <div class="toc">
                   3601:           <p><b>Table of Contents</b></p>
                   3602: 
                   3603:           <dl>
1.30      wiz      3604:             <dt><span class="sect1"><a href=
1.38      dillo    3605:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      3606:             single binary package</a></span></dt>
1.1       grant    3607: 
1.30      wiz      3608:             <dt><span class="sect1"><a href=
1.38      dillo    3609:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    3610:             Settings for creation of binary
                   3611:             packages</a></span></dt>
                   3612: 
1.38      dillo    3613:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    3614:             a bulk build of all packages</a></span></dt>
                   3615: 
                   3616:             <dd>
                   3617:               <dl>
                   3618:                 <dt><span class="sect2"><a href=
1.38      dillo    3619:                 "#binary.configuration">6.3.1.
1.1       grant    3620:                 Configuration</a></span></dt>
                   3621: 
1.30      wiz      3622:                 <dt><span class="sect2"><a href=
1.38      dillo    3623:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      3624:                 environmental considerations</a></span></dt>
1.1       grant    3625: 
1.38      dillo    3626:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    3627:                 Operation</a></span></dt>
                   3628: 
1.30      wiz      3629:                 <dt><span class="sect2"><a href=
1.38      dillo    3630:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    3631: 
1.30      wiz      3632:                 <dt><span class="sect2"><a href=
1.38      dillo    3633:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      3634:                 requirements</a></span></dt>
1.1       grant    3635: 
1.30      wiz      3636:                 <dt><span class="sect2"><a href=
1.38      dillo    3637:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     3638:                 for chrooted builds</a></span></dt>
1.1       grant    3639: 
1.30      wiz      3640:                 <dt><span class="sect2"><a href=
1.38      dillo    3641:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      3642:                 set of packages</a></span></dt>
1.13      hubertf  3643: 
                   3644:                 <dt><span class="sect2"><a href=
1.38      dillo    3645:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  3646:                 build</a></span></dt>
1.1       grant    3647:               </dl>
                   3648:             </dd>
                   3649: 
1.38      dillo    3650:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    3651:             Creating a multiple CD-ROM packages
                   3652:             collection</a></span></dt>
                   3653: 
                   3654:             <dd>
                   3655:               <dl>
1.30      wiz      3656:                 <dt><span class="sect2"><a href=
1.38      dillo    3657:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      3658:                 cdpack</a></span></dt>
1.1       grant    3659:               </dl>
                   3660:             </dd>
                   3661:           </dl>
                   3662:         </div>
                   3663: 
                   3664:         <div class="sect1" lang="en" xml:lang="en">
                   3665:           <div class="titlepage">
                   3666:             <div>
                   3667:               <div>
                   3668:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3669:                 "building-a-single-binary-package" id=
1.38      dillo    3670:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      3671:                 a single binary package</h2>
1.1       grant    3672:               </div>
                   3673:             </div>
                   3674:           </div>
                   3675: 
                   3676:           <p>Once you have built and installed a package, you can
                   3677:           create a <span class="emphasis"><em>binary
                   3678:           package</em></span> which can be installed on another
                   3679:           system with <a href=
                   3680:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3681:           <span class="citerefentry"><span class=
1.47      reed     3682:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    3683:           having to build the same package on a group of hosts and
                   3684:           wasting CPU time. It also provides a simple means for
                   3685:           others to install your package, should you distribute
                   3686:           it.</p>
                   3687: 
                   3688:           <p>To create a binary package, change into the
1.14      xtraeme  3689:           appropriate directory in pkgsrc, and run
                   3690:           <span><strong class="command">make
                   3691:           package</strong></span>:</p>
1.1       grant    3692:           <pre class="screen">
1.14      xtraeme  3693: <code class="prompt">#</code> <strong class=
                   3694: "userinput"><code>cd misc/figlet</code></strong>
                   3695: <code class="prompt">#</code> <strong class=
                   3696: "userinput"><code>make package</code></strong>
1.1       grant    3697: </pre>
                   3698: 
                   3699:           <p>This will build and install your package (if not
                   3700:           already done), and then build a binary package from what
1.14      xtraeme  3701:           was installed. You can then use the <span><strong class=
                   3702:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      3703:           Binary packages are created by default in <code xmlns=
                   3704:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3705:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3706:           gzipped tar file. See <a href="#logs.package" title=
1.46      gdt      3707:           "B.2.&nbsp;Packaging figlet">Section B.2,
1.1       grant    3708:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3709:           the above <a xmlns=
                   3710:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3711:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      3712:           target="_top"><code xmlns="" class=
                   3713:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    3714: 
                   3715:           <p>See <a href="#submit" title=
1.38      dillo    3716:           "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter
                   3717:           17, <i>Submitting and Committing</i></a> for information
1.1       grant    3718:           on how to submit such a binary package.</p>
                   3719:         </div>
                   3720: 
                   3721:         <div class="sect1" lang="en" xml:lang="en">
                   3722:           <div class="titlepage">
                   3723:             <div>
                   3724:               <div>
                   3725:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3726:                 "settings-for-creationg-of-binary-packages" id=
1.38      dillo    3727:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    3728:                 for creation of binary packages</h2>
                   3729:               </div>
                   3730:             </div>
                   3731:           </div>
                   3732: 
                   3733:           <p>See <a href="#build.helpful-targets" title=
1.38      dillo    3734:           "14.3.&nbsp;Other helpful targets">Section&nbsp;14.3,
1.1       grant    3735:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3736:         </div>
                   3737: 
                   3738:         <div class="sect1" lang="en" xml:lang="en">
                   3739:           <div class="titlepage">
                   3740:             <div>
                   3741:               <div>
                   3742:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    3743:                 "bulkbuild" id="bulkbuild"></a>6.3.&nbsp;Doing a
1.1       grant    3744:                 bulk build of all packages</h2>
                   3745:               </div>
                   3746:             </div>
                   3747:           </div>
                   3748: 
                   3749:           <p>If you want to get a full set of precompiled binary
                   3750:           packages, this section describes how to get them. Beware
                   3751:           that the bulk build will remove all currently installed
1.23      wiz      3752:           packages from your system! Having an FTP server
                   3753:           configured either on the machine doing the bulk builds or
                   3754:           on a nearby NFS server can help to make the packages
                   3755:           available to everyone. See <a href=
1.1       grant    3756:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3757:           <span class="citerefentry"><span class=
                   3758:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3759:           information. If you use a remote NFS server's storage, be
                   3760:           sure to not actually compile on NFS storage, as this
                   3761:           slows things down a lot.</p>
                   3762: 
                   3763:           <div class="sect2" lang="en" xml:lang="en">
                   3764:             <div class="titlepage">
                   3765:               <div>
                   3766:                 <div>
                   3767:                   <h3 class="title"><a name="binary.configuration"
                   3768:                   id=
1.38      dillo    3769:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    3770:                 </div>
                   3771:               </div>
                   3772:             </div>
                   3773: 
                   3774:             <div class="sect3" lang="en" xml:lang="en">
                   3775:               <div class="titlepage">
                   3776:                 <div>
                   3777:                   <div>
                   3778:                     <h4 class="title"><a name="binary.mk.conf" id=
1.38      dillo    3779:                     "binary.mk.conf"></a>6.3.1.1.&nbsp;/etc/mk.conf</h4>
1.1       grant    3780:                   </div>
                   3781:                 </div>
                   3782:               </div>
                   3783: 
1.45      wiz      3784:               <p>You may want to set variables in <code xmlns=
                   3785:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3786:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   3787:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3788:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3789:               details of the default settings. You will want to
1.14      xtraeme  3790:               ensure that <code class=
                   3791:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3792:               policy. As used in this example, <code class=
                   3793:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3794:               "emphasis"><em>all</em></span> licenses.</p>
                   3795:               <pre class="programlisting">
                   3796: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3797: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3798: BSDSRCDIR=      /usr/src
                   3799: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3800: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3801: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3802: PKG_DEVELOPER?= yes
                   3803: _ACCEPTABLE=    yes
                   3804: </pre>
                   3805:             </div>
                   3806: 
                   3807:             <div class="sect3" lang="en" xml:lang="en">
                   3808:               <div class="titlepage">
                   3809:                 <div>
                   3810:                   <div>
1.30      wiz      3811:                     <h4 class="title"><a name="build.conf" id=
1.45      wiz      3812:                     "build.conf"></a>6.3.1.2.&nbsp;<code xmlns=
                   3813:                     "http://www.w3.org/TR/xhtml1/transitional"
                   3814:                     class="filename">build.conf</code></h4>
1.1       grant    3815:                   </div>
                   3816:                 </div>
                   3817:               </div>
                   3818: 
1.45      wiz      3819:               <p>In <code xmlns=
                   3820:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3821:               "filename">pkgsrc/mk/bulk</code>, copy <code xmlns=
                   3822:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3823:               "filename">build.conf-example</code> to <code xmlns=
                   3824:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3825:               "filename">build.conf</code> and edit it, following
                   3826:               the comments in that file. This is the config file
                   3827:               that determines where log files are generated after
                   3828:               the build, where to mail the build report to, where
                   3829:               your pkgsrc tree is located and the user to which
                   3830:               user to <a href=
1.1       grant    3831:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3832:               <span class="citerefentry"><span class=
1.23      wiz      3833:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3834:               <span><strong class="command">cvs
                   3835:               update</strong></span>.</p>
1.1       grant    3836:             </div>
                   3837: 
                   3838:             <div class="sect3" lang="en" xml:lang="en">
                   3839:               <div class="titlepage">
                   3840:                 <div>
                   3841:                   <div>
1.30      wiz      3842:                     <h4 class="title"><a name="pre-build.local" id=
1.45      wiz      3843:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3844:                     class="filename">pre-build.local</code></h4>
1.1       grant    3845:                   </div>
                   3846:                 </div>
                   3847:               </div>
                   3848: 
                   3849:               <p>It is possible to configure the bulk build to
1.47      reed     3850:               perform certain site-specific tasks at the end of the
1.45      wiz      3851:               pre-build stage. If the file <code xmlns=
                   3852:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3853:               "filename">pre-build.local</code> exists in
1.45      wiz      3854:               <code xmlns=
                   3855:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3856:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   3857:               executed (as a <a href=
1.24      wiz      3858:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   3859:               <span class="citerefentry"><span class=
                   3860:               "refentrytitle">sh</span>(1)</span></a> script) at
                   3861:               the end of the usual pre-build stage. An example use
1.45      wiz      3862:               of <code xmlns=
                   3863:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3864:               "filename">pre-build.local</code> is to have the
                   3865:               line:</p>
1.1       grant    3866:               <pre class="screen">
1.14      xtraeme  3867: <code class="prompt">#</code> <strong class=
                   3868: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3869:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3870: </pre>
                   3871: 
                   3872:               <p>to prevent the system from trying to build a
                   3873:               particular package which requires nearly 3 GB of disk
                   3874:               space.</p>
                   3875:             </div>
                   3876:           </div>
                   3877: 
                   3878:           <div class="sect2" lang="en" xml:lang="en">
                   3879:             <div class="titlepage">
                   3880:               <div>
                   3881:                 <div>
1.30      wiz      3882:                   <h3 class="title"><a name=
                   3883:                   "other-environmental-considerations" id=
1.38      dillo    3884:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      3885:                   environmental considerations</h3>
1.1       grant    3886:                 </div>
                   3887:               </div>
                   3888:             </div>
                   3889: 
1.45      wiz      3890:             <p>As <code xmlns=
                   3891:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3892:             "filename">/usr/pkg</code> will be completely deleted
                   3893:             at the start of bulk builds, make sure your login shell
                   3894:             is placed somewhere else. Either drop it into
                   3895:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3896:             class="filename">/usr/local/bin</code> (and adjust your
                   3897:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  3898:             <a href=
1.1       grant    3899:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3900:             <span class="citerefentry"><span class=
                   3901:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      3902:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3903:             class="filename">/etc/rc.local</code>, so you can login
                   3904:             after a reboot (remember that your current process
                   3905:             won't die if the package is removed, you just can't
                   3906:             start any new instances of the shell any more). Also,
                   3907:             if you use NetBSD earlier than 1.5, or you still want
                   3908:             to use the pkgsrc version of ssh for some reason, be
                   3909:             sure to install ssh before starting it from
                   3910:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3911:             class="filename">rc.local</code>:</p>
1.1       grant    3912:             <pre class="programlisting">
                   3913: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3914: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3915:     /usr/pkg/etc/rc.d/sshd
                   3916: fi
                   3917: </pre>
                   3918: 
                   3919:             <p>Not doing so will result in you being not able to
                   3920:             log in via ssh after the bulk build is finished or if
                   3921:             the machine gets rebooted or crashes. You have been
                   3922:             warned! :)</p>
                   3923:           </div>
                   3924: 
                   3925:           <div class="sect2" lang="en" xml:lang="en">
                   3926:             <div class="titlepage">
                   3927:               <div>
                   3928:                 <div>
1.30      wiz      3929:                   <h3 class="title"><a name="operation" id=
1.38      dillo    3930:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    3931:                 </div>
                   3932:               </div>
                   3933:             </div>
                   3934: 
                   3935:             <p>Make sure you don't need any of the packages still
                   3936:             installed.</p>
                   3937: 
                   3938:             <div class="warning" style=
                   3939:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3940:               <h3 class="title">Warning</h3>
                   3941: 
                   3942:               <p>During the bulk build, <span class=
                   3943:               "emphasis"><em>all packages will be
                   3944:               removed!</em></span></p>
                   3945:             </div>
                   3946: 
                   3947:             <p>Be sure to remove all other things that might
                   3948:             interfere with builds, like some libs installed in
1.45      wiz      3949:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3950:             class="filename">/usr/local</code>, etc. then become
                   3951:             root and type:</p>
1.1       grant    3952:             <pre class="screen">
1.14      xtraeme  3953: <code class="prompt">#</code> <strong class=
                   3954: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3955: <code class="prompt">#</code> <strong class=
                   3956: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3957: </pre>
                   3958: 
                   3959:             <p>If for some reason your last build didn't complete
                   3960:             (power failure, system panic, ...), you can continue it
                   3961:             by running:</p>
                   3962:             <pre class="screen">
1.14      xtraeme  3963: <code class="prompt">#</code> <strong class=
                   3964: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3965: </pre>
                   3966: 
                   3967:             <p>At the end of the bulk build, you will get a summary
                   3968:             via mail, and find build logs in the directory
1.14      xtraeme  3969:             specified by <code class="varname">FTP</code> in the
1.45      wiz      3970:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3971:             class="filename">build.conf</code> file.</p>
1.1       grant    3972:           </div>
                   3973: 
                   3974:           <div class="sect2" lang="en" xml:lang="en">
                   3975:             <div class="titlepage">
                   3976:               <div>
                   3977:                 <div>
1.30      wiz      3978:                   <h3 class="title"><a name="what-it-does" id=
1.38      dillo    3979:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    3980:                 </div>
                   3981:               </div>
                   3982:             </div>
                   3983: 
                   3984:             <p>The bulk builds consist of three steps:</p>
                   3985: 
                   3986:             <div class="variablelist">
                   3987:               <dl>
                   3988:                 <dt><span class="term">1. pre-build</span></dt>
                   3989: 
                   3990:                 <dd>
                   3991:                   <p>The script updates your pkgsrc tree via
                   3992:                   (anon)cvs, then cleans out any broken distfiles,
                   3993:                   and removes all packages installed.</p>
                   3994:                 </dd>
                   3995: 
                   3996:                 <dt><span class="term">2. the bulk
                   3997:                 build</span></dt>
                   3998: 
                   3999:                 <dd>
                   4000:                   <p>This is basically &#8220;<span class=
                   4001:                   "quote">make bulk-package</span>&#8221; with an
                   4002:                   optimised order in which packages will be built.
                   4003:                   Packages that don't require other packages will
                   4004:                   be built first, and packages with many
                   4005:                   dependencies will be built later.</p>
                   4006:                 </dd>
                   4007: 
                   4008:                 <dt><span class="term">3. post-build</span></dt>
                   4009: 
                   4010:                 <dd>
                   4011:                   <p>Generates a report that's placed in the
1.45      wiz      4012:                   directory specified in the <code xmlns=
                   4013:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4014:                   "filename">build.conf</code> file named
1.45      wiz      4015:                   <code xmlns=
                   4016:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4017:                   "filename">broken.html</code>, a short version of
                   4018:                   that report will also be mailed to the build's
                   4019:                   admin.</p>
1.1       grant    4020:                 </dd>
                   4021:               </dl>
                   4022:             </div>
                   4023: 
                   4024:             <p>During the build, a list of broken packages will be
1.45      wiz      4025:             compiled in <code xmlns=
                   4026:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4027:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4028:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4029:             "filename">.../.broken.${MACHINE}</code> if
                   4030:             <code class="varname">OBJMACHINE</code> is set),
                   4031:             individual build logs of broken builds can be found in
                   4032:             the package's directory. These files are used by the
                   4033:             bulk-targets to mark broken builds to not waste time
                   4034:             trying to rebuild them, and they can be used to debug
                   4035:             these broken package builds later.</p>
1.1       grant    4036:           </div>
                   4037: 
                   4038:           <div class="sect2" lang="en" xml:lang="en">
                   4039:             <div class="titlepage">
                   4040:               <div>
                   4041:                 <div>
1.30      wiz      4042:                   <h3 class="title"><a name=
                   4043:                   "disk-space-requirements" id=
1.38      dillo    4044:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4045:                   space requirements</h3>
1.1       grant    4046:                 </div>
                   4047:               </div>
                   4048:             </div>
                   4049: 
                   4050:             <p>Currently, roughly the following requirements are
                   4051:             valid for NetBSD 2.0/i386:</p>
                   4052: 
                   4053:             <div class="itemizedlist">
                   4054:               <ul type="disc">
                   4055:                 <li>
                   4056:                   <p>10 GB - distfiles (NFS ok)</p>
                   4057:                 </li>
                   4058: 
                   4059:                 <li>
                   4060:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4061:                 </li>
                   4062: 
                   4063:                 <li>
                   4064:                   <p>5 GB - temp space for compiling (local disk
                   4065:                   recommended)</p>
                   4066:                 </li>
                   4067:               </ul>
                   4068:             </div>
                   4069: 
                   4070:             <p>Note that all pkgs will be de-installed as soon as
                   4071:             they are turned into a binary package, and that sources
                   4072:             are removed, so there is no excessively huge demand to
                   4073:             disk space. Afterwards, if the package is needed again,
                   4074:             it will be installed via <a href=
                   4075:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4076:             <span class="citerefentry"><span class=
                   4077:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4078:             building again, so there are no cycles wasted by
                   4079:             recompiling.</p>
                   4080:           </div>
                   4081: 
                   4082:           <div class="sect2" lang="en" xml:lang="en">
                   4083:             <div class="titlepage">
                   4084:               <div>
                   4085:                 <div>
1.30      wiz      4086:                   <h3 class="title"><a name="setting-up-a-sandbox"
1.38      dillo    4087:                   id="setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting
1.47      reed     4088:                   up a sandbox for chrooted builds</h3>
1.1       grant    4089:                 </div>
                   4090:               </div>
                   4091:             </div>
                   4092: 
1.12      agc      4093:             <p>If you don't want all the packages nuked from a
                   4094:             machine (rendering it useless for anything but pkg
1.23      wiz      4095:             compiling), there is the possibility of doing the
                   4096:             package bulk build inside a chroot environment.</p>
1.12      agc      4097: 
                   4098:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4099:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4100:             class="filename">/usr/sandbox</code>. This can be done
                   4101:             by using null mounts, or manually.</p>
1.12      agc      4102: 
1.45      wiz      4103:             <p>There is a shell script called <code xmlns=
                   4104:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4105:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4106:             set up the sandbox environment using null mounts. It
1.45      wiz      4107:             will also create a script called <code xmlns=
                   4108:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4109:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4110:             environment, which will allow the null mounts to be
1.14      xtraeme  4111:             activated using the <span><strong class=
                   4112:             "command">sandbox mount</strong></span> command and
                   4113:             deactivated using the <span><strong class=
                   4114:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4115: 
                   4116:             <p>To set up a sandbox environment by hand, after
                   4117:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4118:             doing a <span><strong class="command">make distribution
1.45      wiz      4119:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4120:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4121:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4122:             items are present and properly configured:</p>
1.1       grant    4123: 
                   4124:             <div class="procedure">
                   4125:               <ol type="1">
                   4126:                 <li>
                   4127:                   <p>Kernel</p>
                   4128:                   <pre class="screen">
1.14      xtraeme  4129: <code class="prompt">#</code> <strong class=
                   4130: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4131: </pre>
                   4132:                 </li>
                   4133: 
                   4134:                 <li>
1.45      wiz      4135:                   <p><code xmlns=
                   4136:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4137:                   "filename">/dev/*</code></p>
1.1       grant    4138:                   <pre class="screen">
1.14      xtraeme  4139: <code class="prompt">#</code> <strong class=
                   4140: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4141: </pre>
                   4142:                 </li>
                   4143: 
                   4144:                 <li>
1.45      wiz      4145:                   <p><code xmlns=
                   4146:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4147:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4148:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4149:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4150:                   target="_top"><code xmlns="" class=
                   4151:                   "filename">security/smtpd</code></a> and
                   4152:                   mail):</p>
1.1       grant    4153:                   <pre class="screen">
1.14      xtraeme  4154: <code class="prompt">#</code> <strong class=
                   4155: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4156: </pre>
                   4157:                 </li>
                   4158: 
                   4159:                 <li>
                   4160:                   <p>Working(!) mail config (hostname,
                   4161:                   sendmail.cf):</p>
                   4162:                   <pre class="screen">
1.14      xtraeme  4163: <code class="prompt">#</code> <strong class=
                   4164: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4165: </pre>
                   4166:                 </li>
                   4167: 
                   4168:                 <li>
1.45      wiz      4169:                   <p><code xmlns=
                   4170:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4171:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4172:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4173:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4174:                   target="_top"><code xmlns="" class=
                   4175:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4176:                   <pre class="screen">
1.14      xtraeme  4177: <code class="prompt">#</code> <strong class=
                   4178: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4179: </pre>
                   4180:                 </li>
                   4181: 
                   4182:                 <li>
1.45      wiz      4183:                   <p><code xmlns=
                   4184:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4185:                   "filename">/usr/src</code> (system sources, for
                   4186:                   <a xmlns=
1.1       grant    4187:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4188:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4189:                   target="_top"><code xmlns="" class=
                   4190:                   "filename">sysutils/aperture</code></a>,
                   4191:                   <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4192:                   href=
1.20      ben      4193:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
1.45      wiz      4194:                   target="_top"><code xmlns="" class=
                   4195:                   "filename">net/ppp-mppe</code></a>):</p>
1.1       grant    4196:                   <pre class="screen">
1.14      xtraeme  4197: <code class="prompt">#</code> <strong class=
                   4198: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4199: <code class="prompt">#</code> <strong class=
1.23      wiz      4200: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4201: </pre>
                   4202:                 </li>
                   4203: 
                   4204:                 <li>
1.45      wiz      4205:                   <p>Create <code xmlns=
                   4206:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4207:                   "filename">/var/db/pkg</code> (not part of
                   4208:                   default install):</p>
1.1       grant    4209:                   <pre class="screen">
1.14      xtraeme  4210: <code class="prompt">#</code> <strong class=
                   4211: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4212: </pre>
                   4213:                 </li>
                   4214: 
                   4215:                 <li>
1.45      wiz      4216:                   <p>Create <code xmlns=
                   4217:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4218:                   "filename">/usr/pkg</code> (not part of default
                   4219:                   install):</p>
1.1       grant    4220:                   <pre class="screen">
1.14      xtraeme  4221: <code class="prompt">#</code> <strong class=
                   4222: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4223: </pre>
                   4224:                 </li>
                   4225: 
                   4226:                 <li>
1.45      wiz      4227:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4228:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4229:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4230:                   <pre class="screen">
1.14      xtraeme  4231: <code class="prompt">#</code> <strong class=
                   4232: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4233: <code class="prompt">#</code> <strong class=
                   4234: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4235: </pre>
                   4236: 
                   4237:                   <p>Do not mount/link this to the copy of your
                   4238:                   pkgsrc tree you do development in, as this will
                   4239:                   likely cause problems!</p>
                   4240:                 </li>
                   4241: 
                   4242:                 <li>
1.45      wiz      4243:                   <p>Make <code xmlns=
                   4244:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4245:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4246:                   and <code xmlns=
                   4247:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4248:                   "filename">.../distfiles</code> point somewhere
                   4249:                   appropriate. NFS- and/or nullfs-mounts may come
                   4250:                   in handy!</p>
1.1       grant    4251:                 </li>
                   4252: 
                   4253:                 <li>
1.45      wiz      4254:                   <p>Edit <code xmlns=
                   4255:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4256:                   "filename">/etc/mk.conf</code>, see <a href=
                   4257:                   "#binary.mk.conf" title=
1.38      dillo    4258:                   "6.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.1,
1.1       grant    4259:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4260:                 </li>
                   4261: 
                   4262:                 <li>
1.45      wiz      4263:                   <p>Adjust <code xmlns=
                   4264:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4265:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4266:                   needs.</p>
                   4267:                 </li>
                   4268: 
                   4269:                 <li>
1.14      xtraeme  4270:                   <p>If you have set <code class=
1.45      wiz      4271:                   "varname">CVS_USER</code> in <code xmlns=
                   4272:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4273:                   "filename">build.conf</code>, make sure that
                   4274:                   account exists and can do a <span><strong class=
                   4275:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    4276:                   properly!</p>
                   4277:                 </li>
                   4278:               </ol>
                   4279:             </div>
                   4280: 
1.47      reed     4281:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4282:             build with the following steps:</p>
                   4283:             <pre class="screen">
1.14      xtraeme  4284: <code class="prompt">#</code> <strong class=
                   4285: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4286: <code class="prompt">#</code> <strong class=
                   4287: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4288: </pre>
                   4289: 
                   4290:             <p>This will just jump inside the sandbox and start
                   4291:             building. At the end of the build, mail will be sent
                   4292:             with the results of the build. Created binary pkgs will
1.45      wiz      4293:             be in <code xmlns=
                   4294:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4295:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4296:             (wherever that points/mounts to/from).</p>
                   4297:           </div>
                   4298: 
                   4299:           <div class="sect2" lang="en" xml:lang="en">
                   4300:             <div class="titlepage">
                   4301:               <div>
                   4302:                 <div>
1.30      wiz      4303:                   <h3 class="title"><a name=
                   4304:                   "building-a-partial-set" id=
1.38      dillo    4305:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4306:                   a partial set of packages</h3>
1.1       grant    4307:                 </div>
                   4308:               </div>
                   4309:             </div>
                   4310: 
                   4311:             <p>In addition to building a complete set of all
1.45      wiz      4312:             packages in pkgsrc, the <code xmlns=
                   4313:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4314:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4315:             used to build a subset of the packages contained in
1.47      reed     4316:             pkgsrc. By setting <code class=
1.45      wiz      4317:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4318:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4319:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4320: 
                   4321:             <div class="itemizedlist">
                   4322:               <ul type="disc">
                   4323:                 <li>
                   4324:                   <p>SITE_SPECIFIC_PKGS</p>
                   4325:                 </li>
                   4326: 
                   4327:                 <li>
                   4328:                   <p>HOST_SPECIFIC_PKGS</p>
                   4329:                 </li>
                   4330: 
                   4331:                 <li>
                   4332:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4333:                 </li>
                   4334: 
                   4335:                 <li>
                   4336:                   <p>USER_SPECIFIC_PKGS</p>
                   4337:                 </li>
                   4338:               </ul>
                   4339:             </div>
                   4340: 
                   4341:             <p>will define the set of packages which should be
                   4342:             built. The bulk build code will also include any
                   4343:             packages which are needed as dependencies for the
                   4344:             explicitly listed packages.</p>
                   4345: 
                   4346:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4347:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4348:             sandbox periodically to have a complete set of the
                   4349:             binary packages needed for your site available without
                   4350:             the overhead of building extra packages that are not
                   4351:             needed.</p>
                   4352:           </div>
1.13      hubertf  4353: 
                   4354:           <div class="sect2" lang="en" xml:lang="en">
                   4355:             <div class="titlepage">
                   4356:               <div>
                   4357:                 <div>
                   4358:                   <h3 class="title"><a name="bulk-upload" id=
1.38      dillo    4359:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4360:                   of a bulk build</h3>
                   4361:                 </div>
                   4362:               </div>
                   4363:             </div>
                   4364: 
                   4365:             <p>This section describes how pkgsrc developers can
                   4366:             upload binary pkgs built by bulk builds to
                   4367:             ftp.NetBSD.org.</p>
                   4368: 
1.17      sketch   4369:             <p>If you would like to automatically create checksum
                   4370:             files for the binary packages you intend to upload,
                   4371:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4372:             in your <code xmlns=
                   4373:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   4374:             "filename">mk/bulk/build.conf</code>.</p>
                   4375: 
                   4376:             <p>If you would like to PGP sign the checksum files
                   4377:             (highly recommended!), remember to set <code class=
                   4378:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      4379:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4380:             class="filename">mk/bulk/build.conf</code>. This will
                   4381:             prompt you for your GPG password to sign the files
1.17      sketch   4382:             before uploading everything.</p>
                   4383: 
                   4384:             <p>Then, make sure that you have <code class=
1.14      xtraeme  4385:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      4386:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4387:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   4388:             adjust it to something like one of the following:</p>
1.13      hubertf  4389:             <pre class="screen">
                   4390: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4391: </pre>
                   4392: 
1.47      reed     4393:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  4394:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  4395:             ftp.NetBSD.org is different from <code class=
                   4396:             "varname">CVS_USER</code>, write your login directly
                   4397:             into the variable, e.g. my local account is "feyrer",
                   4398:             but for my login "hubertf", I use:</p>
1.13      hubertf  4399:             <pre class="screen">
                   4400: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   4401: </pre>
                   4402: 
1.45      wiz      4403:             <p>A separate <code xmlns=
                   4404:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4405:             "filename">upload</code> directory is used here to
                   4406:             allow "closing" the directory during upload. To do so,
                   4407:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  4408:             <pre class="screen">
1.14      xtraeme  4409: nbftp% <strong class=
                   4410: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  4411: </pre>
                   4412: 
1.45      wiz      4413:             <p>Please note that <code xmlns=
                   4414:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4415:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  4416:             appropriate for packages for the NetBSD operating
                   4417:             system. Binary packages for other operating systems
1.45      wiz      4418:             should go into <code xmlns=
                   4419:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4420:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  4421: 
                   4422:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     4423:             needs to be set up. This example shows how to set up
1.13      hubertf  4424:             temporary keys for the root account <span class=
                   4425:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   4426:             that no keys should be present there usually):</p>
                   4427:             <pre class="screen">
1.14      xtraeme  4428: <code class="prompt">#</code> <strong class=
                   4429: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   4430: chroot-<code class="prompt">#</code> <strong class=
                   4431: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   4432: chroot-<code class="prompt">#</code> <strong class=
                   4433: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   4434: chroot-<code class="prompt">#</code> <strong class=
                   4435: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  4436: </pre>
                   4437: 
1.45      wiz      4438:             <p>Now take the output of <code xmlns=
                   4439:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4440:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      4441:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4442:             class="filename">~/.ssh/authorized_keys</code> file on
                   4443:             ftp.NetBSD.org. You can remove the key after the upload
                   4444:             is done!</p>
1.13      hubertf  4445: 
                   4446:             <p>Next, test if your ssh connection really works:</p>
                   4447:             <pre class="screen">
1.14      xtraeme  4448: chroot-<code class="prompt">#</code> <strong class=
                   4449: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  4450: </pre>
                   4451: 
                   4452:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   4453: 
                   4454:             <p>Now after all this works, you can exit the sandbox
                   4455:             and start the upload:</p>
                   4456:             <pre class="screen">
1.14      xtraeme  4457: chroot-<code class="prompt">#</code> <strong class=
                   4458: "userinput"><code>exit</code></strong>        
                   4459: <code class="prompt">#</code> <strong class=
                   4460: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   4461: <code class="prompt">#</code> <strong class=
                   4462: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  4463: </pre>
                   4464: 
                   4465:             <p>The upload process may take quite some time. Use
1.24      wiz      4466:             <a href=
                   4467:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   4468:             <span class="citerefentry"><span class=
                   4469:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   4470:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   4471:             <span class="citerefentry"><span class=
                   4472:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   4473:             server to monitor progress of the upload. The upload
                   4474:             script will take care of not uploading restricted
                   4475:             packages and putting vulnerable packages into the
1.45      wiz      4476:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4477:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  4478: 
                   4479:             <p>After the upload has ended, first thing is to revoke
                   4480:             ssh access:</p>
                   4481:             <pre class="screen">
1.14      xtraeme  4482: nbftp% <strong class=
                   4483: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  4484: Gdd:x! 
                   4485: </pre>
                   4486: 
                   4487:             <p>Use whatever is needed to remove the key you've
                   4488:             entered before! Last, move the uploaded packages out of
1.45      wiz      4489:             the <code xmlns=
                   4490:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4491:             "filename">upload</code> directory to have them
                   4492:             accessible to everyone:</p>
1.13      hubertf  4493:             <pre class="screen">
1.14      xtraeme  4494: nbftp% <strong class=
                   4495: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   4496: nbftp% <strong class=
                   4497: "userinput"><code>mv upload/* .</code></strong>
                   4498: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   4499: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  4500: </pre>
                   4501:           </div>
1.1       grant    4502:         </div>
                   4503: 
                   4504:         <div class="sect1" lang="en" xml:lang="en">
                   4505:           <div class="titlepage">
                   4506:             <div>
                   4507:               <div>
                   4508:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4509:                 "creating-cdroms" id=
1.38      dillo    4510:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      4511:                 CD-ROM packages collection</h2>
1.1       grant    4512:               </div>
                   4513:             </div>
                   4514:           </div>
                   4515: 
                   4516:           <p>After your pkgsrc bulk-build has completed, you may
                   4517:           wish to create a CD-ROM set of the resulting binary
                   4518:           packages to assist in installing packages on other
                   4519:           machines. The <a xmlns=
                   4520:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4521:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      4522:           target="_top"><code xmlns="" class=
                   4523:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      4524:           simple tool for creating the ISO 9660 images.
                   4525:           <span><strong class="command">cdpack</strong></span>
                   4526:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     4527:           all the dependencies for a given package on the same CD
                   4528:           as that package.</p>
1.1       grant    4529: 
                   4530:           <div class="sect2" lang="en" xml:lang="en">
                   4531:             <div class="titlepage">
                   4532:               <div>
                   4533:                 <div>
1.30      wiz      4534:                   <h3 class="title"><a name="cdpack-example" id=
1.38      dillo    4535:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    4536:                   cdpack</h3>
                   4537:                 </div>
                   4538:               </div>
                   4539:             </div>
                   4540: 
                   4541:             <p>Complete documentation for cdpack is found in the
1.47      reed     4542:             cdpack(1) man page. The following short example assumes
1.45      wiz      4543:             that the binary packages are left in <code xmlns=
                   4544:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4545:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      4546:             sufficient disk space exists in <code xmlns=
                   4547:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4548:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    4549:             <pre class="screen">
1.14      xtraeme  4550: <code class="prompt">#</code> <strong class=
                   4551: "userinput"><code>mkdir /u2/images</code></strong>
                   4552: <code class="prompt">#</code> <strong class=
                   4553: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   4554: <code class="prompt">#</code> <strong class=
                   4555: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4556: </pre>
                   4557: 
                   4558:             <p>If you wish to include a common set of files
1.45      wiz      4559:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4560:             class="filename">COPYRIGHT</code>, <code xmlns=
                   4561:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4562:             "filename">README</code>, etc.) on each CD in the
1.1       grant    4563:             collection, then you need to create a directory which
                   4564:             contains these files. e.g.</p>
                   4565:             <pre class="screen">
1.14      xtraeme  4566: <code class="prompt">#</code> <strong class=
                   4567: "userinput"><code>mkdir /tmp/common</code></strong>
                   4568: <code class="prompt">#</code> <strong class=
                   4569: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   4570: <code class="prompt">#</code> <strong class=
                   4571: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   4572: <code class="prompt">#</code> <strong class=
                   4573: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   4574: <code class="prompt">#</code> <strong class=
                   4575: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   4576: <code class="prompt">#</code> <strong class=
                   4577: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   4578: <code class="prompt">#</code> <strong class=
                   4579: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    4580: </pre>
                   4581: 
                   4582:             <p>Now create the images:</p>
                   4583:             <pre class="screen">
1.14      xtraeme  4584: <code class="prompt">#</code> <strong class=
                   4585: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    4586: </pre>
                   4587: 
1.45      wiz      4588:             <p>Each image will contain <code xmlns=
                   4589:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4590:             "filename">README</code>, <code xmlns=
                   4591:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4592:             "filename">COPYING</code>, and <code xmlns=
                   4593:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4594:             "filename">bin/myscript</code> in their root
1.1       grant    4595:             directories.</p>
                   4596:           </div>
                   4597:         </div>
                   4598:       </div>
                   4599: 
                   4600:       <div class="chapter" lang="en" xml:lang="en">
                   4601:         <div class="titlepage">
                   4602:           <div>
                   4603:             <div>
                   4604:               <h2 class="title"><a name="faq" id=
1.38      dillo    4605:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    4606:               Questions</h2>
                   4607:             </div>
                   4608:           </div>
                   4609:         </div>
                   4610: 
                   4611:         <div class="toc">
                   4612:           <p><b>Table of Contents</b></p>
                   4613: 
                   4614:           <dl>
1.30      wiz      4615:             <dt><span class="sect1"><a href=
1.38      dillo    4616:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      4617:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    4618: 
1.38      dillo    4619:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    4620:             Where's the pkgviews documentation?</a></span></dt>
                   4621: 
1.38      dillo    4622:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    4623:             Utilities for package management
                   4624:             (pkgtools)</a></span></dt>
                   4625: 
1.38      dillo    4626:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      4627:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    4628: 
1.30      wiz      4629:             <dt><span class="sect1"><a href=
1.38      dillo    4630:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      4631:             fetching distfiles?</a></span></dt>
1.14      xtraeme  4632: 
1.30      wiz      4633:             <dt><span class="sect1"><a href=
1.38      dillo    4634:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      4635:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    4636: 
1.30      wiz      4637:             <dt><span class="sect1"><a href=
1.38      dillo    4638:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      4639:             from pkgsrc?</a></span></dt>
1.1       grant    4640: 
1.30      wiz      4641:             <dt><span class="sect1"><a href=
1.38      dillo    4642:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      4643:             behind a firewall</a></span></dt>
1.1       grant    4644: 
1.38      dillo    4645:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  4646:             do I tell <span><strong class="command">make
                   4647:             fetch</strong></span> to do passive
                   4648:             FTP?</a></span></dt>
1.1       grant    4649: 
1.30      wiz      4650:             <dt><span class="sect1"><a href=
1.38      dillo    4651:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      4652:             distfiles at once</a></span></dt>
1.1       grant    4653: 
1.30      wiz      4654:             <dt><span class="sect1"><a href=
1.38      dillo    4655:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      4656:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  4657:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    4658:             mean?</a></span></dt>
                   4659: 
1.30      wiz      4660:             <dt><span class="sect1"><a href=
1.38      dillo    4661:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      4662:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4663:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4664: 
1.30      wiz      4665:             <dt><span class="sect1"><a href=
1.38      dillo    4666:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      4667:             pkgsrc</a></span></dt>
1.1       grant    4668: 
1.38      dillo    4669:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     4670:             do I change the location of configuration
                   4671:             files?</a></span></dt>
1.1       grant    4672: 
1.38      dillo    4673:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    4674:             Automated security checks</a></span></dt>
                   4675:           </dl>
                   4676:         </div>
                   4677: 
                   4678:         <p>This section contains hints, tips &amp; tricks on
                   4679:         special things in pkgsrc that we didn't find a better place
                   4680:         for in the previous chapters, and it contains items for
                   4681:         both pkgsrc users and developers.</p>
                   4682: 
                   4683:         <div class="sect1" lang="en" xml:lang="en">
                   4684:           <div class="titlepage">
                   4685:             <div>
                   4686:               <div>
                   4687:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4688:                 "mailing-list-pointers" id=
1.38      dillo    4689:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      4690:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    4691:               </div>
                   4692:             </div>
                   4693:           </div>
                   4694: 
1.18      xtraeme  4695:           <p>The following mailing lists may be of interest to
                   4696:           pkgsrc users:</p>
                   4697: 
                   4698:           <div class="itemizedlist">
                   4699:             <ul type="disc">
                   4700:               <li>
                   4701:                 <p><a href=
                   4702:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.34      wiz      4703:                 target="_top">pkgsrc-bugs</a>: A list where problem
                   4704:                 reports related to pkgsrc are sent and
                   4705:                 discussed.</p>
1.18      xtraeme  4706:               </li>
                   4707: 
                   4708:               <li>
                   4709:                 <p><a href=
                   4710:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      4711:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      4712:                 results of pkgsrc bulk builds are sent and
1.34      wiz      4713:                 discussed.</p>
1.18      xtraeme  4714:               </li>
                   4715: 
                   4716:               <li>
                   4717:                 <p><a href=
                   4718:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.34      wiz      4719:                 target="_top">pkgsrc-changes</a>: A list where all
                   4720:                 commit messages to pkgsrc are sent.</p>
1.18      xtraeme  4721:               </li>
                   4722: 
                   4723:               <li>
                   4724:                 <p><a href=
                   4725:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.34      wiz      4726:                 target="_top">tech-pkg</a>: A general discussion
                   4727:                 list for all things related to pkgsrc.</p>
1.18      xtraeme  4728:               </li>
                   4729:             </ul>
                   4730:           </div>
                   4731: 
                   4732:           <p>To subscribe, do:</p>
1.1       grant    4733:           <pre class="programlisting">
1.18      xtraeme  4734: <code class="prompt">%</code> echo subscribe <em class=
                   4735: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    4736: </pre>
                   4737: 
1.18      xtraeme  4738:           <p>Archives for all these mailing lists are available
                   4739:           from <a href="http://mail-index.NetBSD.org/" target=
                   4740:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    4741:         </div>
                   4742: 
                   4743:         <div class="sect1" lang="en" xml:lang="en">
                   4744:           <div class="titlepage">
                   4745:             <div>
                   4746:               <div>
                   4747:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      4748:                 "pkgviews-docs" id=
1.38      dillo    4749:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      4750:                 documentation?</h2>
1.1       grant    4751:               </div>
                   4752:             </div>
                   4753:           </div>
                   4754: 
                   4755:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      4756:           find a pkgviews User's guide in <code xmlns=
                   4757:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4758:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    4759:         </div>
                   4760: 
                   4761:         <div class="sect1" lang="en" xml:lang="en">
                   4762:           <div class="titlepage">
                   4763:             <div>
                   4764:               <div>
                   4765:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  4766:                 "faq-pkgtools" id=
1.38      dillo    4767:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  4768:                 management (pkgtools)</h2>
1.1       grant    4769:               </div>
                   4770:             </div>
                   4771:           </div>
                   4772: 
1.45      wiz      4773:           <p>The <code xmlns=
                   4774:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   4775:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   4776:           contains a number of useful utilities for both users and
                   4777:           developers of pkgsrc. This section attempts only to make
                   4778:           the reader aware of the utilities and when they might be
                   4779:           useful, and not to duplicate the documentation that comes
                   4780:           with each package.</p>
1.1       grant    4781: 
                   4782:           <p>Utilities used by pkgsrc (automatically installed when
                   4783:           needed):</p>
                   4784: 
                   4785:           <div class="itemizedlist">
                   4786:             <ul type="disc">
                   4787:               <li>
                   4788:                 <p><a xmlns=
                   4789:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4790:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      4791:                 target="_top"><code xmlns="" class=
                   4792:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      4793:                 for use by buildlink.</p>
1.1       grant    4794:               </li>
                   4795:             </ul>
                   4796:           </div>
                   4797: 
                   4798:           <p>OS tool augmentation (automatically installed when
                   4799:           needed):</p>
                   4800: 
                   4801:           <div class="itemizedlist">
                   4802:             <ul type="disc">
                   4803:               <li>
                   4804:                 <p><a xmlns=
                   4805:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4806:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      4807:                 target="_top"><code xmlns="" class=
                   4808:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      4809:                 various kinds of checksums (including SHA1).</p>
1.1       grant    4810:               </li>
                   4811: 
                   4812:               <li>
                   4813:                 <p><a xmlns=
                   4814:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4815:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      4816:                 target="_top"><code xmlns="" class=
                   4817:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      4818:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    4819:               </li>
                   4820: 
                   4821:               <li>
                   4822:                 <p><a xmlns=
                   4823:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4824:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      4825:                 target="_top"><code xmlns="" class=
                   4826:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      4827:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    4828:               </li>
                   4829: 
                   4830:               <li>
                   4831:                 <p><a xmlns=
                   4832:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4833:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      4834:                 target="_top"><code xmlns="" class=
                   4835:                 "filename">pkgtools/pkg_install</code></a>:
                   4836:                 Up-to-date replacement for <code xmlns=
                   4837:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      4838:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   4839:                 on operating systems where pkg_install is not
                   4840:                 present.</p>
1.1       grant    4841:               </li>
                   4842:             </ul>
                   4843:           </div>
                   4844: 
                   4845:           <p>Utilities used by pkgsrc (not automatically
                   4846:           installed):</p>
                   4847: 
                   4848:           <div class="itemizedlist">
                   4849:             <ul type="disc">
                   4850:               <li>
                   4851:                 <p><a xmlns=
                   4852:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4853:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      4854:                 target="_top"><code xmlns="" class=
                   4855:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      4856:                 binary package from an already-installed package.
1.34      wiz      4857:                 Used by <span><strong class="command">make
                   4858:                 replace</strong></span> to save the old
                   4859:                 package.</p>
1.1       grant    4860:               </li>
                   4861: 
                   4862:               <li>
                   4863:                 <p><a xmlns=
                   4864:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4865:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      4866:                 target="_top"><code xmlns="" class=
                   4867:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      4868:                 functionality to pkgsrc, allowing it to fetch
                   4869:                 distfiles from multiple locations. It currently
                   4870:                 supports the following methods: multiple CD-ROMs
                   4871:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4872:               </li>
                   4873: 
                   4874:               <li>
                   4875:                 <p><a xmlns=
                   4876:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4877:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      4878:                 target="_top"><code xmlns="" class=
                   4879:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      4880:                 packages someplace else (enabled by default).</p>
1.1       grant    4881:               </li>
1.5       hubertf  4882: 
                   4883:               <li>
                   4884:                 <p><a xmlns=
                   4885:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4886:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      4887:                 target="_top"><code xmlns="" class=
                   4888:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      4889:                 best compiler flags to optimise code for your
1.20      ben      4890:                 current CPU and compiler.</p>
1.5       hubertf  4891:               </li>
1.1       grant    4892:             </ul>
                   4893:           </div>
                   4894: 
                   4895:           <p>Utilities for keeping track of installed packages,
                   4896:           being up to date, etc:</p>
                   4897: 
                   4898:           <div class="itemizedlist">
                   4899:             <ul type="disc">
                   4900:               <li>
                   4901:                 <p><a xmlns=
                   4902:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4903:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      4904:                 target="_top"><code xmlns="" class=
                   4905:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   4906:                 packages whose installed versions do not match the
1.34      wiz      4907:                 latest pkgsrc entries.</p>
1.1       grant    4908:               </li>
                   4909: 
                   4910:               <li>
                   4911:                 <p><a xmlns=
                   4912:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4913:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      4914:                 target="_top"><code xmlns="" class=
                   4915:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      4916:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      4917:                 strategy for updating.</p>
1.1       grant    4918:               </li>
                   4919: 
                   4920:               <li>
                   4921:                 <p><a xmlns=
                   4922:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4923:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      4924:                 target="_top"><code xmlns="" class=
                   4925:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   4926:                 graphs from the output of <a xmlns=
                   4927:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4928:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      4929:                 target="_top"><code xmlns="" class=
                   4930:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      4931:                 graphviz).</p>
1.1       grant    4932:               </li>
                   4933: 
                   4934:               <li>
                   4935:                 <p><a xmlns=
                   4936:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4937:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      4938:                 target="_top"><code xmlns="" class=
                   4939:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   4940:                 pkglint(1) program checks a pkgsrc entry for
                   4941:                 errors, lintpkgsrc(1) does various checks on the
                   4942:                 complete pkgsrc system.</p>
1.1       grant    4943:               </li>
                   4944: 
                   4945:               <li>
                   4946:                 <p><a xmlns=
                   4947:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4948:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      4949:                 target="_top"><code xmlns="" class=
                   4950:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   4951:                 what packages you have installed.</p>
1.1       grant    4952:               </li>
                   4953:             </ul>
                   4954:           </div>
                   4955: 
                   4956:           <p>Utilities for people maintaining or creating
                   4957:           individual packages:</p>
                   4958: 
                   4959:           <div class="itemizedlist">
                   4960:             <ul type="disc">
                   4961:               <li>
                   4962:                 <p><a xmlns=
                   4963:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4964:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      4965:                 target="_top"><code xmlns="" class=
                   4966:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      4967:                 making and maintaining patches for a package
1.34      wiz      4968:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    4969:               </li>
                   4970: 
                   4971:               <li>
                   4972:                 <p><a xmlns=
                   4973:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4974:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      4975:                 target="_top"><code xmlns="" class=
                   4976:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      4977:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4978:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      4979:                 target="_top"><code xmlns="" class=
                   4980:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      4981:                 converting to pkgsrc.</p>
1.1       grant    4982:               </li>
                   4983: 
                   4984:               <li>
                   4985:                 <p><a xmlns=
                   4986:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4987:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      4988:                 target="_top"><code xmlns="" class=
                   4989:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      4990:                 pkgsrc to a Solaris package.</p>
1.1       grant    4991:               </li>
                   4992:             </ul>
                   4993:           </div>
                   4994: 
1.47      reed     4995:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    4996:           obscure pkg utilities)</p>
                   4997: 
                   4998:           <div class="itemizedlist">
                   4999:             <ul type="disc">
                   5000:               <li>
                   5001:                 <p><a xmlns=
                   5002:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5003:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5004:                 target="_top"><code xmlns="" class=
                   5005:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5006:                 packages in a chrooted area.</p>
1.1       grant    5007:               </li>
                   5008: 
                   5009:               <li>
                   5010:                 <p><a xmlns=
                   5011:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5012:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5013:                 target="_top"><code xmlns="" class=
                   5014:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5015:                 kernel version for chrooted cross builds.</p>
1.1       grant    5016:               </li>
                   5017:             </ul>
                   5018:           </div>
                   5019:         </div>
                   5020: 
                   5021:         <div class="sect1" lang="en" xml:lang="en">
                   5022:           <div class="titlepage">
                   5023:             <div>
                   5024:               <div>
                   5025:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5026:                 "non-root-pkgsrc" id=
1.38      dillo    5027:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5028:                 as non-root</h2>
1.1       grant    5029:               </div>
                   5030:             </div>
                   5031:           </div>
                   5032: 
                   5033:           <p>If you want to use pkgsrc as non-root user, you can
                   5034:           set some variables to make pkgsrc work under these
1.33      jmmv     5035:           conditions. At the very least, you need to set
                   5036:           <code class="varname">UNPRIVILEGED</code> to
                   5037:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5038:           turn on unprivileged mode and set multiple related
                   5039:           variables to allow installation of packages as
                   5040:           non-root.</p>
                   5041: 
                   5042:           <p>In case the defaults are not enough, you may want to
                   5043:           tune some other variables used. For example, if the
                   5044:           automatic user/group detection leads to incorrect values
                   5045:           (or not the ones you would like to use), you can change
                   5046:           them by setting <code class=
                   5047:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5048:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5049: 
                   5050:           <p>As regards bootstrapping, please note that the
                   5051:           <span><strong class="command">bootstrap</strong></span>
                   5052:           script will ease non-root configuration when given the
                   5053:           &#8220;<span class=
                   5054:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5055:           will choose and use multiple default directories under
1.45      wiz      5056:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5057:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5058:           targets. These directories can be overriden by the
                   5059:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5060:           provided by the script, as well as some others that allow
                   5061:           finer tuning of the tree layout.</p>
1.14      xtraeme  5062:         </div>
                   5063: 
                   5064:         <div class="sect1" lang="en" xml:lang="en">
                   5065:           <div class="titlepage">
                   5066:             <div>
                   5067:               <div>
                   5068:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5069:                 "resume-transfers" id=
1.38      dillo    5070:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5071:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5072:               </div>
                   5073:             </div>
                   5074:           </div>
                   5075: 
1.47      reed     5076:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5077:           but you can enable this feature by adding the option
                   5078:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5079:           into <code xmlns=
                   5080:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5081:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5082:           an incomplete distfile is found, pkgsrc will try to
                   5083:           resume it.</p>
1.15      xtraeme  5084: 
                   5085:           <p>You can also use a different program than the default
1.24      wiz      5086:           <a href=
                   5087:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5088:           <span class="citerefentry"><span class=
                   5089:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5090:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5091:           forget to set <code class=
                   5092:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5093:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5094:           default values.</p>
1.14      xtraeme  5095: 
1.45      wiz      5096:           <p>For example, if you want to use <code xmlns=
                   5097:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5098:           "filename">wget</code> to resume downloads, you'll have
                   5099:           to use something like:</p>
                   5100:           <pre class="programlisting">
1.34      wiz      5101: FETCH_CMD=wget
                   5102: FETCH_BEFORE_ARGS=--passive-ftp
                   5103: FETCH_RESUME_ARGS=-c
                   5104: FETCH_OUTPUT_ARGS=-O
1.14      xtraeme  5105: </pre>
1.1       grant    5106:         </div>
                   5107: 
                   5108:         <div class="sect1" lang="en" xml:lang="en">
                   5109:           <div class="titlepage">
                   5110:             <div>
                   5111:               <div>
                   5112:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5113:                 "XFree86-from-pkgsrc" id=
1.38      dillo    5114:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5115:                 install/use XFree86 from pkgsrc?</h2>
                   5116:               </div>
                   5117:             </div>
                   5118:           </div>
                   5119: 
                   5120:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5121:           system's own X11 (<code xmlns=
                   5122:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5123:           "filename">/usr/X11R6</code>, <code xmlns=
                   5124:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5125:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5126:           add the following line into <code xmlns=
                   5127:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5128:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5129:           <pre class="programlisting">
1.34      wiz      5130: X11_TYPE=XFree86
1.1       grant    5131: </pre>
                   5132:         </div>
                   5133: 
                   5134:         <div class="sect1" lang="en" xml:lang="en">
                   5135:           <div class="titlepage">
                   5136:             <div>
                   5137:               <div>
                   5138:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5139:                 "x.org-from-pkgsrc" id=
1.38      dillo    5140:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5141:                 install/use X.org from pkgsrc?</h2>
                   5142:               </div>
                   5143:             </div>
                   5144:           </div>
                   5145: 
                   5146:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5147:           system's own X11 (<code xmlns=
                   5148:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5149:           "filename">/usr/X11R6</code>, <code xmlns=
                   5150:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5151:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5152:           the following line into <code xmlns=
                   5153:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5154:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5155:           <pre class="programlisting">
1.34      wiz      5156: X11_TYPE=xorg
1.1       grant    5157: </pre>
                   5158:         </div>
                   5159: 
                   5160:         <div class="sect1" lang="en" xml:lang="en">
                   5161:           <div class="titlepage">
                   5162:             <div>
                   5163:               <div>
                   5164:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5165:                 "fetch-behind-firewall" id=
1.38      dillo    5166:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5167:                 files from behind a firewall</h2>
1.1       grant    5168:               </div>
                   5169:             </div>
                   5170:           </div>
                   5171: 
                   5172:           <p>If you are sitting behind a firewall which does not
                   5173:           allow direct connections to Internet hosts (i.e.
                   5174:           non-NAT), you may specify the relevant proxy hosts. This
                   5175:           is done using an environment variable in the form of a
1.47      reed     5176:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5177:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5178:           firewalls, and it uses port 80 as the proxy port number.
                   5179:           So the proxy environment variables are:</p>
                   5180:           <pre class="programlisting">
1.34      wiz      5181: ftp_proxy=ftp://orpheus.amdahl.com:80/
1.1       grant    5182: http_proxy=http://orpheus.amdahl.com:80/
                   5183: </pre>
                   5184:         </div>
                   5185: 
                   5186:         <div class="sect1" lang="en" xml:lang="en">
                   5187:           <div class="titlepage">
                   5188:             <div>
                   5189:               <div>
                   5190:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5191:                 "passive-ftp" id="passive-ftp"></a>7.9.&nbsp;How do
1.30      wiz      5192:                 I tell <span><strong class="command">make
1.14      xtraeme  5193:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5194:               </div>
                   5195:             </div>
                   5196:           </div>
                   5197: 
                   5198:           <p>This depends on which utility is used to retrieve
1.45      wiz      5199:           distfiles. From <code xmlns=
                   5200:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5201:           "filename">bsd.pkg.mk</code>, <code class=
                   5202:           "varname">FETCH_CMD</code> is assigned the first
                   5203:           available command from the following list:</p>
1.34      wiz      5204: 
                   5205:           <div class="itemizedlist">
                   5206:             <ul type="disc">
                   5207:               <li>
1.45      wiz      5208:                 <p><code xmlns=
                   5209:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5210:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5211:               </li>
                   5212: 
                   5213:               <li>
1.45      wiz      5214:                 <p><code xmlns=
                   5215:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5216:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5217:               </li>
                   5218:             </ul>
                   5219:           </div>
1.1       grant    5220: 
                   5221:           <p>On a default NetBSD installation, this will be
1.45      wiz      5222:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5223:           class="filename">/usr/bin/ftp</code>, which automatically
                   5224:           tries passive connections first, and falls back to active
                   5225:           connections if the server refuses to do passive. For the
                   5226:           other tools, add the following to your <code xmlns=
                   5227:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5228:           "filename">/etc/mk.conf</code> file: <code class=
                   5229:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5230: 
1.45      wiz      5231:           <p>Having that option present will prevent <code xmlns=
                   5232:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5233:           "filename">/usr/bin/ftp</code> from falling back to
                   5234:           active transfers.</p>
1.1       grant    5235:         </div>
                   5236: 
                   5237:         <div class="sect1" lang="en" xml:lang="en">
                   5238:           <div class="titlepage">
                   5239:             <div>
                   5240:               <div>
                   5241:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5242:                 "fetching-all-distfiles" id=
1.38      dillo    5243:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5244:                 fetch all distfiles at once</h2>
                   5245:               </div>
                   5246:             </div>
                   5247:           </div>
                   5248: 
                   5249:           <p>You would like to download all the distfiles in a
                   5250:           single batch from work or university, where you can't run
1.14      xtraeme  5251:           a <span><strong class="command">make
                   5252:           fetch</strong></span>. There is an archive of distfiles
                   5253:           on <a href=
1.1       grant    5254:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5255:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5256:           entire directory may not be appropriate.</p>
                   5257: 
1.14      xtraeme  5258:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5259:           "command">make fetch-list</strong></span> in <code xmlns=
                   5260:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5261:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5262:           subdirectories, carry the resulting list to your machine
1.23      wiz      5263:           at work/school and use it there. If you don't have a
1.24      wiz      5264:           NetBSD-compatible <a href=
                   5265:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5266:           <span class="citerefentry"><span class=
                   5267:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5268:           at work, don't forget to set <code class=
                   5269:           "varname">FETCH_CMD</code> to something that fetches a
                   5270:           URL:</p>
1.1       grant    5271: 
                   5272:           <p>At home:</p>
                   5273:           <pre class="screen">
1.14      xtraeme  5274: <code class="prompt">%</code> <strong class=
                   5275: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5276: <code class="prompt">%</code> <strong class=
                   5277: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5278: <code class="prompt">%</code> <strong class=
                   5279: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5280: </pre>
                   5281: 
                   5282:           <p>At work:</p>
                   5283:           <pre class="screen">
1.14      xtraeme  5284: <code class="prompt">%</code> <strong class=
                   5285: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5286: </pre>
                   5287: 
1.45      wiz      5288:           <p>then tar up <code xmlns=
                   5289:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5290:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5291: 
                   5292:           <p>If you have a machine running NetBSD, and you want to
                   5293:           get <span class="emphasis"><em>all</em></span> distfiles
                   5294:           (even ones that aren't for your machine architecture),
                   5295:           you can do so by using the above-mentioned
1.14      xtraeme  5296:           <span><strong class="command">make
                   5297:           fetch-list</strong></span> approach, or fetch the
                   5298:           distfiles directly by running:</p>
1.1       grant    5299:           <pre class="screen">
1.14      xtraeme  5300: <code class="prompt">%</code> <strong class=
                   5301: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5302: </pre>
                   5303: 
1.14      xtraeme  5304:           <p>If you even decide to ignore <code class=
                   5305:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5306:           can get everything by running:</p>
1.1       grant    5307:           <pre class="screen">
1.14      xtraeme  5308: <code class="prompt">%</code> <strong class=
                   5309: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5310: </pre>
                   5311:         </div>
                   5312: 
                   5313:         <div class="sect1" lang="en" xml:lang="en">
                   5314:           <div class="titlepage">
                   5315:             <div>
                   5316:               <div>
                   5317:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5318:                 "tmac.andoc-missing" id=
1.38      dillo    5319:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5320:                 &#8220;<span class="quote">Don't know how to make
                   5321:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5322:               </div>
                   5323:             </div>
                   5324:           </div>
                   5325: 
                   5326:           <p>When compiling the <a xmlns=
                   5327:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5328:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5329:           target="_top"><code xmlns="" class=
                   5330:           "filename">pkgtools/pkg_install</code></a> package, you
                   5331:           get the error from make that it doesn't know how to make
                   5332:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5333:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5334:           indicates that you don't have installed the
1.23      wiz      5335:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5336:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5337:           It is recommended to do that to format man pages.</p>
1.1       grant    5338: 
                   5339:           <p>In the case of the <a xmlns=
                   5340:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5341:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5342:           target="_top"><code xmlns="" class=
                   5343:           "filename">pkgtools/pkg_install</code></a> package, you
                   5344:           can get away with setting <code class=
1.20      ben      5345:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      5346:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5347:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    5348:         </div>
                   5349: 
                   5350:         <div class="sect1" lang="en" xml:lang="en">
                   5351:           <div class="titlepage">
                   5352:             <div>
                   5353:               <div>
                   5354:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5355:                 "bsd.own.mk-missing" id=
1.38      dillo    5356:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    5357:                 &#8220;<span class="quote">Could not find
                   5358:                 bsd.own.mk</span>&#8221; mean?</h2>
                   5359:               </div>
                   5360:             </div>
                   5361:           </div>
                   5362: 
1.45      wiz      5363:           <p>You didn't install the compiler set, <code xmlns=
                   5364:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5365:           "filename">comp.tgz</code>, when you installed your
1.47      reed     5366:           NetBSD machine. Please get and install it, by extracting
                   5367:           it in <code xmlns=
1.45      wiz      5368:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5369:           "filename">/</code>:</p>
1.1       grant    5370:           <pre class="screen">
1.14      xtraeme  5371: <code class="prompt">#</code> <strong class=
                   5372: "userinput"><code>cd /</code></strong>
                   5373: <code class="prompt">#</code> <strong class=
                   5374: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    5375: </pre>
                   5376: 
1.45      wiz      5377:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5378:           class="filename">comp.tgz</code> is part of every NetBSD
                   5379:           release. Get the one that corresponds to your release
                   5380:           (determine via <span><strong class="command">uname
                   5381:           -r</strong></span>).</p>
1.1       grant    5382:         </div>
                   5383: 
                   5384:         <div class="sect1" lang="en" xml:lang="en">
                   5385:           <div class="titlepage">
                   5386:             <div>
                   5387:               <div>
                   5388:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      5389:                 "using-sudo-with-pkgsrc" id=
1.38      dillo    5390:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    5391:                 'sudo' with pkgsrc</h2>
                   5392:               </div>
                   5393:             </div>
                   5394:           </div>
                   5395: 
                   5396:           <p>When installing packages as non-root user and using
1.24      wiz      5397:           the just-in-time <a href=
                   5398:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   5399:           <span class="citerefentry"><span class=
                   5400:           "refentrytitle">su</span>(1)</span></a> feature of
                   5401:           pkgsrc, it can become annoying to type in the root
                   5402:           password for each required package installed. To avoid
                   5403:           this, the sudo package can be used, which does password
                   5404:           caching over a limited time. To use it, install sudo
                   5405:           (either as binary package or from <a xmlns=
                   5406:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5407:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      5408:           target="_top"><code xmlns="" class=
                   5409:           "filename">security/sudo</code></a>) and then put the
                   5410:           following into your <code xmlns=
                   5411:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      5412:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5413:           <pre class="programlisting">
1.34      wiz      5414: .if exists(${LOCALBASE}/bin/sudo)
                   5415: SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
                   5416: .endif
1.1       grant    5417: </pre>
                   5418:         </div>
                   5419: 
                   5420:         <div class="sect1" lang="en" xml:lang="en">
                   5421:           <div class="titlepage">
                   5422:             <div>
                   5423:               <div>
                   5424:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5425:                 "faq.conf" id="faq.conf"></a>7.14.&nbsp;How do I
1.35      jmmv     5426:                 change the location of configuration files?</h2>
1.1       grant    5427:               </div>
                   5428:             </div>
                   5429:           </div>
                   5430: 
1.35      jmmv     5431:           <p>As the system administrator, you can choose where
                   5432:           configuration files are installed. The default settings
1.45      wiz      5433:           make all these files go into <code xmlns=
                   5434:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     5435:           "filename">${PREFIX}/etc</code> or some of its
                   5436:           subdirectories; this may be suboptimal depending on your
                   5437:           expectations (e.g., a read-only, NFS-exported
                   5438:           <code class="varname">PREFIX</code> with a need of
                   5439:           per-machine configuration of the provided packages).</p>
                   5440: 
                   5441:           <p>In order to change the defaults, you can modify the
                   5442:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      5443:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5444:           class="filename">/etc/mk.conf</code>) to point to your
                   5445:           preferred configuration directory; some common examples
                   5446:           include <code xmlns=
                   5447:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5448:           "filename">/etc</code> or <code xmlns=
                   5449:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5450:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     5451: 
                   5452:           <p>Furthermore, you can change this value on a
                   5453:           per-package basis by setting the <code class=
                   5454:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   5455:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   5456:           value usually matches the name of the package you would
                   5457:           like to modify, that is, the contents of <code class=
                   5458:           "varname">PKGBASE</code>.</p>
1.1       grant    5459: 
1.47      reed     5460:           <p>Note that after changing these settings, you must
1.35      jmmv     5461:           rebuild and reinstall any affected packages.</p>
1.1       grant    5462:         </div>
                   5463: 
                   5464:         <div class="sect1" lang="en" xml:lang="en">
                   5465:           <div class="titlepage">
                   5466:             <div>
                   5467:               <div>
                   5468:                 <h2 class="title" style="clear: both"><a name=
                   5469:                 "audit-packages" id=
1.38      dillo    5470:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    5471:                 checks</h2>
                   5472:               </div>
                   5473:             </div>
                   5474:           </div>
                   5475: 
                   5476:           <p>Please be aware that there can often be bugs in
                   5477:           third-party software, and some of these bugs can leave a
                   5478:           machine vulnerable to exploitation by attackers. In an
                   5479:           effort to lessen the exposure, the NetBSD packages team
                   5480:           maintains a database of known-exploits to packages which
                   5481:           have at one time been included in pkgsrc. The database
                   5482:           can be downloaded automatically, and a security audit of
                   5483:           all packages installed on a system can take place. To do
                   5484:           this, install the <a xmlns=
                   5485:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5486:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5487:           target="_top"><code xmlns="" class=
                   5488:           "filename">security/audit-packages</code></a> package. It
1.20      ben      5489:           has two components:</p>
1.1       grant    5490: 
                   5491:           <div class="orderedlist">
                   5492:             <ol type="1">
                   5493:               <li>
1.34      wiz      5494:                 <p><span><strong class=
                   5495:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    5496:                 an easy way to download a list of the security
                   5497:                 vulnerabilities information. This list is kept up
                   5498:                 to date by the NetBSD security officer and the
                   5499:                 NetBSD packages team, and is distributed from the
                   5500:                 NetBSD ftp server:</p>
                   5501: 
                   5502:                 <p><a href=
                   5503:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      5504:                 target=
                   5505:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    5506:               </li>
                   5507: 
                   5508:               <li>
1.34      wiz      5509:                 <p><span><strong class=
                   5510:                 "command">audit-packages</strong></span>, an easy
                   5511:                 way to audit the current machine, checking each
1.1       grant    5512:                 vulnerability which is known. If a vulnerable
                   5513:                 package is installed, it will be shown by output to
                   5514:                 stdout, including a description of the type of
                   5515:                 vulnerability, and a URL containing more
                   5516:                 information.</p>
                   5517:               </li>
                   5518:             </ol>
                   5519:           </div>
                   5520: 
1.23      wiz      5521:           <p>Use of the <a xmlns=
                   5522:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5523:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      5524:           target="_top"><code xmlns="" class=
                   5525:           "filename">security/audit-packages</code></a> package is
1.23      wiz      5526:           strongly recommended! After &#8220;<span class=
                   5527:           "quote">audit-packages</span>&#8221; is installed, please
                   5528:           read the package's message, which you can get by running
                   5529:           <strong class="userinput"><code>pkg_info -D
                   5530:           audit-package</code></strong>.</p>
1.1       grant    5531:         </div>
                   5532:       </div>
                   5533:     </div>
                   5534: 
                   5535:     <div class="part" lang="en" xml:lang="en">
                   5536:       <div class="titlepage">
                   5537:         <div>
                   5538:           <div>
                   5539:             <h1 class="title"><a name="developers-guide" id=
1.48      dillo    5540:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   5541:             developer's guide</h1>
1.1       grant    5542:           </div>
                   5543:         </div>
                   5544:       </div>
                   5545: 
                   5546:       <div class="toc">
                   5547:         <p><b>Table of Contents</b></p>
                   5548: 
                   5549:         <dl>
1.38      dillo    5550:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   5551:           Package components - files, directories and
                   5552:           contents</a></span></dt>
                   5553: 
                   5554:           <dd>
                   5555:             <dl>
                   5556:               <dt><span class="sect1"><a href=
1.45      wiz      5557:               "#components.Makefile">8.1. <code xmlns=
                   5558:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5559:               "filename">Makefile</code></a></span></dt>
                   5560: 
                   5561:               <dt><span class="sect1"><a href=
1.45      wiz      5562:               "#components.distinfo">8.2. <code xmlns=
                   5563:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   5564:               "filename">distinfo</code></a></span></dt>
                   5565: 
                   5566:               <dt><span class="sect1"><a href=
1.38      dillo    5567:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   5568: 
1.30      wiz      5569:               <dt><span class="sect1"><a href=
1.38      dillo    5570:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      5571:               files</a></span></dt>
1.27      rillig   5572: 
                   5573:               <dt><span class="sect1"><a href=
1.38      dillo    5574:               "#components.optional">8.5. Optional
1.27      rillig   5575:               files</a></span></dt>
                   5576: 
1.38      dillo    5577:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      5578:               <code xmlns=
                   5579:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5580:               "filename">work*</code></a></span></dt>
1.27      rillig   5581: 
1.38      dillo    5582:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      5583:               <code xmlns=
                   5584:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5585:               "filename">files/*</code></a></span></dt>
1.27      rillig   5586:             </dl>
                   5587:           </dd>
                   5588: 
1.38      dillo    5589:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      5590:           Programming in <code xmlns=
                   5591:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5592:           "filename">Makefile</code>s</a></span></dt>
                   5593: 
                   5594:           <dd>
                   5595:             <dl>
                   5596:               <dt><span class="sect1"><a href=
1.45      wiz      5597:               "#makefile.variables">9.1. <code xmlns=
                   5598:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   5599:               "filename">Makefile</code> variables</a></span></dt>
                   5600: 
1.27      rillig   5601:               <dd>
                   5602:                 <dl>
                   5603:                   <dt><span class="sect2"><a href=
1.38      dillo    5604:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   5605:                   conventions</a></span></dt>
                   5606:                 </dl>
                   5607:               </dd>
                   5608: 
1.38      dillo    5609:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   5610:               Code snippets</a></span></dt>
                   5611: 
                   5612:               <dd>
                   5613:                 <dl>
                   5614:                   <dt><span class="sect2"><a href=
1.38      dillo    5615:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   5616:                   list</a></span></dt>
                   5617: 
                   5618:                   <dt><span class="sect2"><a href=
1.38      dillo    5619:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      5620:                   Converting an internal list into an external
                   5621:                   list</a></span></dt>
1.25      rillig   5622: 
                   5623:                   <dt><span class="sect2"><a href=
1.38      dillo    5624:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      5625:                   variables to a shell command</a></span></dt>
1.27      rillig   5626: 
                   5627:                   <dt><span class="sect2"><a href=
1.38      dillo    5628:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   5629:                   guideline</a></span></dt>
                   5630: 
                   5631:                   <dt><span class="sect2"><a href=
1.38      dillo    5632:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      5633:                   a bug in BSD Make</a></span></dt>
1.25      rillig   5634:                 </dl>
                   5635:               </dd>
                   5636:             </dl>
                   5637:           </dd>
                   5638: 
1.38      dillo    5639:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    5640:           issues</a></span></dt>
                   5641: 
                   5642:           <dd>
                   5643:             <dl>
1.38      dillo    5644:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    5645:               ID</a></span></dt>
                   5646: 
1.30      wiz      5647:               <dt><span class="sect1"><a href=
1.38      dillo    5648:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      5649:               <code xmlns=
                   5650:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   5651:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    5652: 
1.38      dillo    5653:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  5654:               Tweaking output of <span><strong class="command">make
                   5655:               print-PLIST</strong></span></a></span></dt>
1.1       grant    5656: 
1.38      dillo    5657:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    5658:               Variable substitution in PLIST</a></span></dt>
                   5659: 
1.30      wiz      5660:               <dt><span class="sect1"><a href=
1.48      dillo    5661:               "#manpage-compression">10.5. Man page
                   5662:               compression</a></span></dt>
1.1       grant    5663: 
1.30      wiz      5664:               <dt><span class="sect1"><a href=
1.38      dillo    5665:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      5666:               <code class=
1.14      xtraeme  5667:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5668: 
1.30      wiz      5669:               <dt><span class="sect1"><a href=
1.47      reed     5670:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    5671:               and differing PLISTs</a></span></dt>
1.1       grant    5672: 
                   5673:               <dt><span class="sect1"><a href=
1.38      dillo    5674:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    5675:               packages</a></span></dt>
                   5676:             </dl>
                   5677:           </dd>
                   5678: 
1.38      dillo    5679:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    5680:           Buildlink methodology</a></span></dt>
                   5681: 
                   5682:           <dd>
                   5683:             <dl>
1.30      wiz      5684:               <dt><span class="sect1"><a href=
1.38      dillo    5685:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      5686:               to use buildlink3</a></span></dt>
1.1       grant    5687: 
1.30      wiz      5688:               <dt><span class="sect1"><a href=
1.45      wiz      5689:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   5690:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5691:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    5692: 
                   5693:               <dd>
                   5694:                 <dl>
                   5695:                   <dt><span class="sect2"><a href=
1.38      dillo    5696:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      5697:                   buildlink3.mk file</a></span></dt>
1.1       grant    5698: 
                   5699:                   <dt><span class="sect2"><a href=
1.38      dillo    5700:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      5701:                   <code class=
                   5702:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45      wiz      5703:                   <code>pkg</code></em></code> in <code xmlns=
                   5704:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5705:                   "filename">buildlink3.mk</code>
1.1       grant    5706:                   files</a></span></dt>
                   5707:                 </dl>
                   5708:               </dd>
                   5709: 
1.30      wiz      5710:               <dt><span class="sect1"><a href=
1.45      wiz      5711:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   5712:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      5713:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    5714: 
                   5715:               <dd>
                   5716:                 <dl>
                   5717:                   <dt><span class="sect2"><a href=
1.38      dillo    5718:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      5719:                   <code xmlns=
                   5720:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   5721:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5722: 
                   5723:                   <dt><span class="sect2"><a href=
1.38      dillo    5724:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      5725:                   preferences for native or pkgsrc
                   5726:                   software</a></span></dt>
1.1       grant    5727:                 </dl>
                   5728:               </dd>
                   5729:             </dl>
                   5730:           </dd>
                   5731: 
1.38      dillo    5732:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     5733:           pkginstall framework</a></span></dt>
                   5734: 
                   5735:           <dd>
                   5736:             <dl>
                   5737:               <dt><span class="sect1"><a href=
1.38      dillo    5738:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     5739:               directories outside the installation
                   5740:               prefix</a></span></dt>
                   5741: 
                   5742:               <dd>
                   5743:                 <dl>
                   5744:                   <dt><span class="sect2"><a href=
1.38      dillo    5745:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     5746:                   manipulation</a></span></dt>
                   5747: 
                   5748:                   <dt><span class="sect2"><a href=
1.38      dillo    5749:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     5750:                   manipulation</a></span></dt>
                   5751:                 </dl>
                   5752:               </dd>
                   5753: 
1.38      dillo    5754:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     5755:               Configuration files</a></span></dt>
                   5756: 
                   5757:               <dd>
                   5758:                 <dl>
                   5759:                   <dt><span class="sect2"><a href=
1.38      dillo    5760:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     5761:                   "varname">PKG_SYSCONFDIR</code> is
                   5762:                   set</a></span></dt>
                   5763: 
                   5764:                   <dt><span class="sect2"><a href=
1.38      dillo    5765:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     5766:                   software where configuration files
1.35      jmmv     5767:                   are</a></span></dt>
                   5768: 
                   5769:                   <dt><span class="sect2"><a href=
1.38      dillo    5770:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     5771:                   installations</a></span></dt>
                   5772: 
                   5773:                   <dt><span class="sect2"><a href=
1.38      dillo    5774:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     5775:                   of configuration files</a></span></dt>
                   5776:                 </dl>
                   5777:               </dd>
                   5778: 
1.38      dillo    5779:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     5780:               System startup scripts</a></span></dt>
                   5781: 
                   5782:               <dd>
                   5783:                 <dl>
                   5784:                   <dt><span class="sect2"><a href=
1.38      dillo    5785:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     5786:                   of system startup scripts</a></span></dt>
                   5787:                 </dl>
                   5788:               </dd>
                   5789: 
                   5790:               <dt><span class="sect1"><a href=
1.38      dillo    5791:               "#users-and-groups">12.4. System users and
1.35      jmmv     5792:               groups</a></span></dt>
                   5793: 
1.38      dillo    5794:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     5795:               System shells</a></span></dt>
                   5796: 
                   5797:               <dd>
                   5798:                 <dl>
                   5799:                   <dt><span class="sect2"><a href=
1.38      dillo    5800:                   "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     5801:                   configuration files</a></span></dt>
                   5802:                 </dl>
                   5803:               </dd>
                   5804:             </dl>
                   5805:           </dd>
                   5806: 
1.38      dillo    5807:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    5808:           handling</a></span></dt>
                   5809: 
                   5810:           <dd>
                   5811:             <dl>
1.30      wiz      5812:               <dt><span class="sect1"><a href=
1.38      dillo    5813:               "#global-default-options">13.1. Global default
1.30      wiz      5814:               options</a></span></dt>
1.1       grant    5815: 
1.30      wiz      5816:               <dt><span class="sect1"><a href=
1.38      dillo    5817:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      5818:               use <code xmlns=
                   5819:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5820:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    5821: 
                   5822:               <dt><span class="sect1"><a href="#option-names">13.3.
                   5823:               Option Names</a></span></dt>
1.1       grant    5824:             </dl>
                   5825:           </dd>
                   5826: 
1.38      dillo    5827:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    5828:           process</a></span></dt>
                   5829: 
                   5830:           <dd>
                   5831:             <dl>
1.38      dillo    5832:               <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1       grant    5833:               Program location</a></span></dt>
                   5834: 
1.38      dillo    5835:               <dt><span class="sect1"><a href="#main-targets">14.2.
1.1       grant    5836:               Main targets</a></span></dt>
                   5837: 
                   5838:               <dt><span class="sect1"><a href=
1.38      dillo    5839:               "#build.helpful-targets">14.3. Other helpful
1.1       grant    5840:               targets</a></span></dt>
                   5841:             </dl>
                   5842:           </dd>
                   5843: 
1.38      dillo    5844:           <dt><span class="chapter"><a href="#fixes">15. Notes on
1.1       grant    5845:           fixes for packages</a></span></dt>
                   5846: 
                   5847:           <dd>
                   5848:             <dl>
1.30      wiz      5849:               <dt><span class="sect1"><a href=
1.38      dillo    5850:               "#general-operation">15.1. General
1.30      wiz      5851:               operation</a></span></dt>
1.1       grant    5852: 
                   5853:               <dd>
                   5854:                 <dl>
                   5855:                   <dt><span class="sect2"><a href=
1.38      dillo    5856:                   "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      5857:                   pull in variables from
                   5858:                   /etc/mk.conf</a></span></dt>
1.1       grant    5859: 
                   5860:                   <dt><span class="sect2"><a href=
1.38      dillo    5861:                   "#where-to-install-documentation">15.1.2. Where
1.31      wiz      5862:                   to install documentation</a></span></dt>
                   5863: 
                   5864:                   <dt><span class="sect2"><a href=
1.38      dillo    5865:                   "#restricted-packages">15.1.3. Restricted
1.1       grant    5866:                   packages</a></span></dt>
                   5867: 
                   5868:                   <dt><span class="sect2"><a href=
1.38      dillo    5869:                   "#dependencies">15.1.4. Handling
1.1       grant    5870:                   dependencies</a></span></dt>
                   5871: 
                   5872:                   <dt><span class="sect2"><a href=
1.38      dillo    5873:                   "#conflicts">15.1.5. Handling conflicts with
1.1       grant    5874:                   other packages</a></span></dt>
                   5875: 
                   5876:                   <dt><span class="sect2"><a href=
1.38      dillo    5877:                   "#not-building-packages">15.1.6. Packages that
1.30      wiz      5878:                   cannot or should not be built</a></span></dt>
1.1       grant    5879: 
                   5880:                   <dt><span class="sect2"><a href=
1.38      dillo    5881:                   "#undeletable-packages">15.1.7. Packages which
1.30      wiz      5882:                   should not be deleted, once
                   5883:                   installed</a></span></dt>
1.1       grant    5884: 
                   5885:                   <dt><span class="sect2"><a href=
1.38      dillo    5886:                   "#security-handling">15.1.8. Handling packages
1.1       grant    5887:                   with security problems</a></span></dt>
                   5888: 
                   5889:                   <dt><span class="sect2"><a href=
1.38      dillo    5890:                   "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    5891:                   bugs</a></span></dt>
                   5892: 
                   5893:                   <dt><span class="sect2"><a href=
1.38      dillo    5894:                   "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      5895:                   incrementing versions when fixing an existing
1.1       grant    5896:                   package</a></span></dt>
                   5897: 
                   5898:                   <dt><span class="sect2"><a href=
1.38      dillo    5899:                   "#portability-of-packages">15.1.11. Portability
1.30      wiz      5900:                   of packages</a></span></dt>
1.1       grant    5901:                 </dl>
                   5902:               </dd>
                   5903: 
1.30      wiz      5904:               <dt><span class="sect1"><a href=
1.38      dillo    5905:               "#downloading-issues">15.2. Possible downloading
1.30      wiz      5906:               issues</a></span></dt>
1.1       grant    5907: 
                   5908:               <dd>
                   5909:                 <dl>
                   5910:                   <dt><span class="sect2"><a href=
1.38      dillo    5911:                   "#no-plain-download">15.2.1. Packages whose
1.30      wiz      5912:                   distfiles aren't available for plain
1.1       grant    5913:                   downloading</a></span></dt>
                   5914: 
                   5915:                   <dt><span class="sect2"><a href=
1.38      dillo    5916:                   "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      5917:                   handle modified distfiles with the 'old'
                   5918:                   name</a></span></dt>
1.1       grant    5919:                 </dl>
                   5920:               </dd>
                   5921: 
1.30      wiz      5922:               <dt><span class="sect1"><a href=
1.38      dillo    5923:               "#configuration-gotchas">15.3. Configuration
1.30      wiz      5924:               gotchas</a></span></dt>
1.1       grant    5925: 
                   5926:               <dd>
                   5927:                 <dl>
                   5928:                   <dt><span class="sect2"><a href=
1.38      dillo    5929:                   "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    5930:                   libtool</a></span></dt>
                   5931: 
                   5932:                   <dt><span class="sect2"><a href=
1.38      dillo    5933:                   "#using-libtool">15.3.2. Using libtool on GNU
1.1       grant    5934:                   packages that already support
                   5935:                   libtool</a></span></dt>
                   5936: 
                   5937:                   <dt><span class="sect2"><a href=
1.38      dillo    5938:                   "#autoconf-automake">15.3.3. GNU
1.1       grant    5939:                   Autoconf/Automake</a></span></dt>
                   5940:                 </dl>
                   5941:               </dd>
                   5942: 
1.30      wiz      5943:               <dt><span class="sect1"><a href=
1.38      dillo    5944:               "#building-considerations">15.4. Building
1.30      wiz      5945:               considerations</a></span></dt>
1.1       grant    5946: 
                   5947:               <dd>
                   5948:                 <dl>
                   5949:                   <dt><span class="sect2"><a href=
1.38      dillo    5950:                   "#cpp-defines">15.4.1. CPP
1.30      wiz      5951:                   defines</a></span></dt>
1.1       grant    5952:                 </dl>
                   5953:               </dd>
                   5954: 
1.30      wiz      5955:               <dt><span class="sect1"><a href=
1.38      dillo    5956:               "#package-specific-actions">15.5. Package specific
1.30      wiz      5957:               actions</a></span></dt>
1.1       grant    5958: 
                   5959:               <dd>
                   5960:                 <dl>
                   5961:                   <dt><span class="sect2"><a href=
1.38      dillo    5962:                   "#user-interaction">15.5.1. User
1.2       hubertf  5963:                   interaction</a></span></dt>
1.1       grant    5964: 
                   5965:                   <dt><span class="sect2"><a href=
1.38      dillo    5966:                   "#handling-licenses">15.5.2. Handling
1.1       grant    5967:                   licenses</a></span></dt>
                   5968: 
                   5969:                   <dt><span class="sect2"><a href=
1.38      dillo    5970:                   "#installing-score-files">15.5.3. Installing
1.30      wiz      5971:                   score files</a></span></dt>
1.1       grant    5972: 
                   5973:                   <dt><span class="sect2"><a href=
1.38      dillo    5974:                   "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    5975:                   scripts</a></span></dt>
                   5976: 
                   5977:                   <dt><span class="sect2"><a href=
1.38      dillo    5978:                   "#hardcoded-paths">15.5.5. Packages with
1.30      wiz      5979:                   hardcoded paths to other
                   5980:                   interpreters</a></span></dt>
1.1       grant    5981: 
                   5982:                   <dt><span class="sect2"><a href=
1.38      dillo    5983:                   "#perl-modules">15.5.6. Packages installing perl
1.1       grant    5984:                   modules</a></span></dt>
                   5985: 
                   5986:                   <dt><span class="sect2"><a href=
1.38      dillo    5987:                   "#faq.info-files">15.5.7. Packages installing
1.1       grant    5988:                   info files</a></span></dt>
                   5989: 
                   5990:                   <dt><span class="sect2"><a href=
1.38      dillo    5991:                   "#gconf2-data-files">15.5.8. Packages installing
1.30      wiz      5992:                   GConf2 data files</a></span></dt>
1.1       grant    5993: 
                   5994:                   <dt><span class="sect2"><a href=
1.38      dillo    5995:                   "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz      5996:                   installing scrollkeeper data
                   5997:                   files</a></span></dt>
1.1       grant    5998: 
                   5999:                   <dt><span class="sect2"><a href=
1.38      dillo    6000:                   "#x11-fonts">15.5.10. Packages installing X11
1.1       grant    6001:                   fonts</a></span></dt>
                   6002: 
                   6003:                   <dt><span class="sect2"><a href=
1.38      dillo    6004:                   "#gtk2-modules">15.5.11. Packages installing GTK2
1.1       grant    6005:                   modules</a></span></dt>
                   6006: 
                   6007:                   <dt><span class="sect2"><a href=
1.38      dillo    6008:                   "#sgml-xml-data">15.5.12. Packages installing
1.30      wiz      6009:                   SGML or XML data</a></span></dt>
1.1       grant    6010: 
                   6011:                   <dt><span class="sect2"><a href=
1.38      dillo    6012:                   "#mime-database">15.5.13. Packages installing
1.1       grant    6013:                   extensions to the MIME database</a></span></dt>
                   6014: 
                   6015:                   <dt><span class="sect2"><a href=
1.38      dillo    6016:                   "#intltool">15.5.14. Packages using
1.1       grant    6017:                   intltool</a></span></dt>
1.18      xtraeme  6018: 
                   6019:                   <dt><span class="sect2"><a href=
1.38      dillo    6020:                   "#startup-scripts">15.5.15. Packages installing
1.30      wiz      6021:                   startup scripts</a></span></dt>
1.1       grant    6022:                 </dl>
                   6023:               </dd>
                   6024: 
1.30      wiz      6025:               <dt><span class="sect1"><a href=
1.38      dillo    6026:               "#feedback-to-author">15.6. Feedback to the
1.30      wiz      6027:               author</a></span></dt>
1.1       grant    6028:             </dl>
                   6029:           </dd>
                   6030: 
1.38      dillo    6031:           <dt><span class="chapter"><a href="#debug">16.
1.1       grant    6032:           Debugging</a></span></dt>
                   6033: 
1.38      dillo    6034:           <dt><span class="chapter"><a href="#submit">17.
1.1       grant    6035:           Submitting and Committing</a></span></dt>
                   6036: 
                   6037:           <dd>
                   6038:             <dl>
1.30      wiz      6039:               <dt><span class="sect1"><a href=
1.38      dillo    6040:               "#submitting-your-package">17.1. Submitting your
1.30      wiz      6041:               packages</a></span></dt>
1.1       grant    6042: 
1.30      wiz      6043:               <dt><span class="sect1"><a href=
1.41      wiz      6044:               "#general-notes-for-changes">17.2. General notes when
                   6045:               adding, updating, or removing
                   6046:               packages</a></span></dt>
                   6047: 
                   6048:               <dt><span class="sect1"><a href=
                   6049:               "#committing-importing">17.3. Committing: Importing a
1.30      wiz      6050:               package into CVS</a></span></dt>
1.1       grant    6051: 
1.30      wiz      6052:               <dt><span class="sect1"><a href=
1.41      wiz      6053:               "#updating-package">17.4. Updating a package to a
1.30      wiz      6054:               newer version</a></span></dt>
1.1       grant    6055: 
1.30      wiz      6056:               <dt><span class="sect1"><a href=
1.41      wiz      6057:               "#moving-package">17.5. Moving a package in
1.30      wiz      6058:               pkgsrc</a></span></dt>
1.1       grant    6059:             </dl>
                   6060:           </dd>
                   6061:         </dl>
                   6062:       </div>
                   6063: 
                   6064:       <div class="chapter" lang="en" xml:lang="en">
                   6065:         <div class="titlepage">
                   6066:           <div>
                   6067:             <div>
1.27      rillig   6068:               <h2 class="title"><a name="components" id=
1.38      dillo    6069:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6070:               components - files, directories and contents</h2>
1.25      rillig   6071:             </div>
                   6072:           </div>
                   6073:         </div>
                   6074: 
                   6075:         <div class="toc">
                   6076:           <p><b>Table of Contents</b></p>
                   6077: 
                   6078:           <dl>
                   6079:             <dt><span class="sect1"><a href=
1.45      wiz      6080:             "#components.Makefile">8.1. <code xmlns=
                   6081:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6082:             "filename">Makefile</code></a></span></dt>
                   6083: 
                   6084:             <dt><span class="sect1"><a href=
1.45      wiz      6085:             "#components.distinfo">8.2. <code xmlns=
                   6086:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6087:             "filename">distinfo</code></a></span></dt>
                   6088: 
                   6089:             <dt><span class="sect1"><a href=
1.38      dillo    6090:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6091: 
1.30      wiz      6092:             <dt><span class="sect1"><a href=
1.38      dillo    6093:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6094:             files</a></span></dt>
1.25      rillig   6095: 
1.27      rillig   6096:             <dt><span class="sect1"><a href=
1.38      dillo    6097:             "#components.optional">8.5. Optional
1.27      rillig   6098:             files</a></span></dt>
1.25      rillig   6099: 
1.38      dillo    6100:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6101:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6102:             class="filename">work*</code></a></span></dt>
1.25      rillig   6103: 
1.38      dillo    6104:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6105:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6106:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6107:           </dl>
                   6108:         </div>
                   6109: 
1.27      rillig   6110:         <p>Whenever you're preparing a package, there are a number
                   6111:         of files involved which are described in the following
                   6112:         sections.</p>
1.25      rillig   6113: 
                   6114:         <div class="sect1" lang="en" xml:lang="en">
                   6115:           <div class="titlepage">
                   6116:             <div>
                   6117:               <div>
                   6118:                 <h2 class="title" style="clear: both"><a name=
1.27      rillig   6119:                 "components.Makefile" id=
1.45      wiz      6120:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6121:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6122:                 "filename">Makefile</code></h2>
1.25      rillig   6123:               </div>
                   6124:             </div>
                   6125:           </div>
                   6126: 
1.27      rillig   6127:           <p>Building, installation and creation of a binary
1.45      wiz      6128:           package are all controlled by the package's <code xmlns=
                   6129:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6130:           "filename">Makefile</code>. The <code xmlns=
                   6131:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6132:           "filename">Makefile</code> describes various things about
                   6133:           a package, for example from where to get it, how to
                   6134:           configure, build, and install it.</p>
                   6135: 
1.45      wiz      6136:           <p>A package <code xmlns=
                   6137:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6138:           "filename">Makefile</code> contains several sections that
                   6139:           describe the package.</p>
1.25      rillig   6140: 
1.27      rillig   6141:           <p>In the first section there are the following
                   6142:           variables, which should appear exactly in the order given
                   6143:           here.</p>
1.25      rillig   6144: 
                   6145:           <div class="itemizedlist">
                   6146:             <ul type="disc">
                   6147:               <li>
1.27      rillig   6148:                 <p><code class="varname">DISTNAME</code> is the
                   6149:                 basename of the distribution file to be downloaded
                   6150:                 from the package's website.</p>
                   6151:               </li>
                   6152: 
                   6153:               <li>
                   6154:                 <p><code class="varname">PKGNAME</code> is the name
                   6155:                 of the package, as used by pkgsrc. You only need to
1.50    ! rillig   6156:                 provide it if it differs from <code class=
        !          6157:                 "varname">DISTNAME</code>. Usually it is the
        !          6158:                 directory name together with the version number. It
        !          6159:                 must match the regular expression <code class=
1.27      rillig   6160:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6161:                 that is, it starts with a letter or digit, and
                   6162:                 contains only letters, digits, dashes, underscores,
                   6163:                 dots and plus signs.</p>
1.25      rillig   6164:               </li>
                   6165: 
                   6166:               <li>
1.27      rillig   6167:                 <p><code class="varname">CATEGORIES</code> is a
                   6168:                 list of categories which the package fits in. You
                   6169:                 can choose any of the top-level directories of
                   6170:                 pkgsrc for it.</p>
1.45      wiz      6171: 
                   6172:                 <p>Currently the following values are available for
                   6173:                 <code class="varname">CATEGORIES</code>. If more
                   6174:                 than one is used, they need to be separated by
                   6175:                 spaces:</p>
                   6176:                 <pre class="programlisting">
                   6177: archivers     cross         geography     meta-pkgs     security
                   6178: audio         databases     graphics      misc          shells
                   6179: benchmarks    devel         ham           multimedia    sysutils
                   6180: biology       editors       inputmethod   net           textproc
                   6181: cad           emulators     lang          news          time
                   6182: chat          finance       mail          parallel      wm
                   6183: comms         fonts         math          pkgtools      www
                   6184: converters    games         mbone         print         x11
                   6185: </pre>
1.25      rillig   6186:               </li>
                   6187: 
                   6188:               <li>
1.27      rillig   6189:                 <p><code class="varname">MASTER_SITES</code> is a
                   6190:                 list of URLs where the distribution files can be
                   6191:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6192: 
                   6193:                 <p>The <code class="varname">MASTER_SITES</code>
                   6194:                 may make use of the following predefined sites:</p>
                   6195:                 <pre class="programlisting">
                   6196:             ${MASTER_SITE_APACHE}
                   6197:             ${MASTER_SITE_BACKUP}
                   6198:             ${MASTER_SITE_CYGWIN}
                   6199:             ${MASTER_SITE_DEBIAN}
                   6200:             ${MASTER_SITE_FREEBSD}
                   6201:             ${MASTER_SITE_FREEBSD_LOCAL}
                   6202:             ${MASTER_SITE_GNOME}
                   6203:             ${MASTER_SITE_GNU}
                   6204:             ${MASTER_SITE_GNUSTEP}
                   6205:             ${MASTER_SITE_IFARCHIVE}
                   6206:             ${MASTER_SITE_MOZILLA}
                   6207:             ${MASTER_SITE_OPENOFFICE}
                   6208:             ${MASTER_SITE_PERL_CPAN}
                   6209:             ${MASTER_SITE_R_CRAN}
                   6210:             ${MASTER_SITE_SOURCEFORGE}
                   6211:             ${MASTER_SITE_SUNSITE}
                   6212:             ${MASTER_SITE_SUSE}
                   6213:             ${MASTER_SITE_TEX_CTAN}
                   6214:             ${MASTER_SITE_XCONTRIB}
                   6215:             ${MASTER_SITE_XEMACS}
                   6216:           
                   6217: </pre>
                   6218: 
                   6219:                 <p>If one of these predefined sites is chosen, you
                   6220:                 may want to specify a subdirectory of that site.
                   6221:                 Since these macros may expand to more than one
                   6222:                 actual site, you <span class=
                   6223:                 "emphasis"><em>must</em></span> use the following
                   6224:                 construct to specify a subdirectory:</p>
                   6225:                 <pre class="programlisting">
                   6226:             ${MASTER_SITE_GNU:=subdirectory/name/}
                   6227:             ${MASTER_SITE_SOURCEFORGE:=project_name/}
                   6228: </pre>
                   6229: 
                   6230:                 <p>Note the trailing slash after the subdirectory
                   6231:                 name.</p>
                   6232: 
                   6233:                 <p>If the package has multiple <code class=
                   6234:                 "varname">DISTFILES</code> or multiple <code class=
                   6235:                 "varname">PATCHFILES</code> from different sites,
                   6236:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     6237:                 list of URIs where file &#8220;<span class=
1.45      wiz      6238:                 "quote">foo</span>&#8221; may be found.
                   6239:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     6240:                 includes the suffix, e.g.:</p>
1.45      wiz      6241:                 <pre class="programlisting">
                   6242: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6243: DISTFILES+=     foo-file.tar.gz
                   6244: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   6245:         http://www.somewhereelse.com/mirror/somehow/
                   6246: </pre>
                   6247:               </li>
                   6248: 
                   6249:               <li>
                   6250:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   6251:                 of archive file(s) containing distribution. The
                   6252:                 default is <code xmlns=
                   6253:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6254:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   6255:                 Should only be set if you have more than one
                   6256:                 distfile.</p>
                   6257: 
                   6258:                 <p>Note that the normal default setting of
                   6259:                 <code class="varname">DISTFILES</code> must be made
                   6260:                 explicit if you want to add to it (rather than
                   6261:                 replace it), as you usually would.</p>
                   6262:               </li>
                   6263: 
                   6264:               <li>
                   6265:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   6266:                 Suffix of the distribution file, will be appended
                   6267:                 to <code class="varname">DISTNAME</code>. Defaults
                   6268:                 to <code xmlns=
                   6269:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6270:                 "filename">.tar.gz</code>.</p>
                   6271:               </li>
                   6272:             </ul>
                   6273:           </div>
                   6274: 
                   6275:           <p>The second section contains information about
                   6276:           separately downloaded patches, if any.</p>
                   6277: 
                   6278:           <div class="itemizedlist">
                   6279:             <ul type="disc">
                   6280:               <li>
1.47      reed     6281:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      6282:                 of additional files that contain distribution
                   6283:                 patches. There is no default. pkgsrc will look for
                   6284:                 them at <code class="varname">PATCH_SITES</code>.
                   6285:                 They will automatically be uncompressed before
                   6286:                 patching if the names end with <code xmlns=
                   6287:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6288:                 "filename">.gz</code> or <code xmlns=
                   6289:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6290:                 "filename">.Z</code>.</p>
                   6291:               </li>
                   6292: 
                   6293:               <li>
                   6294:                 <p><code class="varname">PATCH_SITES</code>:
                   6295:                 Primary location(s) for distribution patch files
                   6296:                 (see <code class="varname">PATCHFILES</code> below)
                   6297:                 if not found locally.</p>
1.25      rillig   6298:               </li>
                   6299:             </ul>
                   6300:           </div>
                   6301: 
1.45      wiz      6302:           <p>The third section contains the following
1.27      rillig   6303:           variables.</p>
1.25      rillig   6304: 
1.27      rillig   6305:           <div class="itemizedlist">
                   6306:             <ul type="disc">
                   6307:               <li>
                   6308:                 <p><code class="varname">MAINTAINER</code> is the
1.50    ! rillig   6309:                 email address of the person who feels responsible
        !          6310:                 for this package, and who is most likely to look at
        !          6311:                 problems or questions regarding this package which
        !          6312:                 have been reported with <a href=
1.45      wiz      6313:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6314:                 <span class="citerefentry"><span class=
1.50    ! rillig   6315:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
        !          6316:                 developers should contact the <code class=
        !          6317:                 "varname">MAINTAINER</code> before making major
        !          6318:                 changes to the package. When packaging a new
        !          6319:                 program, set <code class=
        !          6320:                 "varname">MAINTAINER</code> to yourself. If you
        !          6321:                 really can't maintain the package for future
        !          6322:                 updates, set it to <code class="email">&lt;<a href=
1.45      wiz      6323:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   6324:               </li>
1.25      rillig   6325: 
1.27      rillig   6326:               <li>
                   6327:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   6328:                 where users can find more information about the
1.23      wiz      6329:                 package.</p>
                   6330:               </li>
1.1       grant    6331: 
1.23      wiz      6332:               <li>
                   6333:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      6334:                 one-line description of the package (should not
                   6335:                 include the package name).</p>
1.23      wiz      6336:               </li>
                   6337:             </ul>
                   6338:           </div>
1.1       grant    6339: 
1.45      wiz      6340:           <p>Other variables that affect the build:</p>
1.1       grant    6341: 
1.45      wiz      6342:           <div class="itemizedlist">
                   6343:             <ul type="disc">
                   6344:               <li>
                   6345:                 <p><code class="varname">WRKSRC</code>: The
1.50    ! rillig   6346:                 directory where the interesting distribution files
        !          6347:                 of the package are found. The default is
        !          6348:                 <code xmlns=
        !          6349:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6350:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
        !          6351:                 works for most packages.</p>
        !          6352: 
        !          6353:                 <p>If a package doesn't create a subdirectory for
        !          6354:                 itself (most GNU software does, for instance), but
        !          6355:                 extracts itself in the current directory, you
        !          6356:                 should set <code class="varname">WRKSRC=
        !          6357:                 ${WRKDIR}</code>.</p>
        !          6358: 
        !          6359:                 <p>If a package doesn't create a subdirectory with
        !          6360:                 the name of <code class="varname">DISTNAME</code>
        !          6361:                 but some different name, set <code class=
        !          6362:                 "varname">WRKSRC</code> to point to the proper name
        !          6363:                 in <code xmlns=
        !          6364:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6365:                 "filename">${WRKDIR}</code>, for example
        !          6366:                 <code class="varname">WRKSRC=
        !          6367:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
        !          6368:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          6369:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
        !          6370:                 target="_top"><code xmlns="" class=
        !          6371:                 "filename">lang/tcl</code></a> and <a xmlns=
        !          6372:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          6373:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          6374:                 target="_top"><code xmlns="" class=
        !          6375:                 "filename">x11/tk</code></a> for other
        !          6376:                 examples.</p>
        !          6377: 
        !          6378:                 <p>The name of the working directory created by
        !          6379:                 pkgsrc is taken from the <code class=
        !          6380:                 "varname">WRKDIR_BASENAME</code> variable. By
        !          6381:                 default, its value is <code xmlns=
        !          6382:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6383:                 "filename">work</code>. If you want to use the same
        !          6384:                 pkgsrc tree for building different kinds of binary
        !          6385:                 packages, you can change the variable according to
        !          6386:                 your needs. Two other variables handle common cases
        !          6387:                 of setting <code class=
        !          6388:                 "varname">WRKDIR_BASENAME</code> individually. If
        !          6389:                 <code class="varname">OBJHOSTNAME</code> is defined
        !          6390:                 in <code xmlns=
1.45      wiz      6391:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50    ! rillig   6392:                 "filename">/etc/mk.conf</code>, the first component
        !          6393:                 of the host's name is attached to the directory
        !          6394:                 name. If <code class="varname">OBJMACHINE</code> is
        !          6395:                 defined, the platform name is attached, which might
        !          6396:                 look like <code xmlns=
        !          6397:                 "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6398:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      6399:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50    ! rillig   6400:                 "filename">work.sparc</code>.</p>
1.45      wiz      6401:               </li>
                   6402:             </ul>
1.1       grant    6403:           </div>
                   6404: 
                   6405:           <p>Please pay attention to the following gotchas:</p>
                   6406: 
                   6407:           <div class="itemizedlist">
                   6408:             <ul type="disc">
                   6409:               <li>
1.14      xtraeme  6410:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6411:                 if man pages are installed in compressed form by
                   6412:                 the package; see comment in <code xmlns=
1.45      wiz      6413:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6414:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6415:               </li>
                   6416: 
                   6417:               <li>
1.45      wiz      6418:                 <p>Replace <code xmlns=
                   6419:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6420:                 "filename">/usr/local</code> with
                   6421:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6422:                 in all files (see patches, below).</p>
1.1       grant    6423:               </li>
                   6424: 
                   6425:               <li>
                   6426:                 <p>If the package installs any info files, see
                   6427:                 <a href="#faq.info-files" title=
1.45      wiz      6428:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6429:                 &#8220;Packages installing info
1.1       grant    6430:                 files&#8221;</a>.</p>
                   6431:               </li>
                   6432:             </ul>
                   6433:           </div>
                   6434:         </div>
                   6435: 
                   6436:         <div class="sect1" lang="en" xml:lang="en">
                   6437:           <div class="titlepage">
                   6438:             <div>
                   6439:               <div>
                   6440:                 <h2 class="title" style="clear: both"><a name=
                   6441:                 "components.distinfo" id=
1.45      wiz      6442:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6443:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6444:                 "filename">distinfo</code></h2>
1.1       grant    6445:               </div>
                   6446:             </div>
                   6447:           </div>
                   6448: 
1.50    ! rillig   6449:           <p>The <code xmlns=
        !          6450:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6451:           "filename">distinfo</code> file contains the message
        !          6452:           digest, or checksum, of each distfile needed for the
        !          6453:           package. This ensures that the distfiles retrieved from
        !          6454:           the Internet have not been corrupted during transfer or
        !          6455:           altered by a malign force to introduce a security hole.
        !          6456:           Due to recent rumor about weaknesses of digest
        !          6457:           algorithms, all distfiles are protected using both SHA1
        !          6458:           and RMD160 message digests, as well as the file size.</p>
        !          6459: 
        !          6460:           <p>The <code xmlns=
        !          6461:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6462:           "filename">distinfo</code> file also contains the
        !          6463:           checksums for all the patches found in the <code xmlns=
        !          6464:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6465:           "filename">patches</code> directory (see <a href=
        !          6466:           "#components.patches" title=
        !          6467:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
        !          6468:           &#8220;patches/*&#8221;</a>).</p>
        !          6469: 
        !          6470:           <p>To regenerate the <code xmlns=
        !          6471:           "http://www.w3.org/TR/xhtml1/transitional" class=
        !          6472:           "filename">distinfo</code> file, use the
1.14      xtraeme  6473:           <span><strong class="command">make
1.50    ! rillig   6474:           makedistinfo</strong></span> or <span><strong class=
        !          6475:           "command">make mdi</strong></span> command.</p>
1.1       grant    6476: 
1.50    ! rillig   6477:           <p>Some packages have different sets of distfiles
        !          6478:           depending on the platform, for example <a xmlns=
1.1       grant    6479:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6480:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6481:           target="_top"><code xmlns="" class=
                   6482:           "filename">www/navigator</code></a>). These are kept in
1.50    ! rillig   6483:           the same <code xmlns=
1.45      wiz      6484:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50    ! rillig   6485:           "filename">distinfo</code> file and care should be taken
        !          6486:           when upgrading such a package to ensure distfile
        !          6487:           information is not lost.</p>
1.1       grant    6488:         </div>
                   6489: 
                   6490:         <div class="sect1" lang="en" xml:lang="en">
                   6491:           <div class="titlepage">
                   6492:             <div>
                   6493:               <div>
                   6494:                 <h2 class="title" style="clear: both"><a name=
                   6495:                 "components.patches" id=
1.38      dillo    6496:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6497:               </div>
                   6498:             </div>
                   6499:           </div>
                   6500: 
                   6501:           <p>This directory contains files that are used by the
                   6502:           <a href=
                   6503:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6504:           <span class="citerefentry"><span class=
                   6505:           "refentrytitle">patch</span>(1)</span></a> command to
                   6506:           modify the sources as distributed in the distribution
                   6507:           file into a form that will compile and run perfectly on
                   6508:           NetBSD. The files are applied successively in alphabetic
                   6509:           order (as returned by a shell &#8220;<span class=
                   6510:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6511:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6512:           class="filename">patch-aa</code> is applied before
                   6513:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6514:           class="filename">patch-ab</code>, etc.</p>
                   6515: 
                   6516:           <p>The <code xmlns=
                   6517:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6518:           "filename">patch-*</code> files should be in
                   6519:           <span><strong class="command">diff -bu</strong></span>
                   6520:           format, and apply without a fuzz to avoid problems. (To
                   6521:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6522:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6523:           not put changes for more than one file into a single
1.47      reed     6524:           patch file, as this will make future modifications more
1.1       grant    6525:           difficult.</p>
                   6526: 
                   6527:           <p>Similar, a file should be patched at most once, not
                   6528:           several times by several different patches. If a file
                   6529:           needs several patches, they should be combined into one
                   6530:           file.</p>
                   6531: 
                   6532:           <p>One important thing to mention is to pay attention
                   6533:           that no RCS IDs get stored in the patch files, as these
                   6534:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6535:           CVS tree. Use the <span><strong class=
                   6536:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6537:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6538:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6539:           target="_top"><code xmlns="" class=
                   6540:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6541:           these problems.</p>
1.1       grant    6542: 
                   6543:           <p>For even more automation, we recommend using
1.14      xtraeme  6544:           <span><strong class="command">mkpatches</strong></span>
                   6545:           from the same package to make a whole set of patches. You
                   6546:           just have to backup files before you edit them to
1.45      wiz      6547:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6548:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6549:           <span><strong class="command">cp -p filename
                   6550:           filename.orig</strong></span> or, easier, by using
                   6551:           <span><strong class="command">pkgvi</strong></span> again
                   6552:           from the same package. If you upgrade a package this way,
                   6553:           you can easily compare the new set of patches with the
                   6554:           previously existing one with <span><strong class=
                   6555:           "command">patchdiff</strong></span>.</p>
1.1       grant    6556: 
                   6557:           <p>When you have finished a package, remember to generate
                   6558:           the checksums for the patch files by using the
1.14      xtraeme  6559:           <span><strong class="command">make
                   6560:           makepatchsum</strong></span> command, see <a href=
                   6561:           "#components.distinfo" title=
1.38      dillo    6562:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6563:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6564:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6565: 
1.46      gdt      6566:           <p>When adding a patch that corrects a problem in the
                   6567:           distfile (rather than e.g. enforcing pkgsrc's view of
                   6568:           where man pages should go), send the patch as a bug
                   6569:           report to the maintainer. This benefits non-pkgsrc users
                   6570:           of the package, and usually enables removing the patch in
                   6571:           future version.</p>
                   6572: 
1.1       grant    6573:           <p>Patch files that are distributed by the author or
1.14      xtraeme  6574:           other maintainers can be listed in <code class=
                   6575:           "varname">$PATCHFILES</code>.</p>
1.1       grant    6576: 
                   6577:           <p>If it is desired to store any patches that should not
                   6578:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      6579:           pkgsrc tree in the <code xmlns=
                   6580:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6581:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    6582:           tree there is expected to have the same
                   6583:           &#8220;<span class="quote">category/package</span>&#8221;
                   6584:           structure as pkgsrc, and patches are expected to be
1.45      wiz      6585:           stored inside these dirs (also known as <code xmlns=
                   6586:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     6587:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   6588:           if you want to keep a private patch for <code xmlns=
1.45      wiz      6589:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6590:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      6591:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6592:           class=
1.14      xtraeme  6593:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   6594:           files in the named directory are expected to be patch
1.1       grant    6595:           files, and <span class="emphasis"><em>they are applied
                   6596:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   6597:         </div>
                   6598: 
                   6599:         <div class="sect1" lang="en" xml:lang="en">
                   6600:           <div class="titlepage">
                   6601:             <div>
                   6602:               <div>
                   6603:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6604:                 "other-mandatory-files" id=
1.38      dillo    6605:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   6606:                 mandatory files</h2>
                   6607:               </div>
                   6608:             </div>
                   6609:           </div>
                   6610: 
                   6611:           <div class="variablelist">
                   6612:             <dl>
1.45      wiz      6613:               <dt><span class="term"><code xmlns=
                   6614:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6615:               "filename">DESCR</code></span></dt>
                   6616: 
                   6617:               <dd>
                   6618:                 <p>A multi-line description of the piece of
                   6619:                 software. This should include any credits where
                   6620:                 they are due. Please bear in mind that others do
                   6621:                 not share your sense of humour (or spelling
                   6622:                 idiosyncrasies), and that others will read
                   6623:                 everything that you write here.</p>
                   6624:               </dd>
                   6625: 
1.45      wiz      6626:               <dt><span class="term"><code xmlns=
                   6627:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6628:               "filename">PLIST</code></span></dt>
                   6629: 
                   6630:               <dd>
                   6631:                 <p>This file governs the files that are installed
                   6632:                 on your system: all the binaries, manual pages,
                   6633:                 etc. There are other directives which may be
                   6634:                 entered in this file, to control the creation and
                   6635:                 deletion of directories, and the location of
                   6636:                 inserted files. See <a href="#plist" title=
1.38      dillo    6637:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   6638:                 <i>PLIST issues</i></a> for more information.</p>
                   6639:               </dd>
                   6640:             </dl>
                   6641:           </div>
                   6642:         </div>
                   6643: 
                   6644:         <div class="sect1" lang="en" xml:lang="en">
                   6645:           <div class="titlepage">
                   6646:             <div>
                   6647:               <div>
                   6648:                 <h2 class="title" style="clear: both"><a name=
                   6649:                 "components.optional" id=
1.38      dillo    6650:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   6651:                 files</h2>
                   6652:               </div>
                   6653:             </div>
                   6654:           </div>
                   6655: 
                   6656:           <div class="variablelist">
                   6657:             <dl>
1.45      wiz      6658:               <dt><span class="term"><code xmlns=
                   6659:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6660:               "filename">INSTALL</code></span></dt>
                   6661: 
                   6662:               <dd>
                   6663:                 <p>This shell script is invoked twice by <a href=
                   6664:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6665:                 <span class="citerefentry"><span class=
                   6666:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   6667:                 time after package extraction and before files are
                   6668:                 moved in place, the second time after the files to
                   6669:                 install are moved in place. This can be used to do
                   6670:                 any custom procedures not possible with @exec
1.45      wiz      6671:                 commands in <code xmlns=
                   6672:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6673:                 "filename">PLIST</code>. See <a href=
1.27      rillig   6674:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6675:                 <span class="citerefentry"><span class=
                   6676:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   6677:                 <a href=
                   6678:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6679:                 <span class="citerefentry"><span class=
                   6680:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6681:                 more information.</p>
                   6682:               </dd>
                   6683: 
1.45      wiz      6684:               <dt><span class="term"><code xmlns=
                   6685:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6686:               "filename">DEINSTALL</code></span></dt>
                   6687: 
                   6688:               <dd>
                   6689:                 <p>This script is executed before and after any
                   6690:                 files are removed. It is this script's
                   6691:                 responsibility to clean up any additional messy
                   6692:                 details around the package's installation, since
                   6693:                 all pkg_delete knows is how to delete the files
                   6694:                 created in the original distribution. See <a href=
                   6695:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   6696:                 <span class="citerefentry"><span class=
                   6697:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   6698:                 <a href=
                   6699:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6700:                 <span class="citerefentry"><span class=
                   6701:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6702:                 more information.</p>
                   6703:               </dd>
                   6704: 
1.45      wiz      6705:               <dt><span class="term"><code xmlns=
                   6706:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6707:               "filename">MESSAGE</code></span></dt>
                   6708: 
                   6709:               <dd>
1.50    ! rillig   6710:                 <p>This file is displayed after installation of the
1.27      rillig   6711:                 package. Useful for things like legal notices on
                   6712:                 almost-free software and hints for updating config
                   6713:                 files after installing modules for apache, PHP etc.
                   6714:                 Please note that you can modify variables in it
                   6715:                 easily by using <code class=
                   6716:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      6717:                 <code xmlns=
                   6718:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6719:                 "filename">Makefile</code>:</p>
1.27      rillig   6720:                 <pre class="programlisting">
                   6721: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   6722: </pre>
                   6723: 
                   6724:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      6725:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   6726:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6727:                 "filename">MESSAGE</code>.</p>
                   6728:               </dd>
                   6729:             </dl>
                   6730:           </div>
                   6731:         </div>
                   6732: 
                   6733:         <div class="sect1" lang="en" xml:lang="en">
                   6734:           <div class="titlepage">
                   6735:             <div>
                   6736:               <div>
                   6737:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6738:                 "work-dir" id="work-dir"></a>8.6.&nbsp;<code xmlns=
                   6739:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6740:                 "filename">work*</code></h2>
                   6741:               </div>
                   6742:             </div>
                   6743:           </div>
                   6744: 
                   6745:           <p>When you type <span><strong class=
1.47      reed     6746:           "command">make</strong></span>, the distribution files
                   6747:           are unpacked into the directory denoted by <code class=
1.45      wiz      6748:           "varname">WRKDIR</code>. It can be removed by running
                   6749:           <span><strong class="command">make clean</strong></span>.
                   6750:           Besides the sources, this directory is also used to keep
                   6751:           various timestamp files. The directory gets <span class=
                   6752:           "emphasis"><em>removed completely</em></span> on clean.
                   6753:           The default is <code xmlns=
                   6754:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6755:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   6756:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6757:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   6758:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   6759:         </div>
                   6760: 
                   6761:         <div class="sect1" lang="en" xml:lang="en">
                   6762:           <div class="titlepage">
                   6763:             <div>
                   6764:               <div>
                   6765:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6766:                 "files-dir" id=
1.45      wiz      6767:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   6768:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6769:                 "filename">files/*</code></h2>
                   6770:               </div>
                   6771:             </div>
                   6772:           </div>
                   6773: 
                   6774:           <p>If you have any files that you wish to be placed in
                   6775:           the package prior to configuration or building, you could
                   6776:           place these files here and use a &#8220;<span class=
                   6777:           "quote">${CP}</span>&#8221; command in the
                   6778:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   6779:           target to achieve this. Alternatively, you could simply
1.45      wiz      6780:           diff the file against <code xmlns=
                   6781:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6782:           "filename">/dev/null</code> and use the patch mechanism
                   6783:           to manage the creation of this file.</p>
                   6784:         </div>
                   6785:       </div>
                   6786: 
                   6787:       <div class="chapter" lang="en" xml:lang="en">
                   6788:         <div class="titlepage">
                   6789:           <div>
                   6790:             <div>
                   6791:               <h2 class="title"><a name="makefile" id=
1.38      dillo    6792:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      6793:               <code xmlns=
                   6794:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6795:               "filename">Makefile</code>s</h2>
1.27      rillig   6796:             </div>
                   6797:           </div>
                   6798:         </div>
                   6799: 
                   6800:         <div class="toc">
                   6801:           <p><b>Table of Contents</b></p>
                   6802: 
                   6803:           <dl>
                   6804:             <dt><span class="sect1"><a href=
1.45      wiz      6805:             "#makefile.variables">9.1. <code xmlns=
                   6806:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6807:             "filename">Makefile</code> variables</a></span></dt>
                   6808: 
                   6809:             <dd>
                   6810:               <dl>
                   6811:                 <dt><span class="sect2"><a href=
1.38      dillo    6812:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6813:                 conventions</a></span></dt>
                   6814:               </dl>
                   6815:             </dd>
                   6816: 
1.38      dillo    6817:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   6818:             Code snippets</a></span></dt>
                   6819: 
                   6820:             <dd>
                   6821:               <dl>
1.30      wiz      6822:                 <dt><span class="sect2"><a href=
1.38      dillo    6823:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      6824:                 list</a></span></dt>
1.27      rillig   6825: 
1.30      wiz      6826:                 <dt><span class="sect2"><a href=
1.38      dillo    6827:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   6828:                 Converting an internal list into an external
                   6829:                 list</a></span></dt>
                   6830: 
1.30      wiz      6831:                 <dt><span class="sect2"><a href=
1.38      dillo    6832:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6833:                 variables to a shell command</a></span></dt>
1.27      rillig   6834: 
1.30      wiz      6835:                 <dt><span class="sect2"><a href=
1.38      dillo    6836:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      6837:                 guideline</a></span></dt>
1.27      rillig   6838: 
1.30      wiz      6839:                 <dt><span class="sect2"><a href=
1.38      dillo    6840:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      6841:                 bug in BSD Make</a></span></dt>
1.27      rillig   6842:               </dl>
                   6843:             </dd>
                   6844:           </dl>
                   6845:         </div>
                   6846: 
1.45      wiz      6847:         <p>Pkgsrc consists of many <code xmlns=
                   6848:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6849:         "filename">Makefile</code> fragments, each of which forms a
                   6850:         well-defined part of the pkgsrc system. Using the <a href=
                   6851:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6852:         <span class="citerefentry"><span class=
                   6853:         "refentrytitle">make</span>(1)</span></a> system as a
                   6854:         programming language for a big system like pkgsrc requires
                   6855:         some discipline to keep the code correct and
                   6856:         understandable.</p>
                   6857: 
1.45      wiz      6858:         <p>The basic ingredients for <code xmlns=
                   6859:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6860:         "filename">Makefile</code> programming are variables (which
                   6861:         are actually macros) and shell commands. Among these shell
                   6862:         commands may even be more complex ones like <a href=
                   6863:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   6864:         <span class="citerefentry"><span class=
                   6865:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   6866:         sure that every shell command runs as intended it is
                   6867:         necessary to quote all variables correctly when they are
                   6868:         used.</p>
                   6869: 
                   6870:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      6871:         often in <code xmlns=
                   6872:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   6873:         "filename">Makefile</code>s, including the pitfalls that
                   6874:         come along with them.</p>
1.27      rillig   6875: 
                   6876:         <div class="sect1" lang="en" xml:lang="en">
                   6877:           <div class="titlepage">
                   6878:             <div>
                   6879:               <div>
                   6880:                 <h2 class="title" style="clear: both"><a name=
                   6881:                 "makefile.variables" id=
1.45      wiz      6882:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   6883:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6884:                 "filename">Makefile</code> variables</h2>
                   6885:               </div>
                   6886:             </div>
                   6887:           </div>
                   6888: 
1.45      wiz      6889:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6890:           class="filename">Makefile</code> variables contain
                   6891:           strings that can be processed using the five operators
                   6892:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   6893:           described in the <a href=
1.27      rillig   6894:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6895:           <span class="citerefentry"><span class=
                   6896:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   6897: 
1.45      wiz      6898:           <p>When a variable's value is parsed from a <code xmlns=
                   6899:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6900:           "filename">Makefile</code>, the hash character ``#'' and
                   6901:           the backslash character ``\'' are handled specially. If a
                   6902:           backslash is followed by a newline, any whitespace
                   6903:           immediately in front of the backslash, the backslash, the
                   6904:           newline, and any whitespace immediately behind the
                   6905:           newline are replaced with a single space. A backspace
                   6906:           character and an immediately following hash character are
1.47      reed     6907:           replaced with a single hash character. Otherwise, the
1.27      rillig   6908:           backslash is passed as is. In a variable assignment, any
                   6909:           hash character that is not preceded by a backslash starts
                   6910:           a comment that continues upto the end of the logical
                   6911:           line.</p>
                   6912: 
                   6913:           <p><span class="emphasis"><em>Note:</em></span> Because
                   6914:           of this parsing algorithm the only way to create a
                   6915:           variable consisting of a single backslash is using the
                   6916:           ``!='' operator, for example: <code class=
                   6917:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   6918: 
                   6919:           <p>So far for defining variables. The other thing you can
                   6920:           do with variables is evaluating them. A variable is
                   6921:           evaluated when it is part of the right side of the ``:=''
                   6922:           or the ``!='' operator, or directly before executing a
                   6923:           shell command which the variable is part of. In all other
1.47      reed     6924:           cases, <a href=
1.27      rillig   6925:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6926:           <span class="citerefentry"><span class=
                   6927:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   6928:           evaluation, that is, variables are not evaluated until
                   6929:           there's no other way. The ``modifiers'' mentioned in the
                   6930:           man page also evaluate the variable.</p>
                   6931: 
                   6932:           <p>Some of the modifiers split the string into words and
                   6933:           then operate on the words, others operate on the string
1.47      reed     6934:           as a whole. When a string is split into words, it is
                   6935:           split as you would expect it from <a href=
1.27      rillig   6936:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   6937:           <span class="citerefentry"><span class=
                   6938:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   6939: 
                   6940:           <p>No rule without exception&#8212;the
                   6941:           <span><strong class="command">.for</strong></span> loop
                   6942:           does not follow the shell quoting rules but splits at
                   6943:           sequences of whitespace.</p>
                   6944: 
                   6945:           <p>There are several types of variables that should be
                   6946:           handled differently. Strings and two types of lists.</p>
                   6947: 
                   6948:           <div class="itemizedlist">
                   6949:             <ul type="disc">
                   6950:               <li>
                   6951:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     6952:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   6953:                 should restrict yourself to only using printable
                   6954:                 characters. Examples are <code class=
                   6955:                 "varname">PREFIX</code> and <code class=
                   6956:                 "varname">COMMENT</code>.</p>
                   6957:               </li>
                   6958: 
                   6959:               <li>
                   6960:                 <p><span class="emphasis"><em>Internal
                   6961:                 lists</em></span> are lists that are never exported
                   6962:                 to any shell command. Their elements are separated
1.47      reed     6963:                 by whitespace. Therefore, the elements themselves
1.27      rillig   6964:                 cannot have embedded whitespace. Any other
                   6965:                 characters are allowed. Internal lists can be used
                   6966:                 in <span><strong class=
                   6967:                 "command">.for</strong></span> loops. Examples are
                   6968:                 <code class="varname">DEPENDS</code> and
                   6969:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   6970:               </li>
                   6971: 
                   6972:               <li>
                   6973:                 <p><span class="emphasis"><em>External
                   6974:                 lists</em></span> are lists that may be exported to
                   6975:                 a shell command. Their elements can contain any
                   6976:                 characters, including whitespace. That's why they
                   6977:                 cannot be used in <span><strong class=
                   6978:                 "command">.for</strong></span> loops. Examples are
                   6979:                 <code class="varname">DISTFILES</code> and
                   6980:                 <code class="varname">MASTER_SITES</code>.</p>
                   6981:               </li>
                   6982:             </ul>
                   6983:           </div>
                   6984: 
                   6985:           <div class="sect2" lang="en" xml:lang="en">
                   6986:             <div class="titlepage">
                   6987:               <div>
                   6988:                 <div>
                   6989:                   <h3 class="title"><a name=
                   6990:                   "makefile.variables.names" id=
1.38      dillo    6991:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   6992:                   conventions</h3>
                   6993:                 </div>
                   6994:               </div>
                   6995:             </div>
                   6996: 
                   6997:             <div class="itemizedlist">
                   6998:               <ul type="disc">
                   6999:                 <li>
                   7000:                   <p>All variable names starting with an underscore
                   7001:                   are reserved for use by the pkgsrc
                   7002:                   infrastructure. They shall not be used by package
1.45      wiz      7003:                   <code xmlns=
                   7004:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7005:                   "filename">Makefile</code>s.</p>
1.27      rillig   7006:                 </li>
                   7007: 
                   7008:                 <li>
                   7009:                   <p>In <span><strong class=
                   7010:                   "command">.for</strong></span> loops you should
                   7011:                   use lowercase variable names for the iteration
                   7012:                   variables.</p>
                   7013:                 </li>
                   7014: 
                   7015:                 <li>
                   7016:                   <p>All list variables should have a ``plural''
                   7017:                   name, e.g. <code class=
                   7018:                   "varname">PKG_OPTIONS</code> or <code class=
                   7019:                   "varname">DISTFILES</code>.</p>
                   7020:                 </li>
                   7021:               </ul>
                   7022:             </div>
                   7023:           </div>
                   7024:         </div>
                   7025: 
                   7026:         <div class="sect1" lang="en" xml:lang="en">
                   7027:           <div class="titlepage">
                   7028:             <div>
                   7029:               <div>
                   7030:                 <h2 class="title" style="clear: both"><a name=
                   7031:                 "makefile.code" id=
1.38      dillo    7032:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7033:               </div>
                   7034:             </div>
                   7035:           </div>
                   7036: 
                   7037:           <p>This section presents you with some code snippets you
                   7038:           should use in your own code. If you don't find anything
                   7039:           appropriate here, you should test your code and add it
                   7040:           here.</p>
                   7041: 
                   7042:           <div class="sect2" lang="en" xml:lang="en">
                   7043:             <div class="titlepage">
                   7044:               <div>
                   7045:                 <div>
1.30      wiz      7046:                   <h3 class="title"><a name="adding-to-list" id=
1.38      dillo    7047:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7048:                   a list</h3>
1.27      rillig   7049:                 </div>
                   7050:               </div>
                   7051:             </div>
                   7052:             <pre class="programlisting">
                   7053: STRING=                 foo * bar `date`
                   7054: INT_LIST=               # empty
                   7055: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7056: EXT_LIST=               # empty
                   7057: ANOTHER_EXT_LIST=       a=b c=d
                   7058: 
                   7059: INT_LIST+=              ${STRING}               # 1
                   7060: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7061: EXT_LIST+=              ${STRING:Q}             # 3
                   7062: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
                   7063:       
                   7064: </pre>
                   7065: 
                   7066:             <p>When you add a string to an external list (example
                   7067:             3), it must be quoted. In all other cases, you must not
                   7068:             add a quoting level. You must not merge internal and
                   7069:             external lists, unless you are sure that all entries
                   7070:             are correctly interpreted in both lists.</p>
                   7071:           </div>
                   7072: 
                   7073:           <div class="sect2" lang="en" xml:lang="en">
                   7074:             <div class="titlepage">
                   7075:               <div>
                   7076:                 <div>
1.30      wiz      7077:                   <h3 class="title"><a name=
                   7078:                   "converting-internal-to-external" id=
1.38      dillo    7079:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7080:                   an internal list into an external list</h3>
1.27      rillig   7081:                 </div>
                   7082:               </div>
                   7083:             </div>
                   7084:             <pre class="programlisting">
                   7085: EXT_LIST=       # empty
                   7086: .for i in ${INT_LIST}
                   7087: EXT_LIST+=      ${i:Q}""
                   7088: .endfor
                   7089:       
                   7090: </pre>
                   7091: 
                   7092:             <p>This code converts the internal list <code class=
                   7093:             "varname">INT_LIST</code> into the external list
                   7094:             <code class="varname">EXT_LIST</code>. As the elements
                   7095:             of an internal list are unquoted they must be quoted
                   7096:             here. The reason for appending <code class=
                   7097:             "varname">""</code> is explained below.</p>
                   7098:           </div>
1.1       grant    7099: 
1.27      rillig   7100:           <div class="sect2" lang="en" xml:lang="en">
                   7101:             <div class="titlepage">
1.1       grant    7102:               <div>
1.27      rillig   7103:                 <div>
1.30      wiz      7104:                   <h3 class="title"><a name=
                   7105:                   "passing-variable-to-shell" id=
1.38      dillo    7106:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7107:                   variables to a shell command</h3>
1.27      rillig   7108:                 </div>
1.1       grant    7109:               </div>
                   7110:             </div>
1.27      rillig   7111:             <pre class="programlisting">
                   7112: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7113: EXT_LIST=       string=${STRING:Q} x=second\ item
                   7114: 
                   7115: all:
                   7116:         echo ${STRING}                  # 1
                   7117:         echo "${STRING}"                # 2
                   7118:         echo "${STRING:Q}"              # 3
                   7119:         echo ${STRING:Q}                # 4
                   7120:         echo x${STRING:Q} | sed 1s,.,,  # 5
                   7121:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
                   7122:       
                   7123: </pre>
                   7124: 
                   7125:             <p>Example 1 leads to a syntax error in the shell, as
                   7126:             the characters are just copied.</p>
                   7127: 
                   7128:             <p>Example 2 leads to a syntax error too, and if you
                   7129:             leave out the last " character from <code class=
                   7130:             "varname">${STRING}</code>, <a href=
                   7131:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7132:             <span class="citerefentry"><span class=
                   7133:             "refentrytitle">date</span>(1)</span></a> will be
                   7134:             executed. The <code class="varname">$HOME</code> shell
                   7135:             variable would be evaluated, too.</p>
                   7136: 
                   7137:             <p>Example 3 outputs each space character preceded by a
                   7138:             backslash (or not), depending on the implementation of
                   7139:             the <a href=
                   7140:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7141:             <span class="citerefentry"><span class=
                   7142:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7143: 
1.27      rillig   7144:             <p>Example 4 handles correctly every string that does
                   7145:             not start with a dash. In that case, the result depends
                   7146:             on the implementation of the <a href=
                   7147:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7148:             <span class="citerefentry"><span class=
                   7149:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7150:             long as you can guarantee that your input does not
1.47      reed     7151:             start with a dash, this form is appropriate.</p>
1.1       grant    7152: 
1.27      rillig   7153:             <p>Example 5 handles even the case of a leading dash
                   7154:             correctly.</p>
1.1       grant    7155: 
1.27      rillig   7156:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7157:             need to be quoted because the quoting has already been
1.27      rillig   7158:             done when adding elements to the list.</p>
1.1       grant    7159: 
1.27      rillig   7160:             <p>As internal lists shall not be passed to the shell,
                   7161:             there is no example for it.</p>
1.1       grant    7162:           </div>
                   7163: 
1.27      rillig   7164:           <div class="sect2" lang="en" xml:lang="en">
                   7165:             <div class="titlepage">
1.1       grant    7166:               <div>
1.27      rillig   7167:                 <div>
1.30      wiz      7168:                   <h3 class="title"><a name="quoting-guideline" id=
1.38      dillo    7169:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7170:                   guideline</h3>
                   7171:                 </div>
1.1       grant    7172:               </div>
                   7173:             </div>
                   7174: 
1.27      rillig   7175:             <p>There are many possible sources of wrongly quoted
                   7176:             variables. This section lists some of the commonly
                   7177:             known ones.</p>
1.1       grant    7178: 
1.27      rillig   7179:             <div class="itemizedlist">
                   7180:               <ul type="disc">
                   7181:                 <li>
                   7182:                   <p>Whenever you use the value of a list, think
                   7183:                   about what happens to leading or trailing
                   7184:                   whitespace. If the list is a well-formed shell
1.47      reed     7185:                   expression, you can apply the <code class=
1.27      rillig   7186:                   "varname">:M*</code> modifier to strip leading
                   7187:                   and trailing whitespace from each word. The
                   7188:                   <code class="varname">:M</code> operator first
                   7189:                   splits its argument according to the rules of the
                   7190:                   shell, and then creates a new list consisting of
                   7191:                   all words that match the shell glob expression
                   7192:                   <code class="varname">*</code>, that is: all. One
                   7193:                   class of situations where this is needed is when
                   7194:                   adding a variable like <code class=
                   7195:                   "varname">CPPFLAGS</code> to <code class=
                   7196:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7197:                   script invokes other configure scripts, it strips
1.27      rillig   7198:                   the leading and trailing whitespace from the
                   7199:                   variable and then passes it to the other
                   7200:                   configure scripts. But these configure scripts
                   7201:                   expect the (child) <code class=
                   7202:                   "varname">CPPFLAGS</code> variable to be the same
                   7203:                   as the parent <code class=
                   7204:                   "varname">CPPFLAGS</code>. That's why we better
                   7205:                   pass the <code class="varname">CPPFLAGS</code>
                   7206:                   value properly trimmed. And here is how we do
                   7207:                   it:</p>
                   7208:                   <pre class="programlisting">
                   7209: CPPFLAGS=               # empty
                   7210: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7211: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    7212: 
1.27      rillig   7213: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    7214: 
1.27      rillig   7215: all:
                   7216:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7217:         echo x${CONFIGURE_ARGS}x        # properly trimmed
                   7218:         
                   7219: </pre>
                   7220:                 </li>
1.1       grant    7221: 
1.27      rillig   7222:                 <li>
                   7223:                   <p>The example above contains one bug: The
                   7224:                   <code class="varname">${PREFIX}</code> is a
                   7225:                   properly quoted shell expression, but there is
                   7226:                   the C compiler after it, which also expects a
                   7227:                   properly quoted string (this time in C syntax).
                   7228:                   The version above is therefore only correct if
                   7229:                   <code class="varname">${PREFIX}</code> does not
                   7230:                   have embedded backslashes or double quotes. If
                   7231:                   you want to allow these, you have to add another
                   7232:                   layer of quoting to each variable that is used as
                   7233:                   a C string literal. You cannot use the
                   7234:                   <code class="varname">:Q</code> operator for it,
                   7235:                   as this operator only works for the shell.</p>
                   7236:                 </li>
1.1       grant    7237: 
1.27      rillig   7238:                 <li>
1.47      reed     7239:                   <p>Whenever a variable can be empty, the
1.27      rillig   7240:                   <code class="varname">:Q</code> operator can have
                   7241:                   surprising results. Here are two completely
                   7242:                   different cases which can be solved with the same
                   7243:                   trick.</p>
                   7244:                   <pre class="programlisting">
                   7245: EMPTY=                  # empty
                   7246: empty_test:
                   7247:         for i in a ${EMPTY:Q} c; do \
                   7248:                 echo "$$i"; \
                   7249:         done
                   7250: 
                   7251: for_test:
                   7252: .for i in a:\ a:\test.txt
                   7253:         echo ${i:Q}
                   7254:         echo "foo"
                   7255: .endfor
                   7256:         
1.1       grant    7257: </pre>
                   7258: 
1.27      rillig   7259:                   <p>The first example will only print two of the
                   7260:                   three lines we might have expected. This is
                   7261:                   because <code class="varname">${EMPTY:Q}</code>
                   7262:                   expands to the empty string, which the shell
                   7263:                   cannot see. The workaround is to write
                   7264:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7265:                   pattern can be often found as <code class=
                   7266:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7267:                   <code class="varname">${TEST} -f
                   7268:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7269: 
                   7270:                   <p>The second example will only print three lines
                   7271:                   instead of four. The first line looks like
                   7272:                   <code class="varname">a:\ echo foo</code>. This
                   7273:                   is because the backslash of the value
                   7274:                   <code class="varname">a:\</code> is interpreted
                   7275:                   as a line-continuation by <a href=
                   7276:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7277:                   <span class="citerefentry"><span class=
                   7278:                   "refentrytitle">make</span>(1)</span></a>, which
                   7279:                   makes the second line the arguments of the
                   7280:                   <a href=
                   7281:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7282:                   <span class="citerefentry"><span class=
                   7283:                   "refentrytitle">echo</span>(1)</span></a> command
                   7284:                   from the first line. To avoid this, write
                   7285:                   <code class="varname">${i:Q}""</code>.</p>
                   7286:                 </li>
                   7287:               </ul>
                   7288:             </div>
1.1       grant    7289:           </div>
                   7290: 
1.27      rillig   7291:           <div class="sect2" lang="en" xml:lang="en">
                   7292:             <div class="titlepage">
1.1       grant    7293:               <div>
1.27      rillig   7294:                 <div>
1.30      wiz      7295:                   <h3 class="title"><a name=
                   7296:                   "bsd-make-bug-workaround" id=
1.38      dillo    7297:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7298:                   for a bug in BSD Make</h3>
1.27      rillig   7299:                 </div>
1.1       grant    7300:               </div>
                   7301:             </div>
                   7302: 
1.27      rillig   7303:             <p>The pkgsrc bmake program does not handle the
                   7304:             following assignment correctly. In case <code class=
                   7305:             "varname">_othervar_</code> contains a ``-'' character,
                   7306:             one of the closing braces is included in <code class=
                   7307:             "varname">${VAR}</code> after this code executes.</p>
                   7308:             <pre class="programlisting">
                   7309:         VAR:= ${VAR:N${_othervar_:C/-//}}
                   7310:       
1.1       grant    7311: </pre>
                   7312: 
1.27      rillig   7313:             <p>For a more complex code snippet and a workaround,
                   7314:             see the package <a xmlns=
                   7315:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7316:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7317:             target="_top"><code xmlns="" class=
                   7318:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7319:             <code class="varname">bug1</code>.</p>
1.1       grant    7320:           </div>
                   7321:         </div>
                   7322:       </div>
                   7323: 
                   7324:       <div class="chapter" lang="en" xml:lang="en">
                   7325:         <div class="titlepage">
                   7326:           <div>
                   7327:             <div>
                   7328:               <h2 class="title"><a name="plist" id=
1.38      dillo    7329:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7330:             </div>
                   7331:           </div>
                   7332:         </div>
                   7333: 
                   7334:         <div class="toc">
                   7335:           <p><b>Table of Contents</b></p>
                   7336: 
                   7337:           <dl>
1.38      dillo    7338:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7339:             ID</a></span></dt>
                   7340: 
1.30      wiz      7341:             <dt><span class="sect1"><a href=
1.38      dillo    7342:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7343:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7344:             class="filename">PLIST</code>
1.14      xtraeme  7345:             generation</a></span></dt>
1.1       grant    7346: 
1.38      dillo    7347:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7348:             Tweaking output of <span><strong class="command">make
                   7349:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7350: 
1.38      dillo    7351:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7352:             Variable substitution in PLIST</a></span></dt>
                   7353: 
1.30      wiz      7354:             <dt><span class="sect1"><a href=
1.48      dillo    7355:             "#manpage-compression">10.5. Man page
                   7356:             compression</a></span></dt>
1.1       grant    7357: 
1.38      dillo    7358:             <dt><span class="sect1"><a href=
                   7359:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7360:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7361: 
1.30      wiz      7362:             <dt><span class="sect1"><a href=
1.47      reed     7363:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7364:             differing PLISTs</a></span></dt>
1.1       grant    7365: 
1.38      dillo    7366:             <dt><span class="sect1"><a href=
                   7367:             "#faq.common-dirs">10.8. Sharing directories between
                   7368:             packages</a></span></dt>
1.1       grant    7369:           </dl>
                   7370:         </div>
                   7371: 
1.45      wiz      7372:         <p>The <code xmlns=
                   7373:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7374:         "filename">PLIST</code> file contains a package's
                   7375:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7376:         a list of files that belong to the package (relative to the
                   7377:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7378:         class="filename">${PREFIX}</code> directory it's been
                   7379:         installed in) plus some additional statements - see the
                   7380:         <a href=
1.1       grant    7381:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7382:         <span class="citerefentry"><span class=
1.47      reed     7383:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7384:         for a full list. This chapter addresses some issues that
                   7385:         need attention when dealing with the <code xmlns=
1.45      wiz      7386:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7387:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7388: 
                   7389:         <div class="sect1" lang="en" xml:lang="en">
                   7390:           <div class="titlepage">
                   7391:             <div>
                   7392:               <div>
                   7393:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7394:                 "rcs-id" id="rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7395:               </div>
                   7396:             </div>
                   7397:           </div>
                   7398: 
                   7399:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7400:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7401:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7402:           <pre class="programlisting">
1.17      sketch   7403: @comment $NetBSD$
1.1       grant    7404: </pre>
                   7405:         </div>
                   7406: 
                   7407:         <div class="sect1" lang="en" xml:lang="en">
                   7408:           <div class="titlepage">
                   7409:             <div>
                   7410:               <div>
                   7411:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7412:                 "automatic-plist-generation" id=
1.38      dillo    7413:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7414:                 <code xmlns=
                   7415:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7416:                 "filename">PLIST</code> generation</h2>
1.1       grant    7417:               </div>
                   7418:             </div>
                   7419:           </div>
                   7420: 
1.14      xtraeme  7421:           <p>You can use the <span><strong class="command">make
                   7422:           print-PLIST</strong></span> command to output a PLIST
                   7423:           that matches any new files since the package was
                   7424:           extracted. See <a href="#build.helpful-targets" title=
1.38      dillo    7425:           "14.3.&nbsp;Other helpful targets">Section&nbsp;14.3,
1.1       grant    7426:           &#8220;Other helpful targets&#8221;</a> for more
                   7427:           information on this target.</p>
                   7428:         </div>
                   7429: 
                   7430:         <div class="sect1" lang="en" xml:lang="en">
                   7431:           <div class="titlepage">
                   7432:             <div>
                   7433:               <div>
                   7434:                 <h2 class="title" style="clear: both"><a name=
                   7435:                 "print-PLIST" id=
1.38      dillo    7436:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7437:                 <span><strong class="command">make
                   7438:                 print-PLIST</strong></span></h2>
1.1       grant    7439:               </div>
                   7440:             </div>
                   7441:           </div>
                   7442: 
                   7443:           <p>If you have used any of the *-dirs packages, as
                   7444:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7445:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7446:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7447:           you may have noticed that <span><strong class=
                   7448:           "command">make print-PLIST</strong></span> outputs a set
                   7449:           of <code class="varname">@comment</code>s instead of real
                   7450:           <code class="varname">@dirrm</code> lines. You can also
                   7451:           do this for specific directories and files, so that the
                   7452:           results of that command are very close to reality. This
                   7453:           helps <span class="emphasis"><em>a lot</em></span> during
                   7454:           the update of packages.</p>
                   7455: 
                   7456:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7457:           variable takes a set of AWK patterns and actions that are
                   7458:           used to filter the output of print-PLIST. You can
                   7459:           <span class="emphasis"><em>append</em></span> any chunk
                   7460:           of AWK scripting you like to it, but be careful with
1.1       grant    7461:           quoting.</p>
                   7462: 
1.45      wiz      7463:           <p>For example, to get all files inside the <code xmlns=
                   7464:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7465:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7466:           resulting PLIST:</p>
                   7467:           <pre class="programlisting">
                   7468:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   7469:     
                   7470: </pre>
                   7471: 
1.14      xtraeme  7472:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7473:           lines referring to a specific (shared) directory
1.14      xtraeme  7474:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7475:           <pre class="programlisting">
                   7476:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   7477:     
                   7478: </pre>
                   7479:         </div>
                   7480: 
                   7481:         <div class="sect1" lang="en" xml:lang="en">
                   7482:           <div class="titlepage">
                   7483:             <div>
                   7484:               <div>
                   7485:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7486:                 "plist.misc" id=
                   7487:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7488:                 in PLIST</h2>
1.1       grant    7489:               </div>
                   7490:             </div>
                   7491:           </div>
                   7492: 
                   7493:           <p>A number of variables are substituted automatically in
                   7494:           PLISTs when a package is installed on a system. This
                   7495:           includes the following variables:</p>
                   7496: 
                   7497:           <div class="variablelist">
                   7498:             <dl>
1.14      xtraeme  7499:               <dt><span class="term"><code class=
                   7500:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7501:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7502: 
                   7503:               <dd>
                   7504:                 <p>Some packages like emacs and perl embed
                   7505:                 information about which architecture they were
                   7506:                 built on into the pathnames where they install
1.47      reed     7507:                 their files. To handle this case, PLIST will be
1.1       grant    7508:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7509:                 &#8220;<span class="quote"><code class=
                   7510:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7511:                 be replaced by what <span><strong class=
                   7512:                 "command">uname -p</strong></span> gives. The same
                   7513:                 is done if the string <code class=
                   7514:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7515:                 PLIST somewhere - use this on packages that have
1.47      reed     7516:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7517: 
                   7518:                 <div class="note" style=
                   7519:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7520:                   <h3 class="title">Legacy note</h3>
                   7521: 
                   7522:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7523:                   "quote"><code class=
                   7524:                   "varname">$ARCH</code></span>&#8221; that was
                   7525:                   replaced by the output of <span><strong class=
                   7526:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7527:                   longer supported and has been removed.</p>
                   7528:                 </div>
                   7529:               </dd>
                   7530: 
1.14      xtraeme  7531:               <dt><span class="term"><code class=
                   7532:               "varname">${OPSYS}</code>, <code class=
                   7533:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7534:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7535: 
                   7536:               <dd>
                   7537:                 <p>Some packages want to embed the OS name and
                   7538:                 version into some paths. To do this, use these
1.45      wiz      7539:                 variables in the <code xmlns=
                   7540:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7541:                 "filename">PLIST</code>:</p>
1.1       grant    7542: 
                   7543:                 <div class="itemizedlist">
                   7544:                   <ul type="disc">
                   7545:                     <li>
1.14      xtraeme  7546:                       <p><code class="varname">${OPSYS}</code> -
                   7547:                       output of &#8220;<span class=
                   7548:                       "quote"><span><strong class="command">uname
                   7549:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7550:                     </li>
                   7551: 
                   7552:                     <li>
1.14      xtraeme  7553:                       <p><code class=
                   7554:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7555:                       common name (eg. &#8220;<span class=
                   7556:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7557:                     </li>
                   7558: 
                   7559:                     <li>
1.14      xtraeme  7560:                       <p><code class="varname">${OS_VERSION}</code>
                   7561:                       - &#8220;<span class=
                   7562:                       "quote"><span><strong class="command">uname
                   7563:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7564:                     </li>
                   7565:                   </ul>
                   7566:                 </div>
                   7567:               </dd>
                   7568: 
1.14      xtraeme  7569:               <dt><span class="term"><code class=
                   7570:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7571: 
                   7572:               <dd>
                   7573:                 <p>Packages that install locale files should list
                   7574:                 them in the PLIST as &#8220;<span class=
                   7575:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7576:                 instead of &#8220;<span class=
                   7577:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7578:                 This properly handles the fact that different
                   7579:                 operating systems expect locale files to be either
1.45      wiz      7580:                 in <code xmlns=
                   7581:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7582:                 "filename">share</code> or <code xmlns=
                   7583:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7584:                 "filename">lib</code> by default.</p>
1.1       grant    7585:               </dd>
                   7586:             </dl>
                   7587:           </div>
                   7588: 
                   7589:           <p>For a complete list of values which are replaced by
1.45      wiz      7590:           default, please look in <code xmlns=
                   7591:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7592:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    7593:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   7594: 
                   7595:           <p>If you want to change other variables not listed
                   7596:           above, you can add variables and their expansions to this
1.14      xtraeme  7597:           variable in the following way, similar to <code class=
                   7598:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    7599:           "#components.optional" title=
1.38      dillo    7600:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    7601:           &#8220;Optional files&#8221;</a>):</p>
                   7602:           <pre class="programlisting">
                   7603: PLIST_SUBST+=    SOMEVAR="somevalue"
                   7604: </pre>
                   7605: 
                   7606:           <p>This replaces all occurrences of &#8220;<span class=
                   7607:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   7608:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   7609:         </div>
                   7610: 
                   7611:         <div class="sect1" lang="en" xml:lang="en">
                   7612:           <div class="titlepage">
                   7613:             <div>
                   7614:               <div>
                   7615:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7616:                 "manpage-compression" id=
1.48      dillo    7617:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   7618:                 compression</h2>
1.1       grant    7619:               </div>
                   7620:             </div>
                   7621:           </div>
                   7622: 
1.47      reed     7623:           <p>Man pages should be installed in compressed form if
1.45      wiz      7624:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   7625:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7626:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      7627:           otherwise. To handle this in the <code xmlns=
                   7628:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7629:           "filename">PLIST</code> file, the suffix
                   7630:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     7631:           appended/removed automatically for man pages according to
1.14      xtraeme  7632:           <code class="varname">MANZ</code> and <code class=
                   7633:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      7634:           above for details. This modification of the <code xmlns=
                   7635:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7636:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      7637:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7638:           class="filename">PLIST</code> itself.</p>
1.1       grant    7639:         </div>
                   7640: 
                   7641:         <div class="sect1" lang="en" xml:lang="en">
                   7642:           <div class="titlepage">
                   7643:             <div>
                   7644:               <div>
                   7645:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7646:                 "using-PLIST_SRC" id=
1.38      dillo    7647:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      7648:                 source with <code class=
1.14      xtraeme  7649:                 "varname">PLIST_SRC</code></h2>
1.1       grant    7650:               </div>
                   7651:             </div>
                   7652:           </div>
                   7653: 
1.14      xtraeme  7654:           <p>To use one or more files as source for the
1.45      wiz      7655:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7656:           class="filename">PLIST</code> used in generating the
                   7657:           binary package, set the variable <code class=
1.14      xtraeme  7658:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      7659:           The files are later concatenated using <a href=
                   7660:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   7661:           <span class="citerefentry"><span class=
                   7662:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   7663:           things is important.</p>
1.1       grant    7664:         </div>
                   7665: 
                   7666:         <div class="sect1" lang="en" xml:lang="en">
                   7667:           <div class="titlepage">
                   7668:             <div>
                   7669:               <div>
                   7670:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7671:                 "platform-specific-plist" id=
1.47      reed     7672:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   7673:                 and differing PLISTs</h2>
1.1       grant    7674:               </div>
                   7675:             </div>
                   7676:           </div>
                   7677: 
                   7678:           <p>Some packages decide to install a different set of
                   7679:           files based on the operating system being used. These
                   7680:           differences can be automatically handled by using the
                   7681:           following files:</p>
                   7682: 
                   7683:           <div class="itemizedlist">
                   7684:             <ul type="disc">
                   7685:               <li>
1.45      wiz      7686:                 <p><code xmlns=
                   7687:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7688:                 "filename">PLIST.common</code></p>
1.1       grant    7689:               </li>
                   7690: 
                   7691:               <li>
1.45      wiz      7692:                 <p><code xmlns=
                   7693:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7694:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    7695:               </li>
                   7696: 
                   7697:               <li>
1.45      wiz      7698:                 <p><code xmlns=
                   7699:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7700:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   7701:               </li>
                   7702: 
                   7703:               <li>
1.45      wiz      7704:                 <p><code xmlns=
                   7705:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7706:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   7707:               </li>
                   7708: 
                   7709:               <li>
1.45      wiz      7710:                 <p><code xmlns=
                   7711:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7712:                 "filename">PLIST.common_end</code></p>
1.1       grant    7713:               </li>
                   7714:             </ul>
                   7715:           </div>
                   7716:         </div>
                   7717: 
                   7718:         <div class="sect1" lang="en" xml:lang="en">
                   7719:           <div class="titlepage">
                   7720:             <div>
                   7721:               <div>
                   7722:                 <h2 class="title" style="clear: both"><a name=
                   7723:                 "faq.common-dirs" id=
1.38      dillo    7724:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   7725:                 directories between packages</h2>
1.1       grant    7726:               </div>
                   7727:             </div>
                   7728:           </div>
                   7729: 
                   7730:           <p>A &#8220;<span class="quote">shared
                   7731:           directory</span>&#8221; is a directory where multiple
                   7732:           (and unrelated) packages install files. These directories
                   7733:           are problematic because you have to add special tricks in
                   7734:           the PLIST to conditionally remove them, or have some
                   7735:           centralized package handle them.</p>
                   7736: 
                   7737:           <p>Within pkgsrc, you'll find both approaches. If a
                   7738:           directory is shared by a few unrelated packages, it's
                   7739:           often not worth to add an extra package to remove it.
                   7740:           Therefore, one simply does:</p>
                   7741:           <pre class="programlisting">
                   7742:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   7743:     
                   7744: </pre>
                   7745: 
                   7746:           <p>in the PLISTs of all affected packages, instead of the
                   7747:           regular "@dirrm" line.</p>
                   7748: 
                   7749:           <p>However, if the directory is shared across many
                   7750:           packages, two different solutions are available:</p>
                   7751: 
                   7752:           <div class="orderedlist">
                   7753:             <ol type="1">
                   7754:               <li>
                   7755:                 <p>If the packages have a common dependency, the
                   7756:                 directory can be removed in that. For example, see
                   7757:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7758:                 href=
                   7759:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      7760:                 target="_top"><code xmlns="" class=
                   7761:                 "filename">textproc/scrollkeeper</code></a>, which
                   7762:                 removes the shared directory <code xmlns=
                   7763:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      7764:                 "filename">share/omf</code>.</p>
1.1       grant    7765:               </li>
                   7766: 
                   7767:               <li>
                   7768:                 <p>If the packages using the directory are not
                   7769:                 related at all (they have no common dependencies),
                   7770:                 a *-dirs package is used.</p>
                   7771:               </li>
                   7772:             </ol>
                   7773:           </div>
                   7774: 
                   7775:           <p>From now on, we'll discuss the second solution. To get
                   7776:           an idea of the *-dirs packages available, issue:</p>
                   7777:           <pre class="programlisting">
1.14      xtraeme  7778:       <code class="prompt">%</code> cd .../pkgsrc
                   7779:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    7780:     
                   7781: </pre>
                   7782: 
                   7783:           <p>Their use from other packages is very simple. The
1.14      xtraeme  7784:           <code class="varname">USE_DIRS</code> variable takes a
                   7785:           list of package names (without the &#8220;<span class=
1.1       grant    7786:           "quote">-dirs</span>&#8221; part) together with the
                   7787:           required version number (always pick the latest one when
1.34      wiz      7788:           writing new packages).</p>
1.1       grant    7789: 
                   7790:           <p>For example, if a package installs files under
1.45      wiz      7791:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7792:           class="filename">share/applications</code>, it should
                   7793:           have the following line in it:</p>
1.1       grant    7794:           <pre class="programlisting">
                   7795:       USE_DIRS+= xdg-1.1
                   7796:     
                   7797: </pre>
                   7798: 
1.14      xtraeme  7799:           <p>After regenerating the PLIST using
                   7800:           <span><strong class="command">make
                   7801:           print-PLIST</strong></span>, you should get the right
                   7802:           (commented out) lines.</p>
1.1       grant    7803: 
1.47      reed     7804:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      7805:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7806:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    7807:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      7808:           part and pkgsrc (in particular, <code xmlns=
                   7809:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7810:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    7811:         </div>
                   7812:       </div>
                   7813: 
                   7814:       <div class="chapter" lang="en" xml:lang="en">
                   7815:         <div class="titlepage">
                   7816:           <div>
                   7817:             <div>
                   7818:               <h2 class="title"><a name="buildlink" id=
1.38      dillo    7819:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    7820:               methodology</h2>
                   7821:             </div>
                   7822:           </div>
                   7823:         </div>
                   7824: 
                   7825:         <div class="toc">
                   7826:           <p><b>Table of Contents</b></p>
                   7827: 
                   7828:           <dl>
1.30      wiz      7829:             <dt><span class="sect1"><a href=
1.38      dillo    7830:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      7831:             to use buildlink3</a></span></dt>
1.1       grant    7832: 
1.30      wiz      7833:             <dt><span class="sect1"><a href=
1.45      wiz      7834:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   7835:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      7836:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    7837: 
                   7838:             <dd>
                   7839:               <dl>
1.25      rillig   7840:                 <dt><span class="sect2"><a href=
1.38      dillo    7841:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      7842:                 buildlink3.mk file</a></span></dt>
1.1       grant    7843: 
1.25      rillig   7844:                 <dt><span class="sect2"><a href=
1.38      dillo    7845:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      7846:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  7847:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      7848:                 <code xmlns=
                   7849:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7850:                 "filename">buildlink3.mk</code>
1.1       grant    7851:                 files</a></span></dt>
                   7852:               </dl>
                   7853:             </dd>
                   7854: 
1.30      wiz      7855:             <dt><span class="sect1"><a href=
1.45      wiz      7856:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   7857:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      7858:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    7859: 
                   7860:             <dd>
                   7861:               <dl>
1.25      rillig   7862:                 <dt><span class="sect2"><a href=
1.38      dillo    7863:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      7864:                 <code xmlns=
                   7865:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7866:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    7867: 
1.25      rillig   7868:                 <dt><span class="sect2"><a href=
1.38      dillo    7869:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      7870:                 preferences for native or pkgsrc
                   7871:                 software</a></span></dt>
1.1       grant    7872:               </dl>
                   7873:             </dd>
                   7874:           </dl>
                   7875:         </div>
                   7876: 
                   7877:         <p>Buildlink is a framework in pkgsrc that controls what
                   7878:         headers and libraries are seen by a package's configure and
                   7879:         build processes. This is implemented in a two step
                   7880:         process:</p>
                   7881: 
                   7882:         <div class="orderedlist">
                   7883:           <ol type="1">
                   7884:             <li>
                   7885:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  7886:               into <code class="varname">BUILDLINK_DIR</code>,
                   7887:               which by default is a subdirectory of <code class=
                   7888:               "varname">WRKDIR</code>.</p>
1.1       grant    7889:             </li>
                   7890: 
                   7891:             <li>
                   7892:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  7893:               the normal compiler tools that translate <code class=
                   7894:               "option">-I${LOCALBASE}/include</code> and
                   7895:               <code class="option">-L${LOCALBASE}/lib</code> into
                   7896:               references to <code class=
                   7897:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   7898:               also make native compiler on some operating systems
                   7899:               look like GCC, so that packages that expect GCC won't
                   7900:               require modifications to build with those native
                   7901:               compilers.</p>
1.1       grant    7902:             </li>
                   7903:           </ol>
                   7904:         </div>
                   7905: 
                   7906:         <p>This normalizes the environment in which a package is
                   7907:         built so that the package may be built consistently despite
                   7908:         what other software may be installed. Please note that the
1.45      wiz      7909:         normal system header and library paths, e.g. <code xmlns=
                   7910:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7911:         "filename">/usr/include</code>, <code xmlns=
                   7912:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7913:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    7914:         buildlink3 is designed to insulate the package build from
                   7915:         non-system-supplied software.</p>
                   7916: 
                   7917:         <div class="sect1" lang="en" xml:lang="en">
                   7918:           <div class="titlepage">
                   7919:             <div>
                   7920:               <div>
                   7921:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7922:                 "converting-to-buildlink3" id=
1.38      dillo    7923:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      7924:                 packages to use buildlink3</h2>
1.1       grant    7925:               </div>
                   7926:             </div>
                   7927:           </div>
                   7928: 
                   7929:           <p>The process of converting packages to use the
                   7930:           buildlink3 framework (&#8220;<span class=
                   7931:           "quote">bl3ifying</span>&#8221;) is fairly
                   7932:           straightforward. The things to keep in mind are:</p>
                   7933: 
                   7934:           <div class="orderedlist">
                   7935:             <ol type="1">
                   7936:               <li>
                   7937:                 <p>Ensure that the build always calls the wrapper
                   7938:                 scripts instead of the actual toolchain. Some
                   7939:                 packages are tricky, and the only way to know for
1.45      wiz      7940:                 sure is the check <code xmlns=
                   7941:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7942:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    7943:                 wrappers are being invoked.</p>
                   7944:               </li>
                   7945: 
                   7946:               <li>
1.14      xtraeme  7947:                 <p>Don't override <code class=
                   7948:                 "varname">PREFIX</code> from within the package
                   7949:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      7950:                 because the code to symlink files into <code xmlns=
                   7951:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7952:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    7953:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  7954:                 <em class=
                   7955:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    7956:               </li>
                   7957: 
                   7958:               <li>
                   7959:                 <p>Remember that <span class=
1.45      wiz      7960:                 "emphasis"><em>only</em></span> the <code xmlns=
                   7961:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7962:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    7963:                 in a package's Makefile are added as dependencies
                   7964:                 for that package.</p>
                   7965:               </li>
                   7966:             </ol>
                   7967:           </div>
                   7968: 
                   7969:           <p>If a dependency on a particular package is required
                   7970:           for its libraries and headers, then we replace:</p>
                   7971:           <pre class="programlisting">
1.27      rillig   7972: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    7973: </pre>
                   7974: 
                   7975:           <p>with</p>
                   7976:           <pre class="programlisting">
                   7977: .include "../../category/foo/buildlink3.mk"
                   7978: </pre>
                   7979: 
1.47      reed     7980:           <p>The buildlink3.mk files usually define the required
                   7981:           dependencies. If you need a newer version of the
                   7982:           dependency when using buildlink3.mk files, then you can
                   7983:           define it in your Makefile; for example:</p>
                   7984:           <pre class="programlisting">
                   7985: BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   7986: .include "../../category/foo/buildlink3.mk"
                   7987: </pre>
                   7988: 
1.45      wiz      7989:           <p>There are several <code xmlns=
                   7990:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7991:           "filename">buildlink3.mk</code> files in <code xmlns=
                   7992:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7993:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    7994:           issues:</p>
                   7995: 
                   7996:           <div class="itemizedlist">
                   7997:             <ul type="disc">
                   7998:               <li>
1.45      wiz      7999:                 <p><code xmlns=
                   8000:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8001:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8002:                 the native or a pkgsrc Berkeley DB implementation
                   8003:                 based on the values of <code class=
1.14      xtraeme  8004:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8005:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8006:               </li>
                   8007: 
                   8008:               <li>
1.45      wiz      8009:                 <p><code xmlns=
                   8010:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8011:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8012:                 system comes with neither Curses nor NCurses, this
                   8013:                 will take care to install the <a xmlns=
                   8014:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8015:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8016:                 target="_top"><code xmlns="" class=
                   8017:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8018:               </li>
                   8019: 
                   8020:               <li>
1.45      wiz      8021:                 <p><code xmlns=
                   8022:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8023:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8024:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8025:                 choose between adding a dependency on Heimdal or
                   8026:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8027:                 implementation.</p>
                   8028:               </li>
                   8029: 
                   8030:               <li>
1.45      wiz      8031:                 <p><code xmlns=
                   8032:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8033:                 "filename">motif.buildlink3.mk</code> checks for a
                   8034:                 system-provided Motif installation or adds a
                   8035:                 dependency on <a xmlns=
1.1       grant    8036:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8037:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8038:                 target="_top"><code xmlns="" class=
                   8039:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8040:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8041:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8042:                 target="_top"><code xmlns="" class=
1.47      reed     8043:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8044:               </li>
                   8045: 
                   8046:               <li>
1.45      wiz      8047:                 <p><code xmlns=
                   8048:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8049:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8050:                 several variables that may be used by packages that
1.47      reed     8051:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8052:               </li>
                   8053: 
                   8054:               <li>
1.45      wiz      8055:                 <p><code xmlns=
                   8056:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8057:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8058:                 either Postgres 7.3 or 7.4, whichever is found
                   8059:                 installed. See the file for more information.</p>
1.1       grant    8060:               </li>
                   8061: 
                   8062:               <li>
1.45      wiz      8063:                 <p><code xmlns=
                   8064:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8065:                 "filename">pthread.buildlink3.mk</code> uses the
                   8066:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8067:                 and checks for native pthreads or adds a dependency
                   8068:                 on <a xmlns=
1.1       grant    8069:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8070:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8071:                 target="_top"><code xmlns="" class=
1.47      reed     8072:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8073:               </li>
                   8074: 
                   8075:               <li>
1.45      wiz      8076:                 <p><code xmlns=
                   8077:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8078:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8079:                 of <code class="varname">XAW_TYPE</code> to choose
                   8080:                 a particular Athena widgets library.</p>
1.1       grant    8081:               </li>
                   8082:             </ul>
                   8083:           </div>
                   8084: 
1.45      wiz      8085:           <p>The comments in those <code xmlns=
                   8086:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8087:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8088:           complete description of how to use them properly.</p>
                   8089:         </div>
                   8090: 
                   8091:         <div class="sect1" lang="en" xml:lang="en">
                   8092:           <div class="titlepage">
                   8093:             <div>
                   8094:               <div>
                   8095:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      8096:                 "creating-buildlink3.mk" id=
1.38      dillo    8097:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8098:                 <code xmlns=
                   8099:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8100:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8101:               </div>
                   8102:             </div>
                   8103:           </div>
                   8104: 
1.45      wiz      8105:           <p>A package's <code xmlns=
                   8106:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8107:           "filename">buildlink3.mk</code> file is included by
                   8108:           Makefiles to indicate the need to compile and link
                   8109:           against header files and libraries provided by the
1.45      wiz      8110:           package. A <code xmlns=
                   8111:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8112:           "filename">buildlink3.mk</code> file should always
                   8113:           provide enough information to add the correct type of
                   8114:           dependency relationship and include any other
                   8115:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8116:           class="filename">buildlink3.mk</code> files that it needs
                   8117:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8118: 
1.45      wiz      8119:           <p>To generate an initial <code xmlns=
                   8120:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8121:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8122:           Rene Hexel's <a xmlns=
                   8123:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8124:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8125:           target="_top"><code xmlns="" class=
                   8126:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8127:           highly recommended. For most packages, the following
                   8128:           command will generate a good starting point for
1.45      wiz      8129:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8130:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8131:           <pre class="screen">
1.14      xtraeme  8132: <code class="prompt">%</code> <strong class=
                   8133: "userinput"><code>cd pkgsrc/<em class=
                   8134: "replaceable"><code>category</code></em>/<em class=
                   8135: "replaceable"><code>pkgdir</code></em>
                   8136: <code class=
1.49      rillig   8137: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8138: </pre>
                   8139: 
                   8140:           <div class="sect2" lang="en" xml:lang="en">
                   8141:             <div class="titlepage">
                   8142:               <div>
                   8143:                 <div>
1.30      wiz      8144:                   <h3 class="title"><a name="anatomy-of-bl3" id=
1.38      dillo    8145:                   "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25      rillig   8146:                   buildlink3.mk file</h3>
1.1       grant    8147:                 </div>
                   8148:               </div>
                   8149:             </div>
                   8150: 
1.45      wiz      8151:             <p>The following real-life example <code xmlns=
                   8152:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8153:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8154:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8155:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8156:             <pre class="programlisting">
1.17      sketch   8157: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8158: 
                   8159: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8160: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   8161: 
                   8162: .if !empty(BUILDLINK_DEPTH:M+)
                   8163: BUILDLINK_DEPENDS+=     tiff
                   8164: .endif
                   8165: 
                   8166: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8167: BUILDLINK_PACKAGES+=    tiff
                   8168: 
                   8169: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8170: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8171: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8172: .endif  # TIFF_BUILDLINK3_MK
                   8173: 
                   8174: .include "../../devel/zlib/buildlink3.mk"
                   8175: .include "../../graphics/jpeg/buildlink3.mk"
                   8176: 
                   8177: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   8178: </pre>
                   8179: 
1.14      xtraeme  8180:             <p>The header and footer manipulate <code class=
                   8181:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8182:             across all <code xmlns=
                   8183:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8184:             "filename">buildlink3.mk</code> files and is used to
                   8185:             track at what depth we are including <code xmlns=
                   8186:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8187:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8188: 
                   8189:             <p>The first section controls if the dependency on
1.14      xtraeme  8190:             <em class="replaceable"><code>pkg</code></em> is added.
                   8191:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8192:             global list of packages for which dependencies are
                   8193:             added by buildlink3.</p>
                   8194: 
                   8195:             <p>The second section advises pkgsrc that the
1.45      wiz      8196:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8197:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8198:             <em class="replaceable"><code>pkg</code></em> has been
                   8199:             included at some point. <code class=
                   8200:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8201:             of packages for which <code xmlns=
                   8202:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8203:             "filename">buildlink3.mk</code> files have been
                   8204:             included. It must <span class=
                   8205:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8206:             a <code xmlns=
                   8207:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8208:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8209: 
                   8210:             <p>The third section is protected from multiple
1.14      xtraeme  8211:             inclusion and controls how the dependency on <em class=
                   8212:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8213:             important variables are set in the section:</p>
                   8214: 
                   8215:             <div class="itemizedlist">
                   8216:               <ul type="disc">
                   8217:                 <li>
1.14      xtraeme  8218:                   <p><code class=
                   8219:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8220:                   "replaceable"><code>pkg</code></em></code> is the
                   8221:                   actual dependency recorded in the installed
                   8222:                   package; this should always be set using
                   8223:                   <span><strong class="command">+=</strong></span>
                   8224:                   to ensure that we're appending to any
                   8225:                   pre-existing list of values. This variable should
                   8226:                   be set to the first version of the package that
                   8227:                   had the last change in the major number of a
                   8228:                   shared library or that had a major API
                   8229:                   change.</p>
1.1       grant    8230:                 </li>
                   8231: 
                   8232:                 <li>
1.14      xtraeme  8233:                   <p><code class=
                   8234:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8235:                   "replaceable"><code>pkg</code></em></code> is the
                   8236:                   location of the <em class=
                   8237:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8238:                   directory.</p>
1.1       grant    8239:                 </li>
                   8240: 
                   8241:                 <li>
1.14      xtraeme  8242:                   <p><code class=
                   8243:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8244:                   "replaceable"><code>pkg</code></em></code> (not
                   8245:                   shown above) controls whether we use <code class=
                   8246:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8247:                   "varname">DEPENDS</code> to add the dependency on
                   8248:                   <em class="replaceable"><code>pkg</code></em>.
                   8249:                   The build dependency is selected by setting
                   8250:                   <code class=
                   8251:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8252:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8253:                   &#8220;<span class="quote">build</span>&#8221;.
                   8254:                   By default, the full dependency is used.</p>
                   8255:                 </li>
                   8256: 
                   8257:                 <li>
1.14      xtraeme  8258:                   <p><code class=
                   8259:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8260:                   "replaceable"><code>pkg</code></em></code> and
                   8261:                   <code class=
                   8262:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   8263:                   <code>pkg</code></em></code> (not shown above)
1.45      wiz      8264:                   are lists of subdirectories of <code xmlns=
                   8265:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8266:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8267:                   "replaceable"><code>pkg</code></em>}</code> to
                   8268:                   add to the header and library search paths. These
1.1       grant    8269:                   default to &#8220;<span class=
                   8270:                   "quote">include</span>&#8221; and
                   8271:                   &#8220;<span class="quote">lib</span>&#8221;
                   8272:                   respectively.</p>
                   8273:                 </li>
                   8274: 
                   8275:                 <li>
1.14      xtraeme  8276:                   <p><code class=
                   8277:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8278:                   "replaceable"><code>pkg</code></em></code> (not
                   8279:                   shown above) is the list of preprocessor flags to
                   8280:                   add to <code class="varname">CPPFLAGS</code>,
                   8281:                   which are passed on to the configure and build
                   8282:                   phases. The &#8220;<span class=
                   8283:                   "quote">-I</span>&#8221; option should be avoided
                   8284:                   and instead be handled using <code class=
                   8285:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8286:                   "replaceable"><code>pkg</code></em></code> as
                   8287:                   above.</p>
1.1       grant    8288:                 </li>
                   8289:               </ul>
                   8290:             </div>
                   8291: 
                   8292:             <p>The following variables are all optionally defined
                   8293:             within this second section (protected against multiple
                   8294:             inclusion) and control which package files are
1.45      wiz      8295:             symlinked into <code xmlns=
                   8296:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8297:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8298:             are transformed during the symlinking:</p>
                   8299: 
                   8300:             <div class="itemizedlist">
                   8301:               <ul type="disc">
                   8302:                 <li>
1.14      xtraeme  8303:                   <p><code class=
                   8304:                   "varname">BUILDLINK_FILES.<em class=
                   8305:                   "replaceable"><code>pkg</code></em></code> (not
                   8306:                   shown above) is a shell glob pattern relative to
1.45      wiz      8307:                   <code xmlns=
                   8308:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8309:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8310:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8311:                   symlinked into <code xmlns=
                   8312:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8313:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8314:                   <code xmlns=
                   8315:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8316:                   "filename">include/*.h</code>.</p>
1.1       grant    8317:                 </li>
                   8318: 
                   8319:                 <li>
1.14      xtraeme  8320:                   <p><code class=
                   8321:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8322:                   "replaceable"><code>pkg</code></em></code> (not
                   8323:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8324:                   stdout a list of files relative to <code xmlns=
                   8325:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8326:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8327:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8328:                   resulting files are to be symlinked into
1.45      wiz      8329:                   <code xmlns=
                   8330:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8331:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8332:                   this takes the <code xmlns=
                   8333:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8334:                   "filename">+CONTENTS</code> of a <em class=
                   8335:                   "replaceable"><code>pkg</code></em> and filters
                   8336:                   it through <code class=
                   8337:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8338:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8339:                 </li>
                   8340: 
                   8341:                 <li>
1.14      xtraeme  8342:                   <p><code class=
                   8343:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8344:                   "replaceable"><code>pkg</code></em></code> (not
                   8345:                   shown above) is a filter command that filters
1.45      wiz      8346:                   <code xmlns=
                   8347:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8348:                   "filename">+CONTENTS</code> input into a list of
                   8349:                   files relative to <code xmlns=
                   8350:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8351:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8352:                   "replaceable"><code>pkg</code></em>}</code> on
                   8353:                   stdout. By default for overwrite packages,
                   8354:                   <code class=
                   8355:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8356:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8357:                   outputs the contents of the <code xmlns=
                   8358:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8359:                   "filename">include</code> and <code xmlns=
                   8360:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8361:                   "filename">lib</code> directories in the package
1.45      wiz      8362:                   <code xmlns=
                   8363:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8364:                   "filename">+CONTENTS</code>, and for pkgviews
                   8365:                   packages, it outputs any libtool archives in
                   8366:                   <code xmlns=
                   8367:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8368:                   "filename">lib</code> directories.</p>
1.1       grant    8369:                 </li>
                   8370: 
                   8371:                 <li>
1.14      xtraeme  8372:                   <p><code class=
                   8373:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8374:                   "replaceable"><code>pkg</code></em></code> (not
                   8375:                   shown above) is a list of sed arguments used to
1.1       grant    8376:                   transform the name of the source filename into a
1.14      xtraeme  8377:                   destination filename, e.g. <span><strong class=
1.1       grant    8378:                   "command">-e
1.14      xtraeme  8379:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8380:                 </li>
                   8381:               </ul>
                   8382:             </div>
                   8383: 
1.45      wiz      8384:             <p>The last section includes any <code xmlns=
                   8385:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8386:             "filename">buildlink3.mk</code> needed for <em class=
                   8387:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8388:             dependencies. Including these <code xmlns=
                   8389:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8390:             "filename">buildlink3.mk</code> files means that the
                   8391:             headers and libraries for these dependencies are also
1.45      wiz      8392:             symlinked into <code xmlns=
                   8393:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8394:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8395:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8396:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8397:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8398:             included.</p>
1.1       grant    8399:           </div>
                   8400: 
                   8401:           <div class="sect2" lang="en" xml:lang="en">
                   8402:             <div class="titlepage">
                   8403:               <div>
                   8404:                 <div>
1.30      wiz      8405:                   <h3 class="title"><a name=
                   8406:                   "updating-buildlink-depends" id=
1.38      dillo    8407:                   "updating-buildlink-depends"></a>11.2.2. Updating
1.30      wiz      8408:                   <code class=
                   8409:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45      wiz      8410:                   <code>pkg</code></em></code> in <code xmlns=
                   8411:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8412:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8413:                 </div>
                   8414:               </div>
                   8415:             </div>
                   8416: 
                   8417:             <p>There are two situations that require increasing the
1.14      xtraeme  8418:             dependency listed in <code class=
                   8419:             "varname">BUILDLINK_DEPENDS.<em class=
                   8420:             "replaceable"><code>pkg</code></em></code> after a
                   8421:             package update:</p>
1.1       grant    8422: 
                   8423:             <div class="orderedlist">
                   8424:               <ol type="1">
                   8425:                 <li>
                   8426:                   <p>if the sonames (major number of the library
                   8427:                   version) of any installed shared libraries
1.47      reed     8428:                   change.</p>
1.1       grant    8429:                 </li>
                   8430: 
                   8431:                 <li>
                   8432:                   <p>if the API or interface to the header files
                   8433:                   change.</p>
                   8434:                 </li>
                   8435:               </ol>
                   8436:             </div>
                   8437: 
1.14      xtraeme  8438:             <p>In these cases, <code class=
                   8439:             "varname">BUILDLINK_DEPENDS.<em class=
                   8440:             "replaceable"><code>pkg</code></em></code> should be
                   8441:             adjusted to require at least the new package version.
                   8442:             In some cases, the packages that depend on this new
                   8443:             version may need their <code class=
                   8444:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8445:             have <code xmlns=
                   8446:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8447:             "filename">buildlink3.mk</code> files, their
                   8448:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8449:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8450:             too. This is needed so that binary packages made using
                   8451:             it will require the correct package dependency and not
                   8452:             settle for an older one which will not contain the
                   8453:             necessary shared libraries.</p>
1.1       grant    8454: 
                   8455:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8456:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8457:             "replaceable"><code>pkg</code></em></code> as we don't
                   8458:             want to cause unneeded package deletions and rebuilds.
                   8459:             In many cases, new versions of packages work just fine
                   8460:             with older dependencies. See <a href="#dependencies"
1.38      dillo    8461:             title="15.1.4.&nbsp;Handling dependencies">Section
                   8462:             15.1.4, &#8220;Handling dependencies&#8221;</a> for
1.36      wiz      8463:             more information about dependencies on other packages,
1.25      rillig   8464:             including the <code class=
                   8465:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8466:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8467:           </div>
                   8468:         </div>
                   8469: 
                   8470:         <div class="sect1" lang="en" xml:lang="en">
                   8471:           <div class="titlepage">
                   8472:             <div>
                   8473:               <div>
                   8474:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      8475:                 "writing-builtin.mk" id=
1.38      dillo    8476:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8477:                 <code xmlns=
                   8478:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8479:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8480:               </div>
                   8481:             </div>
                   8482:           </div>
                   8483: 
                   8484:           <p>Some packages in pkgsrc install headers and libraries
                   8485:           that coincide with headers and libraries present in the
1.45      wiz      8486:           base system. Aside from a <code xmlns=
                   8487:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8488:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8489:           should also include a <code xmlns=
                   8490:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8491:           "filename">builtin.mk</code> file that includes the
                   8492:           necessary checks to decide whether using the built-in
                   8493:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8494: 
                   8495:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8496:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8497: 
                   8498:           <div class="orderedlist">
                   8499:             <ol type="1">
                   8500:               <li>
1.14      xtraeme  8501:                 <p>It should set <code class=
                   8502:                 "varname">USE_BUILTIN.<em class=
                   8503:                 "replaceable"><code>pkg</code></em></code> to
                   8504:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8505:                 or &#8220;<span class="quote">no</span>&#8221;
                   8506:                 after it is included.</p>
1.1       grant    8507:               </li>
                   8508: 
                   8509:               <li>
                   8510:                 <p>It should <span class=
                   8511:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8512:                 <code class="varname">USE_BUILTIN.<em class=
                   8513:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8514:                 already set before the <code xmlns=
                   8515:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8516:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8517:               </li>
                   8518: 
                   8519:               <li>
                   8520:                 <p>It should be written to allow multiple
                   8521:                 inclusion. This is <span class=
                   8522:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8523:                 careful attention to <code xmlns=
                   8524:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8525:                 "filename">Makefile</code> coding.</p>
1.1       grant    8526:               </li>
                   8527:             </ol>
                   8528:           </div>
                   8529: 
                   8530:           <div class="sect2" lang="en" xml:lang="en">
                   8531:             <div class="titlepage">
                   8532:               <div>
                   8533:                 <div>
1.30      wiz      8534:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
                   8535:                   id=
1.38      dillo    8536:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8537:                   of a <code xmlns=
                   8538:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8539:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8540:                 </div>
                   8541:               </div>
                   8542:             </div>
                   8543: 
                   8544:             <p>The following is the recommended template for
                   8545:             builtin.mk files:</p>
                   8546:             <pre class="programlisting">
                   8547: .if !defined(IS_BUILTIN.foo)
                   8548: #
                   8549: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8550: # genuinely exists in the system or not.
                   8551: #
                   8552: IS_BUILTIN.foo?=        no
                   8553: 
                   8554: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8555: # version can be determined.
                   8556: #
                   8557: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8558: BUILTIN_PKG.foo?=       foo-1.0
                   8559: .  endif
                   8560: .endif  # IS_BUILTIN.foo
                   8561: 
                   8562: .if !defined(USE_BUILTIN.foo)
                   8563: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8564: .  if defined(BUILTIN_PKG.foo)
                   8565: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8566: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8567: USE_BUILTIN.foo!=                                                       \
                   8568:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8569:               ${ECHO} "yes";                                            \
                   8570:       else                                                              \
                   8571:               ${ECHO} "no";                                             \
                   8572:       fi
                   8573: .      endif
                   8574: .    endfor
                   8575: .  endif
                   8576: .endif  # USE_BUILTIN.foo
                   8577: 
                   8578: CHECK_BUILTIN.foo?=     no
                   8579: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8580: #
                   8581: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8582: # "yes" or "no".
                   8583: #
                   8584: .endif  # CHECK_BUILTIN.foo
                   8585:       
                   8586: </pre>
                   8587: 
1.14      xtraeme  8588:             <p>The first section sets <code class=
                   8589:             "varname">IS_BUILTIN.<em class=
                   8590:             "replaceable"><code>pkg</code></em></code> depending on
                   8591:             if <em class="replaceable"><code>pkg</code></em> really
                   8592:             exists in the base system. This should not be a base
                   8593:             system software with similar functionality to
                   8594:             <em class="replaceable"><code>pkg</code></em>; it
                   8595:             should only be &#8220;<span class=
                   8596:             "quote">yes</span>&#8221; if the actual package is
                   8597:             included as part of the base system. This variable is
1.45      wiz      8598:             only used internally within the <code xmlns=
                   8599:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8600:             "filename">builtin.mk</code> file.</p>
                   8601: 
                   8602:             <p>The second section sets <code class=
                   8603:             "varname">BUILTIN_PKG.<em class=
                   8604:             "replaceable"><code>pkg</code></em></code> to the
                   8605:             version of <em class=
                   8606:             "replaceable"><code>pkg</code></em> in the base system
                   8607:             if it exists (if <code class=
                   8608:             "varname">IS_BUILTIN.<em class=
                   8609:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8610:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  8611:             variable is only used internally within the
1.45      wiz      8612:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8613:             class="filename">builtin.mk</code> file.</p>
1.1       grant    8614: 
1.14      xtraeme  8615:             <p>The third section sets <code class=
                   8616:             "varname">USE_BUILTIN.<em class=
                   8617:             "replaceable"><code>pkg</code></em></code> and is
                   8618:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      8619:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8620:             class="filename">builtin.mk</code> files. The code in
                   8621:             this section must make the determination whether the
                   8622:             built-in software is adequate to satisfy the
                   8623:             dependencies listed in <code class=
1.14      xtraeme  8624:             "varname">BUILDLINK_DEPENDS.<em class=
                   8625:             "replaceable"><code>pkg</code></em></code>. This is
                   8626:             typically done by comparing <code class=
                   8627:             "varname">BUILTIN_PKG.<em class=
                   8628:             "replaceable"><code>pkg</code></em></code> against each
                   8629:             of the dependencies in <code class=
                   8630:             "varname">BUILDLINK_DEPENDS.<em class=
                   8631:             "replaceable"><code>pkg</code></em></code>.
                   8632:             <code class="varname">USE_BUILTIN.<em class=
                   8633:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    8634:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      8635:             value by the end of the <code xmlns=
                   8636:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8637:             "filename">builtin.mk</code> file. Note that
                   8638:             <code class="varname">USE_BUILTIN.<em class=
                   8639:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    8640:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  8641:             <code class="varname">IS_BUILTIN.<em class=
                   8642:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8643:             &#8220;<span class="quote">no</span>&#8221; because we
                   8644:             may make the determination that the built-in version of
                   8645:             the software is similar enough to be used as a
                   8646:             replacement.</p>
                   8647: 
1.14      xtraeme  8648:             <p>The last section is guarded by <code class=
                   8649:             "varname">CHECK_BUILTIN.<em class=
                   8650:             "replaceable"><code>pkg</code></em></code>, and
                   8651:             includes code that uses the value of <code class=
                   8652:             "varname">USE_BUILTIN.<em class=
                   8653:             "replaceable"><code>pkg</code></em></code> set in the
                   8654:             previous section. This typically includes, e.g., adding
1.1       grant    8655:             additional dependency restrictions and listing
1.45      wiz      8656:             additional files to symlink into <code xmlns=
                   8657:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8658:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   8659:             "varname">BUILDLINK_FILES.<em class=
                   8660:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    8661:           </div>
                   8662: 
                   8663:           <div class="sect2" lang="en" xml:lang="en">
                   8664:             <div class="titlepage">
                   8665:               <div>
                   8666:                 <div>
1.30      wiz      8667:                   <h3 class="title"><a name=
                   8668:                   "native-or-pkgsrc-preference" id=
1.38      dillo    8669:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      8670:                   preferences for native or pkgsrc software</h3>
1.1       grant    8671:                 </div>
                   8672:               </div>
                   8673:             </div>
                   8674: 
                   8675:             <p>When building packages, it's possible to choose
                   8676:             whether to set a global preference for using either the
                   8677:             built-in (native) version or the pkgsrc version of
                   8678:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  8679:             setting <code class="varname">PREFER_PKGSRC</code> and
                   8680:             <code class="varname">PREFER_NATIVE</code>. These
                   8681:             variables take values of either &#8220;<span class=
1.1       grant    8682:             "quote">yes</span>&#8221;, &#8220;<span class=
                   8683:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  8684:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   8685:             to use the pkgsrc versions of software, while
                   8686:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   8687:             to use the built-in versions. Preferences are
                   8688:             determined by the most specific instance of the package
                   8689:             in either <code class="varname">PREFER_PKGSRC</code> or
                   8690:             <code class="varname">PREFER_NATIVE</code>. If a
                   8691:             package is specified in neither or in both variables,
                   8692:             then <code class="varname">PREFER_PKGSRC</code> has
                   8693:             precedence over <code class=
                   8694:             "varname">PREFER_NATIVE</code>. For example, to require
                   8695:             using pkgsrc versions of software for all but the most
                   8696:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    8697:             <pre class="programlisting">
                   8698:         PREFER_PKGSRC=  yes
                   8699:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   8700:       
                   8701: </pre>
                   8702: 
                   8703:             <p>A package <span class=
1.45      wiz      8704:             "emphasis"><em>must</em></span> have a <code xmlns=
                   8705:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8706:             "filename">builtin.mk</code> file to be listed in
                   8707:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   8708:             it is simply ignored in that list.</p>
1.1       grant    8709:           </div>
                   8710:         </div>
                   8711:       </div>
                   8712: 
                   8713:       <div class="chapter" lang="en" xml:lang="en">
                   8714:         <div class="titlepage">
                   8715:           <div>
                   8716:             <div>
1.35      jmmv     8717:               <h2 class="title"><a name="pkginstall" id=
1.38      dillo    8718:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     8719:               framework</h2>
1.1       grant    8720:             </div>
                   8721:           </div>
                   8722:         </div>
                   8723: 
                   8724:         <div class="toc">
                   8725:           <p><b>Table of Contents</b></p>
                   8726: 
                   8727:           <dl>
1.30      wiz      8728:             <dt><span class="sect1"><a href=
1.38      dillo    8729:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     8730:             directories outside the installation
                   8731:             prefix</a></span></dt>
                   8732: 
                   8733:             <dd>
                   8734:               <dl>
                   8735:                 <dt><span class="sect2"><a href=
1.38      dillo    8736:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     8737:                 manipulation</a></span></dt>
                   8738: 
                   8739:                 <dt><span class="sect2"><a href=
1.38      dillo    8740:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     8741:                 manipulation</a></span></dt>
                   8742:               </dl>
                   8743:             </dd>
                   8744: 
1.38      dillo    8745:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     8746:             Configuration files</a></span></dt>
                   8747: 
                   8748:             <dd>
                   8749:               <dl>
                   8750:                 <dt><span class="sect2"><a href=
1.38      dillo    8751:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     8752:                 "varname">PKG_SYSCONFDIR</code> is
                   8753:                 set</a></span></dt>
                   8754: 
                   8755:                 <dt><span class="sect2"><a href=
1.38      dillo    8756:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     8757:                 software where configuration files
1.35      jmmv     8758:                 are</a></span></dt>
                   8759: 
                   8760:                 <dt><span class="sect2"><a href=
1.38      dillo    8761:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     8762:                 installations</a></span></dt>
                   8763: 
                   8764:                 <dt><span class="sect2"><a href=
1.38      dillo    8765:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     8766:                 configuration files</a></span></dt>
                   8767:               </dl>
                   8768:             </dd>
                   8769: 
1.38      dillo    8770:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     8771:             System startup scripts</a></span></dt>
                   8772: 
                   8773:             <dd>
                   8774:               <dl>
                   8775:                 <dt><span class="sect2"><a href=
1.38      dillo    8776:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     8777:                 of system startup scripts</a></span></dt>
                   8778:               </dl>
                   8779:             </dd>
1.1       grant    8780: 
1.30      wiz      8781:             <dt><span class="sect1"><a href=
1.38      dillo    8782:             "#users-and-groups">12.4. System users and
1.35      jmmv     8783:             groups</a></span></dt>
                   8784: 
1.38      dillo    8785:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     8786:             shells</a></span></dt>
                   8787: 
                   8788:             <dd>
                   8789:               <dl>
                   8790:                 <dt><span class="sect2"><a href=
1.38      dillo    8791:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     8792:                 configuration files</a></span></dt>
                   8793:               </dl>
                   8794:             </dd>
1.1       grant    8795:           </dl>
                   8796:         </div>
                   8797: 
1.35      jmmv     8798:         <p>This chapter describes the framework known as
                   8799:         <code class="literal">pkginstall</code>, whose key features
                   8800:         are:</p>
                   8801: 
                   8802:         <div class="itemizedlist">
                   8803:           <ul type="disc">
                   8804:             <li>
                   8805:               <p>Generic installation and manipulation of
                   8806:               directories and files outside the pkgsrc-handled
                   8807:               tree, <code class="varname">LOCALBASE</code>.</p>
                   8808:             </li>
                   8809: 
                   8810:             <li>
                   8811:               <p>Automatic handling of configuration files during
                   8812:               installation, provided that packages are correctly
                   8813:               designed.</p>
                   8814:             </li>
                   8815: 
                   8816:             <li>
                   8817:               <p>Generation and installation of system startup
                   8818:               scripts.</p>
                   8819:             </li>
                   8820: 
                   8821:             <li>
                   8822:               <p>Registration of system users and groups.</p>
                   8823:             </li>
                   8824: 
                   8825:             <li>
                   8826:               <p>Registration of system shells.</p>
                   8827:             </li>
                   8828:           </ul>
                   8829:         </div>
                   8830: 
                   8831:         <p>The following sections inspect each of the above points
1.47      reed     8832:         in detail. Note that in order to use any of the described
1.35      jmmv     8833:         functionalities, you must add the following to your
1.45      wiz      8834:         package's <code xmlns=
                   8835:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8836:         "filename">Makefile</code>:</p>
1.35      jmmv     8837:         <pre class="programlisting">
                   8838: USE_PKGINSTALL=YES
                   8839: </pre>
                   8840: 
                   8841:         <p>You may be thinking that many of the things described
                   8842:         here could be easily done with simple code in the package's
                   8843:         post-installation target (<code class=
                   8844:         "literal">post-install</code>). <span class=
                   8845:         "emphasis"><em>This is incorrect</em></span>, as the code
                   8846:         in them is only executed when building from source.
                   8847:         Machines using binary packages could not benefit from it at
                   8848:         all (as the code itself could be unavailable). Therefore,
                   8849:         the only way to achieve any of the items described above is
                   8850:         by means of the installation scripts, which are
                   8851:         automatically generated by pkginstall.</p>
1.1       grant    8852: 
                   8853:         <div class="sect1" lang="en" xml:lang="en">
                   8854:           <div class="titlepage">
                   8855:             <div>
                   8856:               <div>
                   8857:                 <h2 class="title" style="clear: both"><a name=
1.35      jmmv     8858:                 "files-and-dirs-outside-prefix" id=
1.38      dillo    8859:                 "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35      jmmv     8860:                 directories outside the installation prefix</h2>
1.1       grant    8861:               </div>
                   8862:             </div>
                   8863:           </div>
                   8864: 
1.45      wiz      8865:           <p>As you already know, the <code xmlns=
                   8866:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8867:           "filename">PLIST</code> file holds a list of files and
                   8868:           directories that belong to a package. The names used in
1.45      wiz      8869:           it are relative to the installation prefix (<code xmlns=
                   8870:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8871:           "filename">${PREFIX}</code>), which means that it cannot
                   8872:           register files outside this directory (absolute path
                   8873:           names are not allowed). Despite this restriction, some
                   8874:           packages need to install files outside this location;
1.45      wiz      8875:           e.g., under <code xmlns=
                   8876:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8877:           "filename">${VARBASE}</code> or <code xmlns=
                   8878:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8879:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     8880: 
                   8881:           <p>The only way to achieve this is to create such files
                   8882:           during installation time by using the installation
                   8883:           scripts. These scripts can run arbitrary commands, so
                   8884:           they have the potential to create and manage files
1.47      reed     8885:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     8886:           comes into play: it provides generic scripts to abstract
                   8887:           the manipulation of such files and directories based on
1.45      wiz      8888:           variables set in the package's <code xmlns=
                   8889:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8890:           "filename">Makefile</code>. The rest of this section
1.47      reed     8891:           describes these variables.</p>
1.1       grant    8892: 
1.35      jmmv     8893:           <div class="sect2" lang="en" xml:lang="en">
                   8894:             <div class="titlepage">
1.1       grant    8895:               <div>
1.35      jmmv     8896:                 <div>
                   8897:                   <h3 class="title"><a name="dirs-outside-prefix"
1.38      dillo    8898:                   id="dirs-outside-prefix"></a>12.1.1. Directory
1.35      jmmv     8899:                   manipulation</h3>
                   8900:                 </div>
1.1       grant    8901:               </div>
                   8902:             </div>
                   8903: 
1.35      jmmv     8904:             <p>The following variables can be set to request the
1.47      reed     8905:             creation of directories anywhere in the file
                   8906:             system:</p>
1.27      rillig   8907: 
1.35      jmmv     8908:             <div class="itemizedlist">
                   8909:               <ul type="disc">
                   8910:                 <li>
                   8911:                   <p><code class="varname">MAKE_DIRS</code> and
                   8912:                   <code class="varname">OWN_DIRS</code> contain a
                   8913:                   list of directories that should be created and
                   8914:                   should attempt to be destroyed by the
                   8915:                   installation scripts. The difference between the
                   8916:                   two is that the latter prompts the administrator
                   8917:                   to remove any directories that may be left after
                   8918:                   deinstallation (because they were not empty),
                   8919:                   while the former does not.</p>
                   8920:                 </li>
1.1       grant    8921: 
1.35      jmmv     8922:                 <li>
                   8923:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   8924:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   8925:                   contain a list of tuples describing which
                   8926:                   directories should be created and should attempt
                   8927:                   to be destroyed by the installation scripts. Each
                   8928:                   tuple holds the following values, separated by
                   8929:                   spaces: the directory name, its owner, its group
                   8930:                   and its numerical mode. For example:</p>
                   8931:                   <pre class="programlisting">
                   8932: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
                   8933: </pre>
1.1       grant    8934: 
1.35      jmmv     8935:                   <p>The difference between the two is exactly the
                   8936:                   same as their non-<code class=
                   8937:                   "varname">PERMS</code> counterparts.</p>
                   8938:                 </li>
                   8939:               </ul>
                   8940:             </div>
                   8941:           </div>
                   8942: 
                   8943:           <div class="sect2" lang="en" xml:lang="en">
                   8944:             <div class="titlepage">
                   8945:               <div>
                   8946:                 <div>
                   8947:                   <h3 class="title"><a name="files-outside-prefix"
1.38      dillo    8948:                   id="files-outside-prefix"></a>12.1.2. File
1.35      jmmv     8949:                   manipulation</h3>
                   8950:                 </div>
                   8951:               </div>
                   8952:             </div>
                   8953: 
                   8954:             <p>Creating non-empty files outside the installation
1.45      wiz      8955:             prefix is tricky because the <code xmlns=
                   8956:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8957:             "filename">PLIST</code> forces all files to be inside
                   8958:             it. To overcome this problem, the only solution is to
                   8959:             extract the file in the known place (i.e., inside the
                   8960:             installation prefix) and copy it to the appropriate
                   8961:             location during installation (done by the installation
                   8962:             scripts generated by pkginstall). We will call the
                   8963:             former the <span class="emphasis"><em>master
                   8964:             file</em></span> in the following paragraphs, which
                   8965:             describe the variables that can be used to
                   8966:             automatically and consistently handle files outside the
                   8967:             installation prefix:</p>
                   8968: 
                   8969:             <div class="itemizedlist">
                   8970:               <ul type="disc">
                   8971:                 <li>
                   8972:                   <p><code class="varname">CONF_FILES</code> and
                   8973:                   <code class="varname">SUPPORT_FILES</code> are
                   8974:                   pairs of master and target files. During
                   8975:                   installation time, the master file is copied to
                   8976:                   the target one if and only if the latter does not
                   8977:                   exist. Upon deinstallation, the target file is
                   8978:                   removed provided that it was not modified by the
                   8979:                   installation.</p>
                   8980: 
                   8981:                   <p>The difference between the two is that the
                   8982:                   latter prompts the administrator to remove any
                   8983:                   files that may be left after deinstallation
                   8984:                   (because they were not empty), while the former
                   8985:                   does not.</p>
                   8986:                 </li>
                   8987: 
                   8988:                 <li>
                   8989:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   8990:                   and <code class=
                   8991:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   8992:                   tuples describing master files as well as their
                   8993:                   target locations. For each of them, it also
                   8994:                   specifies their owner, their group and their
                   8995:                   numeric permissions, in this order. For
                   8996:                   example:</p>
                   8997:                   <pre class="programlisting">
                   8998: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
                   8999: </pre>
                   9000: 
                   9001:                   <p>The difference between the two is exactly the
                   9002:                   same as their non-<code class=
                   9003:                   "varname">PERMS</code> counterparts.</p>
                   9004:                 </li>
                   9005:               </ul>
                   9006:             </div>
                   9007:           </div>
                   9008:         </div>
                   9009: 
                   9010:         <div class="sect1" lang="en" xml:lang="en">
                   9011:           <div class="titlepage">
                   9012:             <div>
                   9013:               <div>
                   9014:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9015:                 "conf-files" id="conf-files"></a>12.2.
1.35      jmmv     9016:                 Configuration files</h2>
                   9017:               </div>
                   9018:             </div>
                   9019:           </div>
                   9020: 
                   9021:           <p>Configuration files are special in the sense that they
                   9022:           are installed in their own specific directory,
                   9023:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9024:           special treatment during installation (most of which is
                   9025:           automated by pkginstall). The main concept you must bear
1.36      wiz      9026:           in mind is that files marked as configuration files are
1.35      jmmv     9027:           automatically copied to the right place (somewhere inside
                   9028:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9029:           installation <span class="emphasis"><em>if and only
                   9030:           if</em></span> they didn't exist before. Similarly, they
                   9031:           will not be removed if they have local modifications.
1.36      wiz      9032:           This ensures that administrators never lose any custom
1.35      jmmv     9033:           changes they may have made.</p>
                   9034: 
                   9035:           <div class="sect2" lang="en" xml:lang="en">
                   9036:             <div class="titlepage">
                   9037:               <div>
                   9038:                 <div>
                   9039:                   <h3 class="title"><a name="conf-files-sysconfdir"
1.38      dillo    9040:                   id="conf-files-sysconfdir"></a>12.2.1. How
1.35      jmmv     9041:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9042:                   set</h3>
                   9043:                 </div>
                   9044:               </div>
                   9045:             </div>
                   9046: 
                   9047:             <p>As said before, the <code class=
                   9048:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9049:             where configuration files shall be installed. Its
                   9050:             contents are set based upon the following
                   9051:             variables:</p>
                   9052: 
                   9053:             <div class="itemizedlist">
                   9054:               <ul type="disc">
                   9055:                 <li>
                   9056:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9057:                   The configuration's root directory. Defaults to
1.45      wiz      9058:                   <code xmlns=
                   9059:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9060:                   "filename">${PREFIX}/etc</code> although it may
                   9061:                   be overridden by the user to point to his
                   9062:                   preferred location (e.g., <code xmlns=
                   9063:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9064:                   "filename">/etc</code>, <code xmlns=
                   9065:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9066:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9067:                   not use it directly.</p>
                   9068:                 </li>
                   9069: 
                   9070:                 <li>
                   9071:                   <p><code class=
                   9072:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9073:                   subdirectory of <code class=
                   9074:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9075:                   configuration files for the package being built
                   9076:                   shall be installed. The definition of this
                   9077:                   variable only makes sense in the package's
1.45      wiz      9078:                   <code xmlns=
                   9079:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9080:                   "filename">Makefile</code> (i.e., it is not
                   9081:                   user-customizable).</p>
1.35      jmmv     9082: 
                   9083:                   <p>As an example, consider the Apache package,
                   9084:                   <a xmlns=
                   9085:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9086:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9087:                   target="_top"><code xmlns="" class=
                   9088:                   "filename">www/apache2</code></a>, which places
                   9089:                   its configuration files under the <code xmlns=
                   9090:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9091:                   "filename">httpd/</code> subdirectory of
                   9092:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9093:                   This should be set in the package Makefile.</p>
                   9094:                 </li>
                   9095: 
                   9096:                 <li>
                   9097:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9098:                   Specifies the name of the variable that holds
                   9099:                   this package's configuration directory (if
                   9100:                   different from <code class=
                   9101:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9102:                   <code class="varname">PKGBASE</code>'s value, and
                   9103:                   is always prefixed with <code class=
                   9104:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9105:                 </li>
                   9106: 
                   9107:                 <li>
                   9108:                   <p><code class=
                   9109:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9110:                   Holds the directory where the configuration files
                   9111:                   for the package identified by <code class=
                   9112:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9113:                   placed.</p>
                   9114:                 </li>
                   9115:               </ul>
                   9116:             </div>
                   9117: 
                   9118:             <p>Based on the above variables, pkginstall determines
                   9119:             the value of <code class=
                   9120:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9121:             <span class="emphasis"><em>only</em></span> variable
                   9122:             that can be used within a package to refer to its
                   9123:             configuration directory. The algorithm used to set its
                   9124:             value is basically the following:</p>
                   9125: 
                   9126:             <div class="orderedlist">
                   9127:               <ol type="1">
                   9128:                 <li>
                   9129:                   <p>If <code class=
                   9130:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9131:                   is set, its value is used.</p>
                   9132:                 </li>
                   9133: 
                   9134:                 <li>
                   9135:                   <p>If the previous variable is not defined but
                   9136:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9137:                   set in the package's <code xmlns=
                   9138:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9139:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9140:                   is <code xmlns=
                   9141:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9142:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9143:                 </li>
                   9144: 
                   9145:                 <li>
1.45      wiz      9146:                   <p>Otherwise, it is set to <code xmlns=
                   9147:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9148:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9149:                 </li>
                   9150:               </ol>
                   9151:             </div>
                   9152: 
1.45      wiz      9153:             <p>It is worth mentioning that <code xmlns=
                   9154:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9155:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9156:             added to <code xmlns=
                   9157:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9158:             "filename">OWN_DIRS</code>. See <a href=
                   9159:             "#dirs-outside-prefix" title=
1.38      dillo    9160:             "12.1.1.&nbsp;Directory manipulation">Section 12.1.1,
1.35      jmmv     9161:             &#8220;Directory manipulation&#8221;</a> what this
                   9162:             means.</p>
                   9163:           </div>
                   9164: 
                   9165:           <div class="sect2" lang="en" xml:lang="en">
                   9166:             <div class="titlepage">
                   9167:               <div>
                   9168:                 <div>
                   9169:                   <h3 class="title"><a name="conf-files-configure"
1.38      dillo    9170:                   id="conf-files-configure"></a>12.2.2. Telling the
1.47      reed     9171:                   software where configuration files are</h3>
1.35      jmmv     9172:                 </div>
                   9173:               </div>
                   9174:             </div>
                   9175: 
                   9176:             <p>Given that pkgsrc (and users!) expect configuration
                   9177:             files to be in a known place, you need to teach each
1.36      wiz      9178:             package where it shall install its files. In some cases
1.35      jmmv     9179:             you will have to patch the package Makefiles to achieve
                   9180:             it. If you are lucky, though, it may be as easy as
                   9181:             passing an extra flag to the configuration script; this
1.47      reed     9182:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9183:             <pre class="programlisting">
                   9184: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
                   9185: </pre>
                   9186: 
                   9187:             <p>Note that this specifies where the package has to
                   9188:             <span class="emphasis"><em>look for</em></span> its
                   9189:             configuration files, not where they will be originally
                   9190:             installed (although the difference is never explicit,
                   9191:             unfortunately).</p>
                   9192:           </div>
                   9193: 
                   9194:           <div class="sect2" lang="en" xml:lang="en">
                   9195:             <div class="titlepage">
                   9196:               <div>
                   9197:                 <div>
                   9198:                   <h3 class="title"><a name="conf-files-patching"
1.38      dillo    9199:                   id="conf-files-patching"></a>12.2.3. Patching
1.35      jmmv     9200:                   installations</h3>
                   9201:                 </div>
                   9202:               </div>
                   9203:             </div>
                   9204: 
                   9205:             <p>As said before, pkginstall automatically handles
                   9206:             configuration files. This means that <span class=
                   9207:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9208:             the contents of <code xmlns=
                   9209:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9210:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9211:             directly</strong></span>. Bad news is that many
                   9212:             software installation scripts will, out of the box,
                   9213:             mess with the contents of that directory. So what is
                   9214:             the correct procedure to fix this issue?</p>
1.35      jmmv     9215: 
                   9216:             <p>You must teach the package (usually by manually
                   9217:             patching it) to install any configuration files under
1.45      wiz      9218:             the examples hierarchy, <code xmlns=
                   9219:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9220:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9221:             the <code xmlns=
                   9222:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9223:             "filename">PLIST</code> registers them and the
                   9224:             administrator always has the original copies
1.35      jmmv     9225:             available.</p>
                   9226: 
                   9227:             <p>Once the required configuration files are in place
                   9228:             (i.e., under the examples hierarchy), the pkginstall
                   9229:             framework can use them as master copies during the
1.45      wiz      9230:             package installation to update what is in <code xmlns=
                   9231:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9232:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9233:             the variables <code class="varname">CONF_FILES</code>
                   9234:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9235:             used. Check out <a href="#files-outside-prefix" title=
1.38      dillo    9236:             "12.1.2.&nbsp;File manipulation">Section 12.1.2,
1.35      jmmv     9237:             &#8220;File manipulation&#8221;</a> for information
                   9238:             about their syntax and their purpose. Here is an
                   9239:             example, taken from the <a xmlns=
                   9240:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9241:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9242:             target="_top"><code xmlns="" class=
                   9243:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9244:             <pre class="programlisting">
                   9245: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9246: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   9247: </pre>
                   9248: 
                   9249:             <p>Note that the <code class="varname">EGDIR</code>
                   9250:             variable is specific to that package and has no meaning
                   9251:             outside it.</p>
                   9252:           </div>
                   9253: 
                   9254:           <div class="sect2" lang="en" xml:lang="en">
                   9255:             <div class="titlepage">
                   9256:               <div>
                   9257:                 <div>
                   9258:                   <h3 class="title"><a name="conf-files-disable"
1.38      dillo    9259:                   id="conf-files-disable"></a>12.2.4. Disabling
1.35      jmmv     9260:                   handling of configuration files</h3>
                   9261:                 </div>
                   9262:               </div>
                   9263:             </div>
                   9264: 
                   9265:             <p>The automatic copying of config files can be toggled
                   9266:             by setting the environment variable <code class=
                   9267:             "varname">PKG_CONFIG</code> prior to package
                   9268:             installation.</p>
                   9269:           </div>
                   9270:         </div>
                   9271: 
                   9272:         <div class="sect1" lang="en" xml:lang="en">
                   9273:           <div class="titlepage">
                   9274:             <div>
                   9275:               <div>
                   9276:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9277:                 "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35      jmmv     9278:                 startup scripts</h2>
                   9279:               </div>
                   9280:             </div>
                   9281:           </div>
                   9282: 
                   9283:           <p>System startup scripts are special files because they
                   9284:           must be installed in a place known by the underlying OS,
                   9285:           usually outside the installation prefix. Therefore, the
                   9286:           same rules described in <a href=
                   9287:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9288:           "12.1.&nbsp;Files and directories outside the installation prefix">
                   9289:           Section 12.1, &#8220;Files and directories outside the
1.35      jmmv     9290:           installation prefix&#8221;</a> apply, and the same
                   9291:           solutions can be used. However, pkginstall provides a
1.36      wiz      9292:           special mechanism to handle these files.</p>
1.35      jmmv     9293: 
                   9294:           <p>In order to provide system startup scripts, the
                   9295:           package has to:</p>
                   9296: 
                   9297:           <div class="orderedlist">
                   9298:             <ol type="1">
                   9299:               <li>
1.45      wiz      9300:                 <p>Store the script inside <code xmlns=
                   9301:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9302:                 "filename">${FILESDIR}</code>, with the
                   9303:                 <code class="literal">.sh</code> suffix appended.
                   9304:                 Considering the <a xmlns=
                   9305:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9306:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9307:                 target="_top"><code xmlns="" class=
                   9308:                 "filename">print/cups</code></a> package as an
                   9309:                 example, it has a <code xmlns=
                   9310:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9311:                 "filename">cupsd.sh</code> in its files
                   9312:                 directory.</p>
                   9313:               </li>
                   9314: 
                   9315:               <li>
                   9316:                 <p>Tell pkginstall to handle it, appending the name
                   9317:                 of the script, without its extension, to the
                   9318:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9319:                 Continuing the previous example:</p>
                   9320:                 <pre class="programlisting">
                   9321: RCD_SCRIPTS+= cupsd
                   9322: </pre>
                   9323:               </li>
                   9324:             </ol>
                   9325:           </div>
                   9326: 
                   9327:           <p>Once this is done, pkginstall will do the following
                   9328:           steps for each script in an automated fashion:</p>
                   9329: 
                   9330:           <div class="orderedlist">
                   9331:             <ol type="1">
                   9332:               <li>
                   9333:                 <p>Process the file found in the files directory
                   9334:                 applying all the substitutions described in the
1.45      wiz      9335:                 <code xmlns=
                   9336:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9337:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9338:               </li>
                   9339: 
                   9340:               <li>
                   9341:                 <p>Copy the script from the files directory to the
1.45      wiz      9342:                 examples hierarchy, <code xmlns=
                   9343:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9344:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9345:                 Note that this master file must be explicitly
1.45      wiz      9346:                 registered in the <code xmlns=
                   9347:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9348:                 "filename">PLIST</code>.</p>
                   9349:               </li>
                   9350: 
                   9351:               <li>
                   9352:                 <p>Add code to the installation scripts to copy the
                   9353:                 startup script from the examples hierarchy into the
                   9354:                 system-wide startup scripts directory.</p>
                   9355:               </li>
                   9356:             </ol>
                   9357:           </div>
                   9358: 
                   9359:           <div class="sect2" lang="en" xml:lang="en">
                   9360:             <div class="titlepage">
                   9361:               <div>
                   9362:                 <div>
                   9363:                   <h3 class="title"><a name="rcd-scripts-disable"
1.38      dillo    9364:                   id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35      jmmv     9365:                   handling of system startup scripts</h3>
                   9366:                 </div>
                   9367:               </div>
                   9368:             </div>
                   9369: 
                   9370:             <p>The automatic copying of config files can be toggled
                   9371:             by setting the environment variable <code class=
                   9372:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9373:             installation. Note that the scripts will be always
1.45      wiz      9374:             copied inside the examples hierarchy, <code xmlns=
                   9375:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9376:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9377:             matter what the value of this variable is.</p>
                   9378:           </div>
                   9379:         </div>
                   9380: 
                   9381:         <div class="sect1" lang="en" xml:lang="en">
                   9382:           <div class="titlepage">
                   9383:             <div>
                   9384:               <div>
                   9385:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9386:                 "users-and-groups" id="users-and-groups"></a>12.4.
1.35      jmmv     9387:                 System users and groups</h2>
                   9388:               </div>
                   9389:             </div>
                   9390:           </div>
                   9391: 
                   9392:           <p>If a package needs to create special users and/or
                   9393:           groups during installation, it can do so by using the
                   9394:           pkginstall framework.</p>
                   9395: 
                   9396:           <p>Users can be created by adding entries to the
                   9397:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9398:           entry has the following syntax, which mimics <code xmlns=
                   9399:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9400:           "filename">/etc/passwd</code>:</p>
                   9401:           <pre class="programlisting">
                   9402: user:group[:[userid][:[descr][:[home][:shell]]]]
                   9403: </pre>
                   9404: 
                   9405:           <p>Only the user and group are required; everything else
                   9406:           is optional, but the colons must be in the right places
                   9407:           when specifying optional bits. By default, a new user
1.45      wiz      9408:           will have home directory <code xmlns=
                   9409:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9410:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9411:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9412:           class="filename">/sbin/nologin</code> unless they are
                   9413:           specified as part of the user element. Note that if the
                   9414:           description contains spaces, then spaces should be double
                   9415:           backslash-escaped, as in:</p>
1.35      jmmv     9416:           <pre class="programlisting">
                   9417: foo:foogrp::The\\ Foomister
                   9418: </pre>
                   9419: 
                   9420:           <p>Similarly, groups can be created using the
                   9421:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9422:           syntax is:</p>
                   9423:           <pre class="programlisting">
                   9424: group[:groupid]
                   9425: </pre>
                   9426: 
                   9427:           <p>As before, only the group name is required; the
                   9428:           numeric identifier is optional.</p>
                   9429:         </div>
                   9430: 
                   9431:         <div class="sect1" lang="en" xml:lang="en">
                   9432:           <div class="titlepage">
                   9433:             <div>
                   9434:               <div>
                   9435:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9436:                 "shells" id="shells"></a>12.5. System shells</h2>
1.35      jmmv     9437:               </div>
                   9438:             </div>
                   9439:           </div>
                   9440: 
                   9441:           <p>Packages that install system shells should register
1.45      wiz      9442:           them in the shell database, <code xmlns=
                   9443:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9444:           "filename">/etc/shells</code>, to make things easier to
                   9445:           the administrator. This must be done from the
                   9446:           installation scripts to keep binary packages working on
                   9447:           any system. pkginstall provides an easy way to accomplish
                   9448:           this task.</p>
                   9449: 
                   9450:           <p>When a package provides a shell interpreter, it has to
                   9451:           set the <code class="varname">PKG_SHELL</code> variable
                   9452:           to its absolute file name. This will add some hooks to
                   9453:           the installation scripts to handle it. Consider the
                   9454:           following example, taken from <a xmlns=
                   9455:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9456:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9457:           target="_top"><code xmlns="" class=
                   9458:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9459:           <pre class="programlisting">
                   9460: USE_PKGINSTALL= YES
                   9461: PKG_SHELL=      ${PREFIX}/bin/zsh
                   9462: </pre>
                   9463: 
                   9464:           <div class="sect2" lang="en" xml:lang="en">
                   9465:             <div class="titlepage">
                   9466:               <div>
                   9467:                 <div>
                   9468:                   <h3 class="title"><a name="shells-disable" id=
1.38      dillo    9469:                   "shells-disable"></a>12.5.1. Disabling handling
1.35      jmmv     9470:                   of configuration files</h3>
                   9471:                 </div>
                   9472:               </div>
                   9473:             </div>
                   9474: 
                   9475:             <p>The automatic registration of shell interpreters can
                   9476:             be disabled by the administrator by setting the
1.45      wiz      9477:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9478:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9479:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9480:           </div>
                   9481:         </div>
                   9482:       </div>
                   9483: 
                   9484:       <div class="chapter" lang="en" xml:lang="en">
                   9485:         <div class="titlepage">
                   9486:           <div>
                   9487:             <div>
                   9488:               <h2 class="title"><a name="options" id=
1.38      dillo    9489:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9490:               handling</h2>
                   9491:             </div>
                   9492:           </div>
                   9493:         </div>
                   9494: 
                   9495:         <div class="toc">
                   9496:           <p><b>Table of Contents</b></p>
                   9497: 
                   9498:           <dl>
                   9499:             <dt><span class="sect1"><a href=
1.38      dillo    9500:             "#global-default-options">13.1. Global default
1.35      jmmv     9501:             options</a></span></dt>
                   9502: 
                   9503:             <dt><span class="sect1"><a href=
1.38      dillo    9504:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9505:             use <code xmlns=
                   9506:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9507:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9508: 
                   9509:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9510:             Option Names</a></span></dt>
1.35      jmmv     9511:           </dl>
                   9512:         </div>
                   9513: 
                   9514:         <p>Many packages have the ability to be built to support
1.45      wiz      9515:         different sets of features. <code xmlns=
                   9516:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9517:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9518:         that provides generic handling of those options that
                   9519:         determine different ways in which the packages can be
                   9520:         built. It's possible for the user to specify exactly which
                   9521:         sets of options will be built into a package or to allow a
                   9522:         set of global default options apply.</p>
                   9523: 
                   9524:         <div class="sect1" lang="en" xml:lang="en">
                   9525:           <div class="titlepage">
                   9526:             <div>
                   9527:               <div>
                   9528:                 <h2 class="title" style="clear: both"><a name=
                   9529:                 "global-default-options" id=
1.38      dillo    9530:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9531:                 default options</h2>
                   9532:               </div>
                   9533:             </div>
                   9534:           </div>
                   9535: 
                   9536:           <p>Global default options are listed in <code class=
                   9537:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9538:           the options that should be built into every package if
                   9539:           that option is supported. This variable should be set in
1.45      wiz      9540:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9541:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     9542:         </div>
                   9543: 
                   9544:         <div class="sect1" lang="en" xml:lang="en">
                   9545:           <div class="titlepage">
                   9546:             <div>
                   9547:               <div>
                   9548:                 <h2 class="title" style="clear: both"><a name=
                   9549:                 "converting-to-options" id=
1.38      dillo    9550:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      9551:                 packages to use <code xmlns=
                   9552:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9553:                 "filename">bsd.options.mk</code></h2>
                   9554:               </div>
                   9555:             </div>
                   9556:           </div>
                   9557: 
1.45      wiz      9558:           <p>The following example shows how <code xmlns=
                   9559:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9560:           "filename">bsd.options.mk</code> should be used by the
                   9561:           hypothetical ``wibble'' package, either in the package
1.45      wiz      9562:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9563:           class="filename">Makefile</code>, or in a file, e.g.
                   9564:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9565:           class="filename">options.mk</code>, that is included by
                   9566:           the main package <code xmlns=
                   9567:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9568:           "filename">Makefile</code>.</p>
                   9569:           <pre class="programlisting">
1.37      dillo    9570: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
                   9571: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
1.47      reed     9572: PKG_OPTIONS_OPTIONAL_GROUPS=    database
                   9573: PKG_OPTIONS_GROUP.database=     mysql pgsql
1.37      dillo    9574: PKG_SUGGESTED_OPTIONS=          wibble-foo
                   9575: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
                   9576: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
                   9577: 
                   9578: .include "../../mk/bsd.prefs.mk"
                   9579: 
                   9580: # this package was previously named wibble2
                   9581: .if defined(PKG_OPTIONS.wibble2)
                   9582: PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
1.40      dillo    9583: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37      dillo    9584: .endif
1.35      jmmv     9585: 
                   9586: .include "../../mk/bsd.options.mk"
                   9587: 
                   9588: # Package-specific option-handling
                   9589: 
                   9590: ###
1.37      dillo    9591: ### FOO support
                   9592: ###
                   9593: .if !empty(PKG_OPTIONS:Mwibble-foo)
                   9594: CONFIGURE_ARGS+=        --enable-foo
                   9595: .endif
                   9596: 
                   9597: ###
1.35      jmmv     9598: ### LDAP support
                   9599: ###
                   9600: .if !empty(PKG_OPTIONS:Mldap)
                   9601: .  include "../../databases/openldap/buildlink3.mk"
1.37      dillo    9602: CONFIGURE_ARGS+=        --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35      jmmv     9603: .endif
1.1       grant    9604: 
                   9605: ###
1.37      dillo    9606: ### database support
1.1       grant    9607: ###
1.37      dillo    9608: .if !empty(PKG_OPTIONS:Mmysql)
                   9609: .  include "../../mk/mysql.buildlink3.mk"
                   9610: .endif
                   9611: .if !empty(PKG_OPTIONS:Mpgsql)
                   9612: .  include "../../mk/pgsql.buildlink3.mk"
1.1       grant    9613: .endif
                   9614: </pre>
                   9615: 
1.28      rillig   9616:           <p>The first section contains the information about which
                   9617:           build options are supported by the package, and any
1.1       grant    9618:           default options settings if needed.</p>
                   9619: 
                   9620:           <div class="orderedlist">
                   9621:             <ol type="1">
                   9622:               <li>
1.14      xtraeme  9623:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   9624:                 the name of the <a href=
1.1       grant    9625:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9626:                 <span class="citerefentry"><span class=
1.27      rillig   9627:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    9628:                 that the user can set to override the default
                   9629:                 options. It should be set to &#8220;<span class=
                   9630:                 "quote">PKG_OPTIONS.<em class=
1.38      dillo    9631:                 "replaceable"><code>pkgbase</code></em></span>&#8221;.</p>
1.1       grant    9632:               </li>
                   9633: 
                   9634:               <li>
1.14      xtraeme  9635:                 <p><code class=
                   9636:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    9637:                 build options supported by the package.</p>
                   9638:               </li>
                   9639: 
                   9640:               <li>
                   9641:                 <p><code class=
                   9642:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   9643:                 list of names of groups of mutually exclusive
                   9644:                 options. The options in each group are listed in
                   9645:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   9646:                 "replaceable"><code>groupname</code></em></code>.
                   9647:                 The most specific setting of any option from the
                   9648:                 group takes precedence over all other options in
                   9649:                 the group. Options from the groups will be
                   9650:                 automatically added to <code class=
                   9651:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   9652:               </li>
                   9653: 
                   9654:               <li>
                   9655:                 <p><code class=
                   9656:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   9657:                 like <code class=
                   9658:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   9659:                 building the packages will fail if no option from
                   9660:                 the group is selected.</p>
1.1       grant    9661:               </li>
                   9662: 
                   9663:               <li>
1.27      rillig   9664:                 <p><code class=
1.44      gdt      9665:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   9666:                 list of names of sets of options. At least one
                   9667:                 option from each set must be selected. The options
                   9668:                 in each set are listed in <code class=
                   9669:                 "varname">PKG_OPTIONS_SET.<em class=
                   9670:                 "replaceable"><code>setname</code></em></code>.
                   9671:                 Options from the sets will be automatically added
                   9672:                 to <code class=
                   9673:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   9674:                 the package will fail if no option from the set is
                   9675:                 selected.</p>
                   9676:               </li>
                   9677: 
                   9678:               <li>
                   9679:                 <p><code class=
1.27      rillig   9680:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   9681:                 build options which are enabled by default.</p>
                   9682:               </li>
                   9683: 
                   9684:               <li>
1.37      dillo    9685:                 <p><code class=
                   9686:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   9687:                 of &#8220;<span class="quote"><em class=
                   9688:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
                   9689:                 <code>option</code></em></span>&#8221; pairs that
1.45      wiz      9690:                 map legacy <code xmlns=
                   9691:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    9692:                 "filename">/etc/mk.conf</code> variables to their
                   9693:                 option counterparts. Pairs should be added with
                   9694:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9695:                 the listing of global legacy variables. A warning
                   9696:                 will be issued if the user uses a legacy
                   9697:                 variable.</p>
                   9698:               </li>
1.1       grant    9699: 
1.37      dillo    9700:               <li>
                   9701:                 <p><code class=
                   9702:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   9703:                 of &#8220;<span class="quote"><em class=
                   9704:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
                   9705:                 <code>new-option</code></em></span>&#8221; pairs
                   9706:                 that map options that have been renamed to their
                   9707:                 new counterparts. Pairs should be added with
                   9708:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9709:                 the listing of global legacy options. A warning
                   9710:                 will be issued if the user uses a legacy
                   9711:                 option.</p>
                   9712:               </li>
1.1       grant    9713: 
1.37      dillo    9714:               <li>
                   9715:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   9716:                 is a list of options implied by deprecated
                   9717:                 variables used. This can be used for cases that
                   9718:                 neither <code class=
                   9719:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   9720:                 <code class=
                   9721:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   9722:                 handle, e. g. when <code class=
                   9723:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    9724:               </li>
                   9725: 
                   9726:               <li>
1.37      dillo    9727:                 <p><code class=
                   9728:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   9729:                 a list of warnings about deprecated variables or
                   9730:                 options used, and what to use instead.</p>
1.1       grant    9731:               </li>
1.28      rillig   9732:             </ol>
1.1       grant    9733:           </div>
                   9734: 
1.37      dillo    9735:           <p>A package should never modify <code class=
                   9736:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   9737:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   9738:           These are strictly user-settable. To suggest a default
                   9739:           set of options, use <code class=
                   9740:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   9741: 
1.42      dillo    9742:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      9743:           defined before including <code xmlns=
                   9744:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    9745:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    9746:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   9747:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   9748:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     9749:           are defined (as can happen with platform-specific options
1.42      dillo    9750:           if none of them is supported on the current platform),
                   9751:           <code class="varname">PKG_OPTIONS</code> is set to the
                   9752:           empty list and the package is otherwise treated as not
                   9753:           using the options framework.</p>
1.37      dillo    9754: 
1.45      wiz      9755:           <p>After the inclusion of <code xmlns=
                   9756:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    9757:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   9758:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    9759:           list of selected build options, properly filtered to
1.28      rillig   9760:           remove unsupported and duplicate options.</p>
                   9761: 
1.1       grant    9762:           <p>The remaining sections contain the logic that is
1.37      dillo    9763:           specific to each option. The correct way to check for an
                   9764:           option is to check whether it is listed in <code class=
                   9765:           "varname">PKG_OPTIONS</code>:</p>
                   9766:           <pre class="programlisting">
                   9767: .if !empty(PKG_OPTIONS:M<em class=
                   9768: "replaceable"><code>option</code></em>)
                   9769: </pre>
1.48      dillo    9770:         </div>
1.37      dillo    9771: 
1.48      dillo    9772:         <div class="sect1" lang="en" xml:lang="en">
                   9773:           <div class="titlepage">
                   9774:             <div>
                   9775:               <div>
                   9776:                 <h2 class="title" style="clear: both"><a name=
                   9777:                 "option-names" id=
                   9778:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   9779:               </div>
                   9780:             </div>
                   9781:           </div>
                   9782: 
                   9783:           <p>Options that enable similar features in different
                   9784:           packages (like optional support for a library) should use
                   9785:           a common name in all packages that support it (like the
                   9786:           name of the library). If another package already has an
                   9787:           option with the same meaning, use the same name.</p>
                   9788: 
                   9789:           <p>Options that enable features specific to one package,
                   9790:           where it's unlikely that another (unrelated) package has
                   9791:           the same (or a similar) optional feature, should use a
                   9792:           name prefixed with <code class="varname"><em class=
                   9793:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   9794: 
                   9795:           <p>If a group of related packages share an optional
                   9796:           feature specific to that group, prefix it with the name
                   9797:           of the &#8220;<span class="quote">main</span>&#8221;
                   9798:           package (e. g. <code class=
                   9799:           "varname">djbware-errno-hack</code>).</p>
                   9800: 
                   9801:           <p>For new options, add a line to <code xmlns=
                   9802:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9803:           "filename">mk/defaults/options.description</code>. Lines
                   9804:           have two fields, separated by tab. The first field is the
                   9805:           option name, the second its description. The description
                   9806:           should be a whole sentence (starting with an uppercase
                   9807:           letter and ending with a period) that describes what
                   9808:           enabling the option does. E. g. &#8220;<span class=
                   9809:           "quote">Enable ispell support.</span>&#8221; The file is
                   9810:           sorted by option names.</p>
1.1       grant    9811:         </div>
                   9812:       </div>
                   9813: 
                   9814:       <div class="chapter" lang="en" xml:lang="en">
                   9815:         <div class="titlepage">
                   9816:           <div>
                   9817:             <div>
                   9818:               <h2 class="title"><a name="build" id=
1.38      dillo    9819:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    9820:               process</h2>
                   9821:             </div>
                   9822:           </div>
                   9823:         </div>
                   9824: 
                   9825:         <div class="toc">
                   9826:           <p><b>Table of Contents</b></p>
                   9827: 
                   9828:           <dl>
1.38      dillo    9829:             <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1       grant    9830:             Program location</a></span></dt>
                   9831: 
1.38      dillo    9832:             <dt><span class="sect1"><a href="#main-targets">14.2.
1.30      wiz      9833:             Main targets</a></span></dt>
1.1       grant    9834: 
                   9835:             <dt><span class="sect1"><a href=
1.38      dillo    9836:             "#build.helpful-targets">14.3. Other helpful
1.1       grant    9837:             targets</a></span></dt>
                   9838:           </dl>
                   9839:         </div>
                   9840: 
                   9841:         <p>The basic steps for building a program are always the
                   9842:         same. First the program's source (<span class=
                   9843:         "emphasis"><em>distfile</em></span>) must be brought to the
                   9844:         local system and then extracted. After any patches to
                   9845:         compile properly on NetBSD are applied, the software can be
                   9846:         configured, then built (usually by compiling), and finally
                   9847:         the generated binaries, etc. can be put into place on the
                   9848:         system. These are exactly the steps performed by the NetBSD
                   9849:         package system, which is implemented as a series of targets
1.45      wiz      9850:         in a central Makefile, <code xmlns=
                   9851:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9852:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    9853: 
                   9854:         <div class="sect1" lang="en" xml:lang="en">
                   9855:           <div class="titlepage">
                   9856:             <div>
                   9857:               <div>
                   9858:                 <h2 class="title" style="clear: both"><a name=
                   9859:                 "build.prefix" id=
1.38      dillo    9860:                 "build.prefix"></a>14.1.&nbsp;Program location</h2>
1.1       grant    9861:               </div>
                   9862:             </div>
                   9863:           </div>
                   9864: 
                   9865:           <p>Before outlining the process performed by the NetBSD
                   9866:           package system in the next section, here's a brief
                   9867:           discussion on where programs are installed, and which
                   9868:           variables influence this.</p>
                   9869: 
1.14      xtraeme  9870:           <p>The automatic variable <code class=
                   9871:           "varname">PREFIX</code> indicates where all files of the
                   9872:           final program shall be installed. It is usually set to
1.45      wiz      9873:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   9874:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9875:           "filename">/usr/pkg</code>), or <code class=
                   9876:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    9877:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  9878:           The value of <code class="varname">PREFIX</code> needs to
                   9879:           be put into the various places in the program's source
                   9880:           where paths to these files are encoded. See <a href=
1.1       grant    9881:           "#components.patches" title=
1.38      dillo    9882:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    9883:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   9884:           title=
1.38      dillo    9885:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    9886:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   9887:           details.</p>
                   9888: 
                   9889:           <p>When choosing which of these variables to use, follow
                   9890:           the following rules:</p>
                   9891: 
                   9892:           <div class="itemizedlist">
                   9893:             <ul type="disc">
                   9894:               <li>
1.14      xtraeme  9895:                 <p><code class="varname">PREFIX</code> always
                   9896:                 points to the location where the current pkg will
                   9897:                 be installed. When referring to a pkg's own
1.1       grant    9898:                 installation path, use &#8220;<span class=
                   9899:                 "quote">${PREFIX}</span>&#8221;.</p>
                   9900:               </li>
                   9901: 
                   9902:               <li>
1.14      xtraeme  9903:                 <p><code class="varname">LOCALBASE</code> is where
                   9904:                 all non-X11 pkgs are installed. If you need to
1.1       grant    9905:                 construct a -I or -L argument to the compiler to
                   9906:                 find includes and libraries installed by another
                   9907:                 non-X11 pkg, use &#8220;<span class=
                   9908:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   9909:               </li>
                   9910: 
                   9911:               <li>
1.14      xtraeme  9912:                 <p><code class="varname">X11BASE</code> is where
                   9913:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    9914:                 installed. When looking for <span class=
                   9915:                 "emphasis"><em>standard</em></span> X11 includes
                   9916:                 (not those installed by a pkg), use
                   9917:                 &#8220;<span class=
                   9918:                 "quote">${X11BASE}</span>&#8221;.</p>
                   9919:               </li>
                   9920: 
                   9921:               <li>
1.47      reed     9922:                 <p>X11-based packages are special in that they may
                   9923:                 be installed in either <code class=
1.14      xtraeme  9924:                 "varname">X11BASE</code> or <code class=
                   9925:                 "varname">LOCALBASE</code>.</p>
1.1       grant    9926: 
                   9927:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  9928:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      9929:                 possible. Note that you will need to include
1.45      wiz      9930:                 <code xmlns=
                   9931:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      9932:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   9933:                 them to request the presence of X11 and to get the
                   9934:                 right compilation flags.</p>
1.1       grant    9935: 
                   9936:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  9937:                 be installed under <code class=
                   9938:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    9939:                 app-defaults files. These packages are special and
1.14      xtraeme  9940:                 they must be placed under <code class=
                   9941:                 "varname">X11BASE</code>. To accomplish this, set
                   9942:                 either <code class="varname">USE_X11BASE</code> or
                   9943:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    9944:                 package.</p>
                   9945: 
1.34      wiz      9946:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  9947:                 libraries installed by a pkg that has <code class=
                   9948:                 "varname">USE_IMAKE</code> or <code class=
                   9949:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      9950:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9951:                 class="filename">Makefile</code>, you need to look
                   9952:                 in <span class="emphasis"><em>both</em></span>
                   9953:                 <code xmlns=
                   9954:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9955:                 "filename">${X11BASE}</code> and <code xmlns=
                   9956:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9957:                 "filename">${LOCALBASE}</code>. To force
                   9958:                 installation of all X11 packages in <code class=
                   9959:                 "varname">LOCALBASE</code>, the <a xmlns=
                   9960:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9961:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      9962:                 target="_top"><code xmlns="" class=
                   9963:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      9964:                 enabled by default.</p>
1.1       grant    9965:               </li>
                   9966: 
                   9967:               <li>
1.14      xtraeme  9968:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    9969:                 used to refer to the installed location of an X11
1.14      xtraeme  9970:                 package. <code class="varname">X11PREFIX</code>
                   9971:                 will be set to <code class="varname">X11BASE</code>
                   9972:                 if xpkgwedge is not installed, and to <code class=
                   9973:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    9974:                 installed.</p>
                   9975:               </li>
                   9976: 
                   9977:               <li>
                   9978:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  9979:                 have some packages installed in <code class=
                   9980:                 "varname">X11BASE</code> and some in <code class=
                   9981:                 "varname">LOCALBASE</code>. To determine the prefix
                   9982:                 of an installed package, the <code class=
                   9983:                 "varname">EVAL_PREFIX</code> definition can be
                   9984:                 used. It takes pairs in the format
                   9985:                 &#8220;<span class=
1.1       grant    9986:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      9987:                 the <a href=
                   9988:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9989:                 <span class="citerefentry"><span class=
                   9990:                 "refentrytitle">make</span>(1)</span></a> variable
                   9991:                 <code class="varname">DIRNAME</code> will be set to
                   9992:                 the prefix of the installed package
                   9993:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    9994:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   9995:                 is not installed.</p>
                   9996: 
                   9997:                 <p>This is best illustrated by example.</p>
                   9998: 
1.45      wiz      9999:                 <p>The following lines are taken from <code xmlns=
                   10000:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10001:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10002:                 <pre class="programlisting">
1.14      xtraeme  10003: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    10004: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10005:                         --with-gtk-prefix="${GTKDIR}"           \
                   10006:                         --enable-multibyte
                   10007: </pre>
                   10008: 
                   10009:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10010:                 packages evaluated using <code class=
                   10011:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10012:                 of the form:</p>
                   10013:                 <pre class="programlisting">
                   10014: GTKDIR_DEFAULT= ${LOCALBASE}
                   10015: </pre>
                   10016: 
1.14      xtraeme  10017:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10018:                 corresponds to the first definition in the
1.14      xtraeme  10019:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10020:               </li>
                   10021: 
                   10022:               <li>
1.45      wiz      10023:                 <p>Within <code xmlns=
                   10024:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10025:                 "filename">${PREFIX}</code>, packages should
                   10026:                 install files according to <a href=
1.24      wiz      10027:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10028:                 <span class="citerefentry"><span class=
                   10029:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10030:                 exception that manual pages go into <code xmlns=
                   10031:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10032:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10033:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10034:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10035:               </li>
                   10036:             </ul>
                   10037:           </div>
                   10038:         </div>
                   10039: 
                   10040:         <div class="sect1" lang="en" xml:lang="en">
                   10041:           <div class="titlepage">
                   10042:             <div>
                   10043:               <div>
                   10044:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10045:                 "main-targets" id=
1.38      dillo    10046:                 "main-targets"></a>14.2.&nbsp;Main targets</h2>
1.1       grant    10047:               </div>
                   10048:             </div>
                   10049:           </div>
                   10050: 
                   10051:           <p>The main targets used during the build process defined
1.45      wiz      10052:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10053:           class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    10054: 
                   10055:           <div class="variablelist">
                   10056:             <dl>
                   10057:               <dt><span class="term">fetch</span></dt>
                   10058: 
                   10059:               <dd>
                   10060:                 <p>This will check if the file(s) given in the
1.14      xtraeme  10061:                 variables <code class="varname">DISTFILES</code>
                   10062:                 and <code class="varname">PATCHFILES</code> (as
                   10063:                 defined in the package's Makefile) are present on
1.45      wiz      10064:                 the local system in <code xmlns=
                   10065:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10066:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   10067:                 are not present, an attempt will be made to fetch
                   10068:                 them using commands of the form:</p>
1.1       grant    10069:                 <pre class="programlisting">
                   10070: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   10071: </pre>
                   10072: 
                   10073:                 <p>where ${site} varies through several
1.14      xtraeme  10074:                 possibilities in turn: first, <code class=
                   10075:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   10076:                 then the sites specified in either <code class=
                   10077:                 "varname">SITES_file</code> if defined, else
                   10078:                 <code class="varname">MASTER_SITES</code> or
                   10079:                 <code class="varname">PATCH_SITES</code>, as
                   10080:                 applies, then finally the value of <code class=
                   10081:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   10082:                 all except the first can be optionally sorted by
                   10083:                 the user, via setting either <code class=
                   10084:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   10085:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    10086:               </dd>
                   10087: 
                   10088:               <dt><span class="term">checksum</span></dt>
                   10089: 
                   10090:               <dd>
                   10091:                 <p>After the distfile(s) are fetched, their
                   10092:                 checksum is generated and compared with the
                   10093:                 checksums stored in the distinfo file. If the
                   10094:                 checksums don't match, the build is aborted. This
                   10095:                 is to ensure the same distfile is used for
                   10096:                 building, and that the distfile wasn't changed,
                   10097:                 e.g. by some malign force, deliberately changed
                   10098:                 distfiles on the master distribution site or
                   10099:                 network lossage.</p>
                   10100:               </dd>
                   10101: 
                   10102:               <dt><span class="term">extract</span></dt>
                   10103: 
                   10104:               <dd>
                   10105:                 <p>When the distfiles are present on the local
                   10106:                 system, they need to be extracted, as they are
                   10107:                 usually in the form of some compressed archive
1.45      wiz      10108:                 format, most commonly <code xmlns=
                   10109:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10110:                 "filename">.tar.gz</code>.</p>
1.1       grant    10111: 
                   10112:                 <p>If only some of the distfiles need to be
                   10113:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  10114:                 be put into <code class=
                   10115:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10116: 
1.45      wiz      10117:                 <p>If the distfiles are not in <code xmlns=
                   10118:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10119:                 "filename">.tar.gz</code> format, they can be
                   10120:                 extracted by setting either <code class=
                   10121:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   10122:                 "varname">EXTRACT_CMD</code>, <code class=
                   10123:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   10124:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   10125:                 the former case, pkgsrc knows how to extract a
1.45      wiz      10126:                 number of suffixes (<code xmlns=
                   10127:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10128:                 "filename">.tar.gz</code>, <code xmlns=
                   10129:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10130:                 "filename">.tgz</code>, <code xmlns=
                   10131:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10132:                 "filename">.tar.gz2</code>, <code xmlns=
                   10133:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10134:                 "filename">.tbz</code>, <code xmlns=
                   10135:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10136:                 "filename">.tar.Z</code>, <code xmlns=
                   10137:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10138:                 "filename">.tar</code>, <code xmlns=
                   10139:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10140:                 "filename">.shar.gz</code>, <code xmlns=
                   10141:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10142:                 "filename">.shar.bz2</code>, <code xmlns=
                   10143:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10144:                 "filename">.shar.Z</code>, <code xmlns=
                   10145:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10146:                 "filename">.shar</code>, <code xmlns=
                   10147:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10148:                 "filename">.Z</code>, <code xmlns=
                   10149:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10150:                 "filename">.bz2</code> and <code xmlns=
                   10151:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10152:                 "filename">.gz</code>; see the definition of the
                   10153:                 various <code class="varname">DECOMPRESS_CMD</code>
1.47      reed     10154:                 variables in <code xmlns=
1.45      wiz      10155:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     10156:                 "filename">bsd.pkg.extract.mk</code> for a complete
                   10157:                 list). Here's an example on how to use the other
                   10158:                 variables for a program that comes with a
                   10159:                 compressed shell archive whose name ends in
                   10160:                 <code xmlns=
1.45      wiz      10161:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10162:                 "filename">.msg.gz</code>:</p>
1.1       grant    10163:                 <pre class="programlisting">
                   10164:      EXTRACT_SUFX=   .msg.gz
                   10165:      EXTRACT_CMD=            zcat
                   10166:      EXTRACT_BEFORE_ARGS=
                   10167:      EXTRACT_AFTER_ARGS=     |sh
                   10168: </pre>
                   10169:               </dd>
                   10170: 
                   10171:               <dt><span class="term">patch</span></dt>
                   10172: 
                   10173:               <dd>
                   10174:                 <p>After extraction, all the patches named by the
1.14      xtraeme  10175:                 <code class="varname">PATCHFILES</code>, those
                   10176:                 present in the patches subdirectory of the package
                   10177:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45      wiz      10178:                 <code xmlns=
                   10179:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10180:                 "filename">/usr/local/patches/graphics/png</code>)
1.45      wiz      10181:                 are applied. Patchfiles ending in <code xmlns=
                   10182:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10183:                 "filename">.Z</code> or <code xmlns=
                   10184:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10185:                 "filename">.gz</code> are uncompressed before they
1.45      wiz      10186:                 are applied, files ending in <code xmlns=
                   10187:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10188:                 "filename">.orig</code> or <code xmlns=
                   10189:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10190:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      10191:                 options to <a href=
                   10192:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10193:                 <span class="citerefentry"><span class=
                   10194:                 "refentrytitle">patch</span>(1)</span></a> can be
                   10195:                 handed in <code class=
1.14      xtraeme  10196:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   10197:                 "#components.patches" title=
1.38      dillo    10198:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10199:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   10200: 
1.24      wiz      10201:                 <p>By default <a href=
                   10202:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10203:                 <span class="citerefentry"><span class=
                   10204:                 "refentrytitle">patch</span>(1)</span></a> is given
                   10205:                 special args to make it fail if the patches apply
                   10206:                 with some lines of fuzz. Please fix (regen) the
                   10207:                 patches so that they apply cleanly. The rationale
                   10208:                 behind this is that patches that don't apply
                   10209:                 cleanly may end up being applied in the wrong
                   10210:                 place, and cause severe harm there.</p>
1.1       grant    10211:               </dd>
                   10212: 
                   10213:               <dt><span class="term">configure</span></dt>
                   10214: 
                   10215:               <dd>
                   10216:                 <p>Most pieces of software need information on the
                   10217:                 header files, system calls, and library routines
                   10218:                 which are available in NetBSD. This is the process
                   10219:                 known as configuration, and is usually automated.
                   10220:                 In most cases, a script is supplied with the
                   10221:                 source, and its invocation results in generation of
                   10222:                 header files, Makefiles, etc.</p>
                   10223: 
                   10224:                 <p>If the program's distfile contains its own
                   10225:                 configure script, this can be invoked by setting
1.14      xtraeme  10226:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    10227:                 configure script is a GNU autoconf script,
1.14      xtraeme  10228:                 <code class="varname">GNU_CONFIGURE</code> should
                   10229:                 be specified instead. In either case, any arguments
                   10230:                 to the configure script can be specified in the
                   10231:                 <code class="varname">CONFIGURE_ARGS</code>
                   10232:                 variable, and the configure script's name can be
                   10233:                 set in <code class=
                   10234:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   10235:                 from the default &#8220;<span class=
1.1       grant    10236:                 "quote">configure</span>&#8221;. Here's an example
                   10237:                 from the <a xmlns=
                   10238:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10239:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45      wiz      10240:                 target="_top"><code xmlns="" class=
                   10241:                 "filename">sysutils/top</code></a> package:</p>
1.1       grant    10242:                 <pre class="programlisting">
                   10243: HAS_CONFIGURE=          yes
                   10244: CONFIGURE_SCRIPT=       Configure
                   10245: CONFIGURE_ARGS+=        netbsd13
                   10246: </pre>
                   10247: 
                   10248:                 <p>If the program uses an Imakefile for
                   10249:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  10250:                 by setting <code class="varname">USE_IMAKE</code>
                   10251:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   10252:                 (If you only want the package installed in
                   10253:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   10254:                 not being run, set <code class=
                   10255:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    10256:               </dd>
                   10257: 
                   10258:               <dt><span class="term">build</span></dt>
                   10259: 
                   10260:               <dd>
                   10261:                 <p>Once configuration has taken place, the software
1.14      xtraeme  10262:                 will be built by invoking <code class=
                   10263:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   10264:                 "varname">$MAKEFILE</code> with <code class=
                   10265:                 "varname">$BUILD_TARGET</code> as the target to
                   10266:                 build. The default <code class=
                   10267:                 "varname">MAKE_PROGRAM</code> is
                   10268:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   10269:                 <code class="varname">USE_TOOLS</code> contains
                   10270:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    10271:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  10272:                 otherwise. <code class="varname">MAKEFILE</code> is
                   10273:                 set to &#8220;<span class=
1.1       grant    10274:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  10275:                 <code class="varname">BUILD_TARGET</code> defaults
                   10276:                 to &#8220;<span class="quote">all</span>&#8221;.
                   10277:                 Any of these variables can be set in the package's
1.1       grant    10278:                 Makefile to change the default build process.</p>
                   10279:               </dd>
                   10280: 
                   10281:               <dt><span class="term">install</span></dt>
                   10282: 
                   10283:               <dd>
                   10284:                 <p>Once the build stage has completed, the final
                   10285:                 step is to install the software in public
                   10286:                 directories, so users can access the programs and
1.14      xtraeme  10287:                 files. As in the build-target, <code class=
                   10288:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   10289:                 <code class="varname">$MAKEFILE</code> here, but
                   10290:                 with the <code class=
                   10291:                 "varname">$INSTALL_TARGET</code> instead, the
                   10292:                 latter defaulting to &#8220;<span class=
                   10293:                 "quote">install</span>&#8221; (plus
                   10294:                 &#8220;<span class=
                   10295:                 "quote">install.man</span>&#8221;, if <code class=
                   10296:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    10297:               </dd>
                   10298:             </dl>
                   10299:           </div>
                   10300: 
                   10301:           <p>If no target is specified, the default is
                   10302:           &#8220;<span class="quote">build</span>&#8221;. If a
                   10303:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  10304:           e.g. <span><strong class="command">make
                   10305:           build</strong></span> will also perform the equivalent
                   10306:           of:</p>
1.1       grant    10307:           <pre class="programlisting">
                   10308: make fetch
                   10309: make checksum
                   10310: make extract
                   10311: make patch
                   10312: make configure
                   10313: make build
                   10314: </pre>
                   10315:         </div>
                   10316: 
                   10317:         <div class="sect1" lang="en" xml:lang="en">
                   10318:           <div class="titlepage">
                   10319:             <div>
                   10320:               <div>
                   10321:                 <h2 class="title" style="clear: both"><a name=
                   10322:                 "build.helpful-targets" id=
1.38      dillo    10323:                 "build.helpful-targets"></a>14.3.&nbsp;Other
1.1       grant    10324:                 helpful targets</h2>
                   10325:               </div>
                   10326:             </div>
                   10327:           </div>
                   10328: 
                   10329:           <div class="variablelist">
                   10330:             <dl>
                   10331:               <dt><span class="term">pre/post-*</span></dt>
                   10332: 
                   10333:               <dd>
                   10334:                 <p>For any of the main targets described in the
                   10335:                 previous section, two auxiliary targets exist with
                   10336:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   10337:                 &#8220;<span class="quote">post-</span>&#8221; used
                   10338:                 as a prefix for the main target's name. These
                   10339:                 targets are invoked before and after the main
                   10340:                 target is called, allowing extra configuration or
                   10341:                 installation steps be performed from a package's
                   10342:                 Makefile, for example, which a program's configure
                   10343:                 script or install target omitted.</p>
                   10344:               </dd>
                   10345: 
                   10346:               <dt><span class="term">do-*</span></dt>
                   10347: 
                   10348:               <dd>
                   10349:                 <p>Should one of the main targets do the wrong
                   10350:                 thing, and should there be no variable to fix this,
                   10351:                 you can redefine it with the do-* target. (Note
                   10352:                 that redefining the target itself instead of the
                   10353:                 do-* target is a bad idea, as the pre-* and post-*
                   10354:                 targets won't be called anymore, etc.) You will not
                   10355:                 usually need to do this.</p>
                   10356:               </dd>
                   10357: 
                   10358:               <dt><span class="term">reinstall</span></dt>
                   10359: 
                   10360:               <dd>
1.14      xtraeme  10361:                 <p>If you did a <span><strong class="command">make
                   10362:                 install</strong></span> and you noticed some file
                   10363:                 was not installed properly, you can repeat the
1.1       grant    10364:                 installation with this target, which will ignore
                   10365:                 the &#8220;<span class="quote">already
                   10366:                 installed</span>&#8221; flag.</p>
                   10367:               </dd>
                   10368: 
                   10369:               <dt><span class="term">deinstall</span></dt>
                   10370: 
                   10371:               <dd>
1.24      wiz      10372:                 <p>This target does a <a href=
                   10373:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10374:                 <span class="citerefentry"><span class=
                   10375:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   10376:                 the current directory, effectively de-installing
                   10377:                 the package. The following variables can be used to
                   10378:                 tune the behaviour:</p>
1.1       grant    10379: 
                   10380:                 <div class="variablelist">
                   10381:                   <dl>
1.14      xtraeme  10382:                     <dt><span class="term"><code class=
                   10383:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    10384: 
                   10385:                     <dd>
                   10386:                       <p>Add a "-v" to the <a href=
                   10387:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10388:                       <span class="citerefentry"><span class=
                   10389:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10390:                       command.</p>
                   10391:                     </dd>
                   10392: 
1.14      xtraeme  10393:                     <dt><span class="term"><code class=
                   10394:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    10395: 
                   10396:                     <dd>
                   10397:                       <p>Remove all packages that require (depend
                   10398:                       on) the given package. This can be used to
                   10399:                       remove any packages that may have been pulled
                   10400:                       in by a given package, e.g. if
1.14      xtraeme  10401:                       <span><strong class="command">make deinstall
                   10402:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      10403:                       <code xmlns=
                   10404:                       "http://www.w3.org/TR/xhtml1/transitional"
                   10405:                       class="filename">pkgsrc/x11/kde</code>, this
                   10406:                       is likely to remove whole KDE. Works by
1.1       grant    10407:                       adding &#8220;<span class=
                   10408:                       "quote">-R</span>&#8221; to the <a href=
                   10409:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10410:                       <span class="citerefentry"><span class=
                   10411:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10412:                       command line.</p>
                   10413:                     </dd>
                   10414:                   </dl>
                   10415:                 </div>
                   10416:               </dd>
                   10417: 
                   10418:               <dt><span class="term">update</span></dt>
                   10419: 
                   10420:               <dd>
                   10421:                 <p>This target causes the current package to be
                   10422:                 updated to the latest version. The package and all
                   10423:                 depending packages first get de-installed, then
                   10424:                 current versions of the corresponding packages get
                   10425:                 compiled and installed. This is similar to manually
                   10426:                 noting which packages are currently installed, then
1.14      xtraeme  10427:                 performing a series of <span><strong class=
                   10428:                 "command">make deinstall</strong></span> and
                   10429:                 <span><strong class="command">make
                   10430:                 install</strong></span> (or whatever <code class=
                   10431:                 "varname">UPDATE_TARGET</code> is set to) for these
                   10432:                 packages.</p>
1.1       grant    10433: 
                   10434:                 <p>You can use the &#8220;<span class=
                   10435:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  10436:                 package updating in case a previous
                   10437:                 <span><strong class="command">make
                   10438:                 update</strong></span> was interrupted for some
                   10439:                 reason. However, in this case, make sure you don't
                   10440:                 call <span><strong class="command">make
                   10441:                 clean</strong></span> or otherwise remove the list
                   10442:                 of dependent packages in <code class=
1.47      reed     10443:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    10444:                 ability to automatically update the current package
                   10445:                 along with the dependent packages you have
                   10446:                 installed.</p>
                   10447: 
1.14      xtraeme  10448:                 <p>Resuming an interrupted <span><strong class=
                   10449:                 "command">make update</strong></span> will only
                   10450:                 work as long as the package tree remains unchanged.
                   10451:                 If the source code for one of the packages to be
                   10452:                 updated has been changed, resuming
                   10453:                 <span><strong class="command">make
                   10454:                 update</strong></span> will most certainly
                   10455:                 fail!</p>
1.1       grant    10456: 
                   10457:                 <p>The following variables can be used either on
1.45      wiz      10458:                 the command line or in <code xmlns=
                   10459:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10460:                 "filename">/etc/mk.conf</code> to alter the
                   10461:                 behaviour of <span><strong class="command">make
                   10462:                 update</strong></span>:</p>
1.1       grant    10463: 
                   10464:                 <div class="variablelist">
                   10465:                   <dl>
1.14      xtraeme  10466:                     <dt><span class="term"><code class=
                   10467:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    10468: 
                   10469:                     <dd>
                   10470:                       <p>Install target to recursively use for the
                   10471:                       updated package and the dependent packages.
1.14      xtraeme  10472:                       Defaults to <code class=
                   10473:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    10474:                       &#8220;<span class=
                   10475:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  10476:                       <span><strong class="command">make
                   10477:                       update</strong></span>. e.g.
                   10478:                       <span><strong class="command">make update
                   10479:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    10480:                     </dd>
                   10481: 
1.14      xtraeme  10482:                     <dt><span class="term"><code class=
                   10483:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    10484: 
                   10485:                     <dd>
                   10486:                       <p>Don't clean up after updating. Useful if
                   10487:                       you want to leave the work sources of the
                   10488:                       updated packages around for inspection or
                   10489:                       other purposes. Be sure you eventually clean
                   10490:                       up the source tree (see the
                   10491:                       &#8220;<span class=
                   10492:                       "quote">clean-update</span>&#8221; target
                   10493:                       below) or you may run into troubles with old
                   10494:                       source code still lying around on your next
1.14      xtraeme  10495:                       <span><strong class=
                   10496:                       "command">make</strong></span> or
                   10497:                       <span><strong class="command">make
                   10498:                       update</strong></span>.</p>
1.1       grant    10499:                     </dd>
                   10500: 
1.14      xtraeme  10501:                     <dt><span class="term"><code class=
                   10502:                     "varname">REINSTALL</code></span></dt>
1.1       grant    10503: 
                   10504:                     <dd>
                   10505:                       <p>Deinstall each package before installing
1.14      xtraeme  10506:                       (making <code class=
                   10507:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    10508:                       necessary if the &#8220;<span class=
                   10509:                       "quote">clean-update</span>&#8221; target
                   10510:                       (see below) was called after interrupting a
1.14      xtraeme  10511:                       running <span><strong class="command">make
                   10512:                       update</strong></span>.</p>
1.1       grant    10513:                     </dd>
                   10514: 
1.14      xtraeme  10515:                     <dt><span class="term"><code class=
                   10516:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    10517: 
                   10518:                     <dd>
                   10519:                       <p>Allows you to disable recursion and
                   10520:                       hardcode the target for packages. The default
                   10521:                       is &#8220;<span class=
                   10522:                       "quote">update</span>&#8221; for the update
                   10523:                       target, facilitating a recursive update of
1.14      xtraeme  10524:                       prerequisite packages. Only set <code class=
                   10525:                       "varname">DEPENDS_TARGET</code> if you want
                   10526:                       to disable recursive updates. Use
                   10527:                       <code class="varname">UPDATE_TARGET</code>
                   10528:                       instead to just set a specific target for
                   10529:                       each package to be installed during
                   10530:                       <span><strong class="command">make
                   10531:                       update</strong></span> (see above).</p>
1.1       grant    10532:                     </dd>
                   10533:                   </dl>
                   10534:                 </div>
                   10535:               </dd>
                   10536: 
                   10537:               <dt><span class="term">clean-update</span></dt>
                   10538: 
                   10539:               <dd>
                   10540:                 <p>Clean the source tree for all packages that
1.14      xtraeme  10541:                 would get updated if <span><strong class=
                   10542:                 "command">make update</strong></span> was called
                   10543:                 from the current directory. This target should not
                   10544:                 be used if the current package (or any of its
                   10545:                 depending packages) have already been de-installed
                   10546:                 (e.g., after calling <span><strong class=
                   10547:                 "command">make update</strong></span>) or you may
                   10548:                 lose some packages you intended to update. As a
                   10549:                 rule of thumb: only use this target <span class=
                   10550:                 "emphasis"><em>before</em></span> the first time
                   10551:                 you run <span><strong class="command">make
                   10552:                 update</strong></span> and only if you have a dirty
                   10553:                 package tree (e.g., if you used <code class=
                   10554:                 "varname">NOCLEAN</code>).</p>
1.1       grant    10555: 
1.47      reed     10556:                 <p>If you are unsure about whether your tree is
                   10557:                 clean, you can either perform a
1.14      xtraeme  10558:                 <span><strong class="command">make
1.47      reed     10559:                 clean</strong></span> at the top of the tree, or
                   10560:                 use the following sequence of commands from the
                   10561:                 directory of the package you want to update
                   10562:                 (<span class="emphasis"><em>before</em></span>
                   10563:                 running <span><strong class="command">make
1.14      xtraeme  10564:                 update</strong></span> for the first time,
                   10565:                 otherwise you lose all the packages you wanted to
                   10566:                 update!):</p>
1.1       grant    10567:                 <pre class="screen">
1.14      xtraeme  10568: <code class="prompt">#</code> <strong class=
                   10569: "userinput"><code>make clean-update</code></strong>
                   10570: <code class="prompt">#</code> <strong class=
                   10571: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   10572: <code class="prompt">#</code> <strong class=
                   10573: "userinput"><code>make update</code></strong>
1.1       grant    10574: </pre>
                   10575: 
                   10576:                 <p>The following variables can be used either on
1.45      wiz      10577:                 the command line or in <code xmlns=
                   10578:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10579:                 "filename">/etc/mk.conf</code> to alter the
                   10580:                 behaviour of <span><strong class="command">make
                   10581:                 clean-update</strong></span>:</p>
1.1       grant    10582: 
                   10583:                 <div class="variablelist">
                   10584:                   <dl>
1.14      xtraeme  10585:                     <dt><span class="term"><code class=
                   10586:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    10587: 
                   10588:                     <dd>
1.14      xtraeme  10589:                       <p>After <span><strong class="command">make
                   10590:                       clean</strong></span>, do not reconstruct the
                   10591:                       list of directories to update for this
                   10592:                       package. Only use this if
                   10593:                       <span><strong class="command">make
                   10594:                       update</strong></span> successfully installed
                   10595:                       all packages you wanted to update. Normally,
                   10596:                       this is done automatically on
                   10597:                       <span><strong class="command">make
                   10598:                       update</strong></span>, but may have been
                   10599:                       suppressed by the <code class=
                   10600:                       "varname">NOCLEAN</code> variable (see
1.1       grant    10601:                       above).</p>
                   10602:                     </dd>
                   10603:                   </dl>
                   10604:                 </div>
                   10605:               </dd>
                   10606: 
                   10607:               <dt><span class="term">info</span></dt>
                   10608: 
                   10609:               <dd>
                   10610:                 <p>This target invokes <a href=
                   10611:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   10612:                 <span class="citerefentry"><span class=
                   10613:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   10614:                 the current package. You can use this to check
                   10615:                 which version of a package is installed.</p>
                   10616:               </dd>
                   10617: 
                   10618:               <dt><span class="term">readme</span></dt>
                   10619: 
                   10620:               <dd>
1.45      wiz      10621:                 <p>This target generates a <code xmlns=
                   10622:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10623:                 "filename">README.html</code> file, which can be
1.1       grant    10624:                 viewed using a browser such as <a xmlns=
                   10625:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10626:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      10627:                 target="_top"><code xmlns="" class=
                   10628:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      10629:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10630:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      10631:                 target="_top"><code xmlns="" class=
                   10632:                 "filename">www/links</code></a>. The generated
                   10633:                 files contain references to any packages which are
                   10634:                 in the <code class="varname">PACKAGES</code>
                   10635:                 directory on the local host. The generated files
                   10636:                 can be made to refer to URLs based on <code class=
1.20      ben      10637:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   10638:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      10639:                 wanted to generate <code xmlns=
                   10640:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      10641:                 "filename">README.html</code> files which pointed
                   10642:                 to binary packages on the local machine, in the
1.45      wiz      10643:                 directory <code xmlns=
                   10644:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      10645:                 "filename">/usr/packages</code>, set <code class=
                   10646:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   10647:                 and <code class=
                   10648:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   10649:                 <code class="varname">${PACKAGES}</code> directory
                   10650:                 and its subdirectories will be searched for all the
                   10651:                 binary packages.</p>
1.1       grant    10652:               </dd>
                   10653: 
                   10654:               <dt><span class="term">readme-all</span></dt>
                   10655: 
                   10656:               <dd>
1.45      wiz      10657:                 <p>Use this target to create a file <code xmlns=
                   10658:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10659:                 "filename">README-all.html</code> which contains a
1.1       grant    10660:                 list of all packages currently available in the
                   10661:                 NetBSD Packages Collection, together with the
                   10662:                 category they belong to and a short description.
1.45      wiz      10663:                 This file is compiled from the <code xmlns=
                   10664:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10665:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    10666:                 sure to run this <span class=
1.14      xtraeme  10667:                 "emphasis"><em>after</em></span> a
                   10668:                 <span><strong class="command">make
                   10669:                 readme</strong></span>.</p>
1.1       grant    10670:               </dd>
                   10671: 
                   10672:               <dt><span class="term">cdrom-readme</span></dt>
                   10673: 
                   10674:               <dd>
                   10675:                 <p>This is very much the same as the
                   10676:                 &#8220;<span class="quote">readme</span>&#8221;
                   10677:                 target (see above), but is to be used when
                   10678:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      10679:                 This target also produces <code xmlns=
                   10680:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10681:                 "filename">README.html</code> files, and can be
                   10682:                 made to refer to URLs based on <code class=
                   10683:                 "varname">CDROM_PKG_URL_HOST</code> and
                   10684:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    10685:               </dd>
                   10686: 
                   10687:               <dt><span class="term">show-distfiles</span></dt>
                   10688: 
                   10689:               <dd>
                   10690:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  10691:                 are needed to build the package. (<code class=
                   10692:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      10693:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   10694:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10695:                 "filename">patches/*</code>)</p>
1.1       grant    10696:               </dd>
                   10697: 
                   10698:               <dt><span class="term">show-downlevel</span></dt>
                   10699: 
                   10700:               <dd>
                   10701:                 <p>This target shows nothing if the package is not
                   10702:                 installed. If a version of this package is
                   10703:                 installed, but is not the version provided in this
                   10704:                 version of pkgsrc, then a warning message is
                   10705:                 displayed. This target can be used to show which of
                   10706:                 your installed packages are downlevel, and so the
                   10707:                 old versions can be deleted, and the current ones
                   10708:                 added.</p>
                   10709:               </dd>
                   10710: 
                   10711:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   10712: 
                   10713:               <dd>
                   10714:                 <p>This target shows the directory in the pkgsrc
                   10715:                 hierarchy from which the package can be built and
                   10716:                 installed. This may not be the same directory as
                   10717:                 the one from which the package was installed. This
                   10718:                 target is intended to be used by people who may
                   10719:                 wish to upgrade many packages on a single host, and
                   10720:                 can be invoked from the top-level pkgsrc Makefile
                   10721:                 by using the &#8220;<span class=
                   10722:                 "quote">show-host-specific-pkgs</span>&#8221;
                   10723:                 target.</p>
                   10724:               </dd>
                   10725: 
                   10726:               <dt><span class=
                   10727:               "term">show-installed-depends</span></dt>
                   10728: 
                   10729:               <dd>
                   10730:                 <p>This target shows which installed packages match
1.14      xtraeme  10731:                 the current package's <code class=
                   10732:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    10733:                 dependencies are causing build problems.</p>
                   10734:               </dd>
                   10735: 
                   10736:               <dt><span class="term">check-shlibs</span></dt>
                   10737: 
                   10738:               <dd>
                   10739:                 <p>After a package is installed, check all its
                   10740:                 binaries and (on ELF platforms) shared libraries to
                   10741:                 see if they find the shared libs they need. Run by
1.14      xtraeme  10742:                 default if <code class=
                   10743:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      10744:                 <code xmlns=
                   10745:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10746:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    10747:               </dd>
                   10748: 
                   10749:               <dt><span class="term">print-PLIST</span></dt>
                   10750: 
                   10751:               <dd>
                   10752:                 <p>After a &#8220;<span class="quote">make
                   10753:                 install</span>&#8221; from a new or upgraded pkg,
                   10754:                 this prints out an attempt to generate a new
1.45      wiz      10755:                 <code xmlns=
                   10756:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10757:                 "filename">PLIST</code> from a <span><strong class=
                   10758:                 "command">find -newer
1.14      xtraeme  10759:                 work/.extract_done</strong></span>. An attempt is
                   10760:                 made to care for shared libs etc., but it is
1.1       grant    10761:                 <span class="emphasis"><em>strongly</em></span>
                   10762:                 recommended to review the result before putting it
1.45      wiz      10763:                 into <code xmlns=
                   10764:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10765:                 "filename">PLIST</code>. On upgrades, it's useful
                   10766:                 to diff the output of this command against an
                   10767:                 already existing <code xmlns=
                   10768:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10769:                 "filename">PLIST</code> file.</p>
1.1       grant    10770: 
1.24      wiz      10771:                 <p>If the package installs files via <a href=
                   10772:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   10773:                 <span class="citerefentry"><span class=
                   10774:                 "refentrytitle">tar</span>(1)</span></a> or other
                   10775:                 methods that don't update file access times, be
                   10776:                 sure to add these files manually to your
1.45      wiz      10777:                 <code xmlns=
                   10778:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10779:                 "filename">PLIST</code>, as the &#8220;<span class=
                   10780:                 "quote">find -newer</span>&#8221; command used by
                   10781:                 this target won't catch them!</p>
1.1       grant    10782: 
                   10783:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    10784:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  10785:                 &#8220;Tweaking output of <span><strong class=
                   10786:                 "command">make
                   10787:                 print-PLIST</strong></span>&#8221;</a> for more
                   10788:                 information on this target.</p>
1.1       grant    10789:               </dd>
                   10790: 
                   10791:               <dt><span class="term">bulk-package</span></dt>
                   10792: 
                   10793:               <dd>
                   10794:                 <p>Used to do bulk builds. If an appropriate binary
                   10795:                 package already exists, no action is taken. If not,
                   10796:                 this target will compile, install and package it
1.47      reed     10797:                 (and its depends, if <code class=
1.14      xtraeme  10798:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    10799:                 <a href="#binary.configuration" title=
1.38      dillo    10800:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     10801:                 &#8220;Configuration&#8221;</a>). After creating
                   10802:                 the binary package, the sources, the just-installed
                   10803:                 package and its required packages are removed,
1.1       grant    10804:                 preserving free disk space.</p>
                   10805: 
                   10806:                 <p><span class="emphasis"><em>Beware that this
                   10807:                 target may deinstall all packages installed on a
                   10808:                 system!</em></span></p>
                   10809:               </dd>
                   10810: 
                   10811:               <dt><span class="term">bulk-install</span></dt>
                   10812: 
                   10813:               <dd>
                   10814:                 <p>Used during bulk-installs to install required
1.47      reed     10815:                 packages. If an up-to-date binary package is
1.1       grant    10816:                 available, it will be installed via <a href=
                   10817:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   10818:                 <span class="citerefentry"><span class=
                   10819:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  10820:                 not, <span><strong class="command">make
                   10821:                 bulk-package</strong></span> will be executed, but
1.47      reed     10822:                 the installed binary won't be removed.</p>
1.1       grant    10823: 
                   10824:                 <p>A binary package is considered
1.47      reed     10825:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    10826:                 to be installed via <a href=
                   10827:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   10828:                 <span class="citerefentry"><span class=
                   10829:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   10830:                 if:</p>
                   10831: 
                   10832:                 <div class="itemizedlist">
                   10833:                   <ul type="disc">
                   10834:                     <li>
1.45      wiz      10835:                       <p>None of the package's files (<code xmlns=
                   10836:                       "http://www.w3.org/TR/xhtml1/transitional"
                   10837:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  10838:                       modified since it was built.</p>
1.1       grant    10839:                     </li>
                   10840: 
                   10841:                     <li>
                   10842:                       <p>None of the package's required (binary)
                   10843:                       packages were modified since it was
                   10844:                       built.</p>
                   10845:                     </li>
                   10846:                   </ul>
                   10847:                 </div>
                   10848: 
                   10849:                 <p><span class="emphasis"><em>Beware that this
                   10850:                 target may deinstall all packages installed on a
                   10851:                 system!</em></span></p>
                   10852:               </dd>
                   10853:             </dl>
                   10854:           </div>
                   10855:         </div>
                   10856:       </div>
                   10857: 
                   10858:       <div class="chapter" lang="en" xml:lang="en">
                   10859:         <div class="titlepage">
                   10860:           <div>
                   10861:             <div>
                   10862:               <h2 class="title"><a name="fixes" id=
1.38      dillo    10863:               "fixes"></a>Chapter&nbsp;15.&nbsp;Notes on fixes for
1.1       grant    10864:               packages</h2>
                   10865:             </div>
                   10866:           </div>
                   10867:         </div>
                   10868: 
                   10869:         <div class="toc">
                   10870:           <p><b>Table of Contents</b></p>
                   10871: 
                   10872:           <dl>
1.30      wiz      10873:             <dt><span class="sect1"><a href=
1.38      dillo    10874:             "#general-operation">15.1. General
1.30      wiz      10875:             operation</a></span></dt>
1.1       grant    10876: 
                   10877:             <dd>
                   10878:               <dl>
                   10879:                 <dt><span class="sect2"><a href=
1.38      dillo    10880:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      10881:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    10882: 
                   10883:                 <dt><span class="sect2"><a href=
1.38      dillo    10884:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      10885:                 install documentation</a></span></dt>
                   10886: 
                   10887:                 <dt><span class="sect2"><a href=
1.38      dillo    10888:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    10889:                 packages</a></span></dt>
                   10890: 
                   10891:                 <dt><span class="sect2"><a href=
1.38      dillo    10892:                 "#dependencies">15.1.4. Handling
1.1       grant    10893:                 dependencies</a></span></dt>
                   10894: 
                   10895:                 <dt><span class="sect2"><a href=
1.38      dillo    10896:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    10897:                 packages</a></span></dt>
                   10898: 
                   10899:                 <dt><span class="sect2"><a href=
1.38      dillo    10900:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      10901:                 cannot or should not be built</a></span></dt>
1.1       grant    10902: 
                   10903:                 <dt><span class="sect2"><a href=
1.38      dillo    10904:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      10905:                 should not be deleted, once
                   10906:                 installed</a></span></dt>
1.1       grant    10907: 
                   10908:                 <dt><span class="sect2"><a href=
1.38      dillo    10909:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    10910:                 security problems</a></span></dt>
                   10911: 
                   10912:                 <dt><span class="sect2"><a href=
1.38      dillo    10913:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    10914:                 bugs</a></span></dt>
                   10915: 
                   10916:                 <dt><span class="sect2"><a href=
1.38      dillo    10917:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      10918:                 incrementing versions when fixing an existing
1.1       grant    10919:                 package</a></span></dt>
                   10920: 
                   10921:                 <dt><span class="sect2"><a href=
1.38      dillo    10922:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    10923:                 packages</a></span></dt>
                   10924:               </dl>
                   10925:             </dd>
                   10926: 
1.30      wiz      10927:             <dt><span class="sect1"><a href=
1.38      dillo    10928:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      10929:             issues</a></span></dt>
1.1       grant    10930: 
                   10931:             <dd>
                   10932:               <dl>
                   10933:                 <dt><span class="sect2"><a href=
1.38      dillo    10934:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      10935:                 distfiles aren't available for plain
1.1       grant    10936:                 downloading</a></span></dt>
                   10937: 
                   10938:                 <dt><span class="sect2"><a href=
1.38      dillo    10939:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      10940:                 handle modified distfiles with the 'old'
                   10941:                 name</a></span></dt>
1.1       grant    10942:               </dl>
                   10943:             </dd>
                   10944: 
1.30      wiz      10945:             <dt><span class="sect1"><a href=
1.38      dillo    10946:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      10947:             gotchas</a></span></dt>
1.1       grant    10948: 
                   10949:             <dd>
                   10950:               <dl>
                   10951:                 <dt><span class="sect2"><a href=
1.38      dillo    10952:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    10953:                 libtool</a></span></dt>
                   10954: 
                   10955:                 <dt><span class="sect2"><a href=
1.38      dillo    10956:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      10957:                 packages that already support
                   10958:                 libtool</a></span></dt>
1.1       grant    10959: 
                   10960:                 <dt><span class="sect2"><a href=
1.38      dillo    10961:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    10962:                 Autoconf/Automake</a></span></dt>
                   10963:               </dl>
                   10964:             </dd>
                   10965: 
1.30      wiz      10966:             <dt><span class="sect1"><a href=
1.38      dillo    10967:             "#building-considerations">15.4. Building
1.30      wiz      10968:             considerations</a></span></dt>
1.1       grant    10969: 
                   10970:             <dd>
                   10971:               <dl>
                   10972:                 <dt><span class="sect2"><a href=
1.38      dillo    10973:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1       grant    10974:               </dl>
                   10975:             </dd>
                   10976: 
1.30      wiz      10977:             <dt><span class="sect1"><a href=
1.38      dillo    10978:             "#package-specific-actions">15.5. Package specific
1.30      wiz      10979:             actions</a></span></dt>
1.1       grant    10980: 
                   10981:             <dd>
                   10982:               <dl>
                   10983:                 <dt><span class="sect2"><a href=
1.38      dillo    10984:                 "#user-interaction">15.5.1. User
1.2       hubertf  10985:                 interaction</a></span></dt>
1.1       grant    10986: 
                   10987:                 <dt><span class="sect2"><a href=
1.38      dillo    10988:                 "#handling-licenses">15.5.2. Handling
1.1       grant    10989:                 licenses</a></span></dt>
                   10990: 
                   10991:                 <dt><span class="sect2"><a href=
1.38      dillo    10992:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    10993:                 files</a></span></dt>
                   10994: 
                   10995:                 <dt><span class="sect2"><a href=
1.38      dillo    10996:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    10997:                 scripts</a></span></dt>
                   10998: 
                   10999:                 <dt><span class="sect2"><a href=
1.38      dillo    11000:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11001:                 paths to other interpreters</a></span></dt>
1.1       grant    11002: 
                   11003:                 <dt><span class="sect2"><a href=
1.38      dillo    11004:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11005:                 modules</a></span></dt>
                   11006: 
                   11007:                 <dt><span class="sect2"><a href=
1.38      dillo    11008:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11009:                 files</a></span></dt>
                   11010: 
                   11011:                 <dt><span class="sect2"><a href=
1.38      dillo    11012:                 "#gconf2-data-files">15.5.8. Packages installing
1.30      wiz      11013:                 GConf2 data files</a></span></dt>
1.1       grant    11014: 
                   11015:                 <dt><span class="sect2"><a href=
1.38      dillo    11016:                 "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz      11017:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11018: 
                   11019:                 <dt><span class="sect2"><a href=
1.38      dillo    11020:                 "#x11-fonts">15.5.10. Packages installing X11
1.1       grant    11021:                 fonts</a></span></dt>
                   11022: 
                   11023:                 <dt><span class="sect2"><a href=
1.38      dillo    11024:                 "#gtk2-modules">15.5.11. Packages installing GTK2
1.1       grant    11025:                 modules</a></span></dt>
                   11026: 
                   11027:                 <dt><span class="sect2"><a href=
1.38      dillo    11028:                 "#sgml-xml-data">15.5.12. Packages installing SGML
1.30      wiz      11029:                 or XML data</a></span></dt>
1.1       grant    11030: 
                   11031:                 <dt><span class="sect2"><a href=
1.38      dillo    11032:                 "#mime-database">15.5.13. Packages installing
1.1       grant    11033:                 extensions to the MIME database</a></span></dt>
                   11034: 
                   11035:                 <dt><span class="sect2"><a href=
1.38      dillo    11036:                 "#intltool">15.5.14. Packages using
1.1       grant    11037:                 intltool</a></span></dt>
1.18      xtraeme  11038: 
                   11039:                 <dt><span class="sect2"><a href=
1.38      dillo    11040:                 "#startup-scripts">15.5.15. Packages installing
1.30      wiz      11041:                 startup scripts</a></span></dt>
1.1       grant    11042:               </dl>
                   11043:             </dd>
                   11044: 
1.30      wiz      11045:             <dt><span class="sect1"><a href=
1.38      dillo    11046:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11047:             author</a></span></dt>
1.1       grant    11048:           </dl>
                   11049:         </div>
                   11050: 
                   11051:         <div class="sect1" lang="en" xml:lang="en">
                   11052:           <div class="titlepage">
                   11053:             <div>
                   11054:               <div>
                   11055:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11056:                 "general-operation" id=
1.38      dillo    11057:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11058:                 operation</h2>
                   11059:               </div>
                   11060:             </div>
                   11061:           </div>
                   11062: 
                   11063:           <div class="sect2" lang="en" xml:lang="en">
                   11064:             <div class="titlepage">
                   11065:               <div>
                   11066:                 <div>
1.30      wiz      11067:                   <h3 class="title"><a name=
                   11068:                   "pulling-vars-from-etc-mk.conf" id=
1.38      dillo    11069:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11070:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11071:                 </div>
                   11072:               </div>
                   11073:             </div>
                   11074: 
                   11075:             <p>The problem with package-defined variables that can
1.14      xtraeme  11076:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11077:             or <code xmlns=
                   11078:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11079:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11080:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11081:             <span class="citerefentry"><span class=
                   11082:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11083:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11084:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11085:             So, to use any variable (which may be set in
1.45      wiz      11086:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11087:             class="filename">/etc/mk.conf</code>) in one of the
                   11088:             .if* statements, the file <code xmlns=
                   11089:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11090:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11091:             that .if* statement.</p>
                   11092: 
1.47      reed     11093:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11094:             including <code xmlns=
                   11095:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11096:             "filename">/etc/mk.conf</code>, should it exist, or
                   11097:             <code class="varname">MAKECONF</code>, should it exist,
                   11098:             include the <code xmlns=
                   11099:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11100:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11101:             package Makefile before any preprocessor-like .if,
                   11102:             .ifdef, or .ifndef statements:</p>
1.1       grant    11103:             <pre class="programlisting">
                   11104: .include "../../mk/bsd.prefs.mk"
                   11105:     
                   11106:     .if defined(USE_MENUS)
                   11107:       ...
                   11108:     .endif
                   11109: </pre>
                   11110: 
1.14      xtraeme  11111:             <p>If you wish to set the <code class=
1.45      wiz      11112:             "varname">CFLAGS</code> variable in <code xmlns=
                   11113:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11114:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11115:             use:</p>
                   11116:             <pre class="programlisting">
                   11117: CFLAGS+=  -your -flags
                   11118: </pre>
                   11119: 
1.14      xtraeme  11120:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11121:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11122:             may lead to problems with packages that need to add
                   11123:             their own flags. Also, you may want to take a look at
                   11124:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11125:             href=
                   11126:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11127:             target="_top"><code xmlns="" class=
                   11128:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11129:             interested in optimization for the current CPU.</p>
1.1       grant    11130:           </div>
                   11131: 
                   11132:           <div class="sect2" lang="en" xml:lang="en">
                   11133:             <div class="titlepage">
                   11134:               <div>
                   11135:                 <div>
1.31      wiz      11136:                   <h3 class="title"><a name=
                   11137:                   "where-to-install-documentation" id=
1.38      dillo    11138:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11139:                   to install documentation</h3>
                   11140:                 </div>
                   11141:               </div>
                   11142:             </div>
                   11143: 
1.45      wiz      11144:             <p>Documentation should be installed into <code xmlns=
                   11145:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11146:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11147:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11148:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11149:             (the latter includes the version number of the
                   11150:             package).</p>
1.31      wiz      11151:           </div>
                   11152: 
                   11153:           <div class="sect2" lang="en" xml:lang="en">
                   11154:             <div class="titlepage">
                   11155:               <div>
                   11156:                 <div>
1.30      wiz      11157:                   <h3 class="title"><a name="restricted-packages"
                   11158:                   id=
1.38      dillo    11159:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11160:                   packages</h3>
                   11161:                 </div>
                   11162:               </div>
                   11163:             </div>
                   11164: 
                   11165:             <p>Some licenses restrict how software may be
                   11166:             re-distributed. In order to satisfy these restrictions,
                   11167:             the package system defines five make variables that can
                   11168:             be set to note these restrictions:</p>
                   11169: 
                   11170:             <div class="itemizedlist">
                   11171:               <ul type="disc">
                   11172:                 <li>
1.14      xtraeme  11173:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11174: 
                   11175:                   <p>This variable should be set whenever a
                   11176:                   restriction exists (regardless of its kind). Set
                   11177:                   this variable to a string containing the reason
                   11178:                   for the restriction.</p>
                   11179:                 </li>
                   11180: 
                   11181:                 <li>
1.14      xtraeme  11182:                   <p><code class=
                   11183:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11184: 
                   11185:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11186:                   variable to <code class=
                   11187:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11188:                   package may not be included on a CD-ROM.</p>
                   11189:                 </li>
                   11190: 
                   11191:                 <li>
1.14      xtraeme  11192:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11193: 
                   11194:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11195:                   Set this variable to <code class=
                   11196:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11197:                   package may not not be made available on the
                   11198:                   Internet.</p>
                   11199:                 </li>
                   11200: 
                   11201:                 <li>
1.14      xtraeme  11202:                   <p><code class=
                   11203:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11204: 
                   11205:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11206:                   this variable to <code class=
                   11207:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11208:                   of the source code or other distfile(s) is not
                   11209:                   allowed on CD-ROMs.</p>
                   11210:                 </li>
                   11211: 
                   11212:                 <li>
1.14      xtraeme  11213:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11214: 
                   11215:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11216:                   variable to <code class=
                   11217:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11218:                   of the source code or other distfile(s) via the
                   11219:                   Internet is not allowed.</p>
                   11220:                 </li>
                   11221:               </ul>
                   11222:             </div>
                   11223: 
1.14      xtraeme  11224:             <p>Please note that the use of <code class=
                   11225:             "varname">NO_PACKAGE</code>, <code class=
                   11226:             "varname">IGNORE</code>, <code class=
                   11227:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11228:             variables to denote restrictions is deprecated, because
                   11229:             they unconditionally prevent users from generating
                   11230:             binary packages!</p>
                   11231:           </div>
                   11232: 
                   11233:           <div class="sect2" lang="en" xml:lang="en">
                   11234:             <div class="titlepage">
                   11235:               <div>
                   11236:                 <div>
                   11237:                   <h3 class="title"><a name="dependencies" id=
1.38      dillo    11238:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11239:                   dependencies</h3>
                   11240:                 </div>
                   11241:               </div>
                   11242:             </div>
                   11243: 
                   11244:             <p>Your package may depend on some other package being
                   11245:             present - and there are various ways of expressing this
1.14      xtraeme  11246:             dependency. pkgsrc supports the <code class=
                   11247:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11248:             "varname">DEPENDS</code> definitions, the <code class=
                   11249:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11250:             dependencies via <code xmlns=
                   11251:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11252:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11253:             way to handle dependencies, and which uses the
                   11254:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11255:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11256:             <i>Buildlink methodology</i></a> for more
                   11257:             information.</p>
                   11258: 
                   11259:             <p>The basic difference between the two variables is as
1.14      xtraeme  11260:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11261:             definition registers that pre-requisite in the binary
                   11262:             package so it will be pulled in when the binary package
1.14      xtraeme  11263:             is later installed, whilst the <code class=
                   11264:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11265:             marking a dependency that is only needed for building
                   11266:             the package.</p>
                   11267: 
                   11268:             <p>This means that if you only need a package present
                   11269:             whilst you are building, it should be noted as a
1.14      xtraeme  11270:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11271: 
1.14      xtraeme  11272:             <p>The format for a <code class=
                   11273:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11274:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11275:             <pre class="programlisting">
                   11276: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   11277: </pre>
                   11278: 
                   11279:             <p>Please note that the &#8220;<span class=
                   11280:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  11281:             any of the wildcard version numbers recognized by
1.1       grant    11282:             <a href=
                   11283:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11284:             <span class="citerefentry"><span class=
                   11285:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   11286: 
                   11287:             <div class="orderedlist">
                   11288:               <ol type="1">
                   11289:                 <li>
                   11290:                   <p>If your package needs another package's
                   11291:                   binaries or libraries to build or run, and if
1.45      wiz      11292:                   that package has a <code xmlns=
                   11293:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11294:                   "filename">buildlink3.mk</code> file available,
                   11295:                   use it:</p>
1.1       grant    11296:                   <pre class="programlisting">
                   11297:     .include "../../graphics/jpeg/buildlink3.mk"
                   11298:     
                   11299: </pre>
                   11300:                 </li>
                   11301: 
                   11302:                 <li>
                   11303:                   <p>If your package needs to use another package
1.45      wiz      11304:                   to build itself and there is no <code xmlns=
                   11305:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11306:                   "filename">buildlink3.mk</code> file available,
                   11307:                   use the <code class=
                   11308:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    11309:                   <pre class="programlisting">
                   11310: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   11311: </pre>
                   11312:                 </li>
                   11313: 
                   11314:                 <li>
                   11315:                   <p>If your package needs a library with which to
1.45      wiz      11316:                   link and again there is no <code xmlns=
                   11317:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11318:                   "filename">buildlink3.mk</code> file available,
                   11319:                   this is specified using the <code class=
                   11320:                   "varname">DEPENDS</code> definition. An example
                   11321:                   of this is the <a xmlns=
1.1       grant    11322:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11323:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11324:                   target="_top"><code xmlns="" class=
                   11325:                   "filename">print/lyx</code></a> package, which
                   11326:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    11327:                   <pre class="programlisting">
                   11328: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   11329: </pre>
                   11330: 
                   11331:                   <p>You can also use wildcards in package
                   11332:                   dependences:</p>
                   11333:                   <pre class="programlisting">
                   11334: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   11335: </pre>
                   11336: 
                   11337:                   <p>Note that such wildcard dependencies are
                   11338:                   retained when creating binary packages. The
                   11339:                   dependency is checked when installing the binary
                   11340:                   package and any package which matches the pattern
                   11341:                   will be used. Wildcard dependencies should be
                   11342:                   used with care.</p>
                   11343: 
                   11344:                   <p>The &#8220;<span class=
                   11345:                   "quote">-[0-9]*</span>&#8221; should be used
                   11346:                   instead of &#8220;<span class=
                   11347:                   "quote">-*</span>&#8221; to avoid potentially
                   11348:                   ambiguous matches such as &#8220;<span class=
                   11349:                   "quote">tk-postgresql</span>&#8221; matching a
                   11350:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  11351:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    11352: 
                   11353:                   <p>Wildcards can also be used to specify that a
                   11354:                   package will only build against a certain minimum
                   11355:                   version of a pre-requisite:</p>
                   11356:                   <pre class="programlisting">
                   11357: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   11358: </pre>
                   11359: 
                   11360:                   <p>This means that the package will build against
                   11361:                   version 3.5.4 of the tiff library or newer. Such
                   11362:                   a dependency may be warranted if, for example,
                   11363:                   the API of the library has changed with version
                   11364:                   3.5.4 and a package would not compile against an
                   11365:                   earlier version of tiff.</p>
                   11366: 
                   11367:                   <p>Please note that such dependencies should only
                   11368:                   be updated if a package requires a newer
                   11369:                   pre-requisite, but not to denote recommendations
                   11370:                   such as security updates or ABI changes that do
                   11371:                   not prevent a package from building correctly.
                   11372:                   Such recommendations can be expressed using
1.14      xtraeme  11373:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    11374:                   <pre class="programlisting">
                   11375: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   11376: </pre>
                   11377: 
1.14      xtraeme  11378:                   <p>In addition to the above <code class=
                   11379:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    11380:                   while a package will build against
                   11381:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  11382:                   recommended. <code class=
                   11383:                   "varname">RECOMMENDED</code> entries will be
                   11384:                   turned into dependencies unless explicitly
                   11385:                   ignored (in which case a warning will be
1.36      wiz      11386:                   printed).</p>
                   11387: 
                   11388:                   <p>To ignore these dependency recommendations and
                   11389:                   just use the required <code class=
                   11390:                   "varname">DEPENDS</code>, set <code class=
                   11391:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   11392:                   make it easier and faster to update packages
                   11393:                   built using pkgsrc, since older compatible
                   11394:                   dependencies can continue to be used. This is
                   11395:                   useful for people who watch their rebuilds very
                   11396:                   carefully; it is not very good as a
                   11397:                   general-purpose hammer. If you use it, you need
                   11398:                   to be mindful of possible ABI changes, including
                   11399:                   those from the underlying OS.</p>
                   11400: 
                   11401:                   <p>Packages that are built with recommendations
                   11402:                   ignored may not be uploaded to ftp.NetBSD.org by
                   11403:                   developers and should not be used across
                   11404:                   different systems that may have different
                   11405:                   versions of binary packages installed.</p>
1.1       grant    11406: 
                   11407:                   <p>For security fixes, please update the package
                   11408:                   vulnerabilities file as well as setting
1.14      xtraeme  11409:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    11410:                   <a href="#security-handling" title=
1.38      dillo    11411:                   "15.1.8.&nbsp;Handling packages with security problems">
                   11412:                   Section 15.1.8, &#8220;Handling packages with
1.1       grant    11413:                   security problems&#8221;</a> for more
                   11414:                   information.</p>
                   11415:                 </li>
                   11416: 
                   11417:                 <li>
                   11418:                   <p>If your package needs some executable to be
1.17      sketch   11419:                   able to run correctly and if there's no
1.45      wiz      11420:                   <code xmlns=
                   11421:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   11422:                   "filename">buildlink3.mk</code> file, this is
                   11423:                   specified using the <code class=
1.14      xtraeme  11424:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    11425:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11426:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11427:                   target="_top"><code xmlns="" class=
                   11428:                   "filename">print/lyx</code></a> package needs to
                   11429:                   be able to execute the latex binary from the
                   11430:                   teTeX package when it runs, and that is
                   11431:                   specified:</p>
1.1       grant    11432:                   <pre class="programlisting">
                   11433: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   11434: </pre>
                   11435: 
                   11436:                   <p>The comment about wildcard dependencies from
                   11437:                   previous paragraph applies here, too.</p>
                   11438:                 </li>
                   11439:               </ol>
                   11440:             </div>
                   11441: 
                   11442:             <p>If your package needs files from another package to
                   11443:             build, see the first part of the &#8220;<span class=
                   11444:             "quote">do-configure</span>&#8221; target <a xmlns=
                   11445:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11446:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      11447:             target="_top"><code xmlns="" class=
                   11448:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      11449:             relies on the jpeg sources being present in source form
                   11450:             during the build):</p>
1.1       grant    11451:             <pre class="programlisting">
                   11452: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   11453:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   11454:     fi
                   11455: </pre>
                   11456: 
                   11457:             <p>If you build any other packages that way, please
                   11458:             make sure the working files are deleted too when this
                   11459:             package's working files are cleaned up. The easiest way
                   11460:             to do so is by adding a pre-clean target:</p>
                   11461:             <pre class="programlisting">
                   11462: pre-clean:
                   11463:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   11464: </pre>
                   11465: 
1.14      xtraeme  11466:             <p>Please also note the <code class=
                   11467:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   11468:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   11469:             which are provided as convenience definitions. The
1.24      wiz      11470:             former works out whether <a href=
                   11471:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   11472:             <span class="citerefentry"><span class=
                   11473:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   11474:             the base system, and, if it isn't, installs the
                   11475:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11476:             href=
1.1       grant    11477:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      11478:             target="_top"><code xmlns="" class=
                   11479:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      11480:             adds a build dependency on either an installed version
                   11481:             of an older gettext package, or if it isn't, installs
                   11482:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11483:             href=
                   11484:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      11485:             target="_top"><code xmlns="" class=
                   11486:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    11487:           </div>
                   11488: 
                   11489:           <div class="sect2" lang="en" xml:lang="en">
                   11490:             <div class="titlepage">
                   11491:               <div>
                   11492:                 <div>
1.30      wiz      11493:                   <h3 class="title"><a name="conflicts" id=
1.38      dillo    11494:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    11495:                   with other packages</h3>
                   11496:                 </div>
                   11497:               </div>
                   11498:             </div>
                   11499: 
                   11500:             <p>Your package may conflict with other packages a user
                   11501:             might already have installed on his system, e.g. if
                   11502:             your package installs the same set of files like
                   11503:             another package in our pkgsrc tree.</p>
                   11504: 
1.14      xtraeme  11505:             <p>In this case you can set <code class=
1.47      reed     11506:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    11507:             packages (including version string) your package
                   11508:             conflicts with.</p>
                   11509: 
1.47      reed     11510:             <p>For example, <a xmlns=
1.1       grant    11511:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11512:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      11513:             target="_top"><code xmlns="" class=
                   11514:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      11515:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11516:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      11517:             target="_top"><code xmlns="" class=
1.47      reed     11518:             "filename">x11/Xaw-Xpm</code></a> install the same
                   11519:             shared library, thus you set in <code xmlns=
1.45      wiz      11520:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11521:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    11522:             <pre class="programlisting">
                   11523: CONFLICTS=      Xaw-Xpm-[0-9]*
                   11524: </pre>
                   11525: 
1.45      wiz      11526:             <p>and in <code xmlns=
                   11527:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11528:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    11529:             <pre class="programlisting">
                   11530: CONFLICTS=      Xaw3d-[0-9]*
                   11531: </pre>
                   11532: 
                   11533:             <p>Packages will automatically conflict with other
                   11534:             packages with the name prefix and a different version
                   11535:             string. &#8220;<span class=
                   11536:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   11537:             conflict with the older version &#8220;<span class=
                   11538:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   11539:           </div>
                   11540: 
                   11541:           <div class="sect2" lang="en" xml:lang="en">
                   11542:             <div class="titlepage">
                   11543:               <div>
                   11544:                 <div>
1.30      wiz      11545:                   <h3 class="title"><a name="not-building-packages"
                   11546:                   id=
1.38      dillo    11547:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      11548:                   that cannot or should not be built</h3>
1.1       grant    11549:                 </div>
                   11550:               </div>
                   11551:             </div>
                   11552: 
                   11553:             <p>There are several reasons why a package might be
                   11554:             instructed to not build under certain circumstances. If
                   11555:             the package builds and runs on most platforms, the
1.14      xtraeme  11556:             exceptions should be noted with <code class=
                   11557:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   11558:             builds and runs on a small handful of platforms, set
                   11559:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      11560:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   11561:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   11562:             triples (OS-version-platform) that can use glob-style
                   11563:             wildcards.</p>
                   11564: 
                   11565:             <p>If the package should be skipped (for example,
                   11566:             because it provides functionality already provided by
                   11567:             the system), set <code class=
1.14      xtraeme  11568:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   11569:             message. If the package should fail because some
                   11570:             preconditions are not met, set <code class=
                   11571:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    11572:             message.</p>
                   11573:           </div>
                   11574: 
                   11575:           <div class="sect2" lang="en" xml:lang="en">
                   11576:             <div class="titlepage">
                   11577:               <div>
                   11578:                 <div>
1.30      wiz      11579:                   <h3 class="title"><a name="undeletable-packages"
                   11580:                   id=
1.38      dillo    11581:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      11582:                   which should not be deleted, once installed</h3>
1.1       grant    11583:                 </div>
                   11584:               </div>
                   11585:             </div>
                   11586: 
                   11587:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  11588:             has been installed, the <code class=
                   11589:             "varname">PKG_PRESERVE</code> definition should be set
                   11590:             in the package Makefile. This will be carried into any
1.1       grant    11591:             binary package that is made from this pkgsrc entry. A
                   11592:             &#8220;<span class="quote">preserved</span>&#8221;
                   11593:             package will not be deleted using <a href=
                   11594:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11595:             <span class="citerefentry"><span class=
                   11596:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   11597:             the &#8220;<span class="quote">-f</span>&#8221; option
                   11598:             is used.</p>
                   11599:           </div>
                   11600: 
                   11601:           <div class="sect2" lang="en" xml:lang="en">
                   11602:             <div class="titlepage">
                   11603:               <div>
                   11604:                 <div>
                   11605:                   <h3 class="title"><a name="security-handling" id=
1.38      dillo    11606:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    11607:                   packages with security problems</h3>
                   11608:                 </div>
                   11609:               </div>
                   11610:             </div>
                   11611: 
                   11612:             <p>When a vulnerability is found, this should be noted
1.45      wiz      11613:             in <code xmlns=
                   11614:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11615:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      11616:             and after committing that file, use
                   11617:             <span><strong class="command">make
                   11618:             upload</strong></span> in the same directory to update
                   11619:             the file on ftp.NetBSD.org.</p>
                   11620: 
                   11621:             <p>After fixing the vulnerability by a patch, its
                   11622:             <code class="varname">PKGREVISION</code> should be
                   11623:             increased (this is of course not necessary if the
                   11624:             problem is fixed by using a newer release of the
1.45      wiz      11625:             software). In addition, if a <code xmlns=
                   11626:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11627:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      11628:             affected package, a corresponding <code class=
1.14      xtraeme  11629:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   11630:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      11631:             be added or updated in it.</p>
1.1       grant    11632: 
                   11633:             <p>Also, if the fix should be applied to the stable
                   11634:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      11635: 
                   11636:             <p>Binary packages already on ftp.NetBSD.org will be
                   11637:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    11638:           </div>
                   11639: 
                   11640:           <div class="sect2" lang="en" xml:lang="en">
                   11641:             <div class="titlepage">
                   11642:               <div>
                   11643:                 <div>
1.30      wiz      11644:                   <h3 class="title"><a name="compiler-bugs" id=
1.38      dillo    11645:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    11646:                   compiler bugs</h3>
                   11647:                 </div>
                   11648:               </div>
                   11649:             </div>
                   11650: 
                   11651:             <p>Some source files trigger bugs in the compiler,
                   11652:             based on combinations of compiler version and
                   11653:             architecture and almost always relation to optimisation
                   11654:             being enabled. Common symptoms are gcc internal errors
                   11655:             or never finishing compiling a file.</p>
                   11656: 
1.47      reed     11657:             <p>Typically, a workaround involves testing the
1.14      xtraeme  11658:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    11659:             version, disabling optimisation for that
1.14      xtraeme  11660:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      11661:             combination, and documenting it in <code xmlns=
                   11662:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11663:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    11664:             number of examples!</p>
                   11665:           </div>
                   11666: 
                   11667:           <div class="sect2" lang="en" xml:lang="en">
                   11668:             <div class="titlepage">
                   11669:               <div>
                   11670:                 <div>
1.30      wiz      11671:                   <h3 class="title"><a name="bumping-pkgrevision"
1.38      dillo    11672:                   id="bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      11673:                   handle incrementing versions when fixing an
                   11674:                   existing package</h3>
1.1       grant    11675:                 </div>
                   11676:               </div>
                   11677:             </div>
                   11678: 
                   11679:             <p>When making fixes to an existing package it can be
1.14      xtraeme  11680:             useful to change the version number in <code class=
                   11681:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    11682:             future versions by the original author, a
                   11683:             &#8220;<span class="quote">nb1</span>&#8221;,
                   11684:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   11685:             suffix can be used on package versions by setting
1.14      xtraeme  11686:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   11687:             The &#8220;<span class="quote">nb</span>&#8221; is
                   11688:             treated like a &#8220;<span class=
                   11689:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    11690:             <pre class="programlisting">
                   11691:   DISTNAME= foo-17.42
                   11692:     PKGREVISION=  9
                   11693: </pre>
                   11694: 
1.14      xtraeme  11695:             <p>will result in a <code class=
                   11696:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    11697:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   11698: 
                   11699:             <p>When a new release of the package is released, the
1.14      xtraeme  11700:             <code class="varname">PKGREVISION</code> should be
1.47      reed     11701:             removed, e.g. on a new minor release of the above
1.14      xtraeme  11702:             package, things should be like:</p>
1.1       grant    11703:             <pre class="programlisting">
                   11704: DISTNAME=   foo-17.43
                   11705: </pre>
                   11706:           </div>
                   11707: 
                   11708:           <div class="sect2" lang="en" xml:lang="en">
                   11709:             <div class="titlepage">
                   11710:               <div>
                   11711:                 <div>
1.30      wiz      11712:                   <h3 class="title"><a name=
                   11713:                   "portability-of-packages" id=
1.38      dillo    11714:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      11715:                   of packages</h3>
1.1       grant    11716:                 </div>
                   11717:               </div>
                   11718:             </div>
                   11719: 
                   11720:             <p>One appealing feature of pkgsrc is that it runs on
                   11721:             many different platforms. As a result, it is important
                   11722:             to ensure, where possible, that packages in pkgsrc are
                   11723:             portable. There are some particular details you should
                   11724:             pay attention to while working on pkgsrc.</p>
                   11725: 
                   11726:             <div class="sect3" lang="en" xml:lang="en">
                   11727:               <div class="titlepage">
                   11728:                 <div>
                   11729:                   <div>
1.30      wiz      11730:                     <h4 class="title"><a name="install-scripts" id=
1.38      dillo    11731:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    11732:                     ${INSTALL_DATA_DIR}, ...</h4>
                   11733:                   </div>
                   11734:                 </div>
                   11735:               </div>
                   11736: 
1.14      xtraeme  11737:               <p>The BSD-compatible <span><strong class=
                   11738:               "command">install</strong></span> supplied with some
1.1       grant    11739:               operating systems will not perform more than one
                   11740:               operation at a time. As such, you should call
                   11741:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   11742:               etc. like this:</p>
                   11743:               <pre class="programlisting">
                   11744: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   11745: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   11746: </pre>
                   11747:             </div>
                   11748:           </div>
                   11749:         </div>
                   11750: 
                   11751:         <div class="sect1" lang="en" xml:lang="en">
                   11752:           <div class="titlepage">
                   11753:             <div>
                   11754:               <div>
                   11755:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11756:                 "downloading-issues" id=
1.38      dillo    11757:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    11758:                 downloading issues</h2>
                   11759:               </div>
                   11760:             </div>
                   11761:           </div>
                   11762: 
                   11763:           <div class="sect2" lang="en" xml:lang="en">
                   11764:             <div class="titlepage">
                   11765:               <div>
                   11766:                 <div>
1.30      wiz      11767:                   <h3 class="title"><a name="no-plain-download" id=
1.38      dillo    11768:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      11769:                   whose distfiles aren't available for plain
1.1       grant    11770:                   downloading</h3>
                   11771:                 </div>
                   11772:               </div>
                   11773:             </div>
                   11774: 
                   11775:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  11776:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   11777:             and a <span><strong class="command">make
1.45      wiz      11778:             fetch</strong></span> will call <code xmlns=
                   11779:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11780:             "filename">files/getsite.sh</code> with the name of
                   11781:             each file to download as an argument, expecting it to
                   11782:             output the URL of the directory from which to download
                   11783:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11784:             href=
1.1       grant    11785:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      11786:             target="_top"><code xmlns="" class=
                   11787:             "filename">graphics/ns-cult3d</code></a> is an example
                   11788:             of this usage.</p>
1.1       grant    11789: 
                   11790:             <p>If the download can't be automated, because the user
                   11791:             must submit personal information to apply for a
                   11792:             password, or must pay for the source, or whatever, you
1.14      xtraeme  11793:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   11794:             a macro which displays a message explaining the
                   11795:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   11796:             must be executable shell commands, not just a message.
                   11797:             (Generally, it executes <code class=
                   11798:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    11799:             following packages use this: <a xmlns=
                   11800:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      11801:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      11802:             target="_top"><code xmlns="" class=
                   11803:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      11804:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11805:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      11806:             target="_top"><code xmlns="" class=
                   11807:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      11808:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11809:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      11810:             target="_top"><code xmlns="" class=
                   11811:             "filename">emulators/vmware-module</code></a>,
                   11812:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11813:             href=
1.20      ben      11814:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      11815:             target="_top"><code xmlns="" class=
                   11816:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      11817:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      11818:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      11819:             target="_top"><code xmlns="" class=
                   11820:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      11821:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      11822:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      11823:             target="_top"><code xmlns="" class=
                   11824:             "filename">sysutils/storage-manager</code></a>,
                   11825:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11826:             href=
1.20      ben      11827:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      11828:             target="_top"><code xmlns="" class=
                   11829:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      11830:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11831:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      11832:             target="_top"><code xmlns="" class=
                   11833:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      11834:             with them.</p>
1.1       grant    11835:           </div>
                   11836: 
                   11837:           <div class="sect2" lang="en" xml:lang="en">
                   11838:             <div class="titlepage">
                   11839:               <div>
                   11840:                 <div>
1.30      wiz      11841:                   <h3 class="title"><a name=
                   11842:                   "modified-distfiles-same-name" id=
1.38      dillo    11843:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      11844:                   to handle modified distfiles with the 'old'
                   11845:                   name</h3>
1.1       grant    11846:                 </div>
                   11847:               </div>
                   11848:             </div>
                   11849: 
                   11850:             <p>Sometimes authors of a software package make some
                   11851:             modifications after the software was released, and they
                   11852:             put up a new distfile without changing the package's
                   11853:             version number. If a package is already in pkgsrc at
1.32      wiz      11854:             that time, the checksum will no longer match. The
                   11855:             contents of the new distfile should be compared against
                   11856:             the old one before changing anything, to make sure the
                   11857:             distfile was really updated on purpose, and that no
                   11858:             trojan horse or so crept in. Then, the correct way to
                   11859:             work around this is to set <code class=
                   11860:             "varname">DIST_SUBDIR</code> to a unique directory
                   11861:             name, usually based on <code class=
                   11862:             "varname">PKGNAME_NOREV</code>. In case this happens
                   11863:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      11864:             used (thus including the <code xmlns=
                   11865:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      11866:             "filename">nbX</code> suffix) or a date stamp can be
                   11867:             appended, like <code class=
                   11868:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      11869:             forget regenerating the <code xmlns=
                   11870:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      11871:             "filename">distinfo</code> file after that, since it
                   11872:             contains the <code class="varname">DIST_SUBDIR</code>
                   11873:             path in the filenames. Furthermore, a mail to the
                   11874:             package's authors seems appropriate telling them that
                   11875:             changing distfiles after releases without changing the
                   11876:             file names is not good practice.</p>
1.1       grant    11877:           </div>
                   11878:         </div>
                   11879: 
                   11880:         <div class="sect1" lang="en" xml:lang="en">
                   11881:           <div class="titlepage">
                   11882:             <div>
                   11883:               <div>
                   11884:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11885:                 "configuration-gotchas" id=
1.38      dillo    11886:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    11887:                 gotchas</h2>
                   11888:               </div>
                   11889:             </div>
                   11890:           </div>
                   11891: 
                   11892:           <div class="sect2" lang="en" xml:lang="en">
                   11893:             <div class="titlepage">
                   11894:               <div>
                   11895:                 <div>
                   11896:                   <h3 class="title"><a name="fixes.libtool" id=
1.38      dillo    11897:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    11898:                   - libtool</h3>
                   11899:                 </div>
                   11900:               </div>
                   11901:             </div>
                   11902: 
                   11903:             <p>pkgsrc supports many different machines, with
                   11904:             different object formats like a.out and ELF, and
                   11905:             varying abilities to do shared library and dynamic
                   11906:             loading at all. To accompany this, varying commands and
                   11907:             options have to be passed to the compiler, linker, etc.
                   11908:             to get the Right Thing, which can be pretty annoying
                   11909:             especially if you don't have all the machines at your
                   11910:             hand to test things. The <a xmlns=
                   11911:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11912:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      11913:             target="_top"><code xmlns="" class=
                   11914:             "filename">devel/libtool</code></a> pkg can help here,
                   11915:             as it just &#8220;<span class=
                   11916:             "quote">knows</span>&#8221; how to build both static
                   11917:             and dynamic libraries from a set of source files, thus
1.47      reed     11918:             being platform-independent.</p>
1.1       grant    11919: 
                   11920:             <p>Here's how to use libtool in a pkg in seven simple
                   11921:             steps:</p>
                   11922: 
                   11923:             <div class="orderedlist">
                   11924:               <ol type="1">
                   11925:                 <li>
1.14      xtraeme  11926:                   <p>Add <code class=
                   11927:                   "varname">USE_LIBTOOL=yes</code> to the package
                   11928:                   Makefile.</p>
1.1       grant    11929:                 </li>
                   11930: 
                   11931:                 <li>
                   11932:                   <p>For library objects, use &#8220;<span class=
                   11933:                   "quote">${LIBTOOL} --mode=compile
                   11934:                   ${CC}</span>&#8221; in place of
                   11935:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   11936:                   You could even add it to the definition of
1.14      xtraeme  11937:                   <code class="varname">CC</code>, if only
                   11938:                   libraries are being built in a given Makefile.
                   11939:                   This one command will build both PIC and non-PIC
                   11940:                   library objects, so you need not have separate
                   11941:                   shared and non-shared library rules.</p>
1.1       grant    11942:                 </li>
                   11943: 
                   11944:                 <li>
                   11945:                   <p>For the linking of the library, remove any
                   11946:                   &#8220;<span class="quote">ar</span>&#8221;,
                   11947:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   11948:                   and &#8220;<span class="quote">ld
                   11949:                   -Bshareable</span>&#8221; commands, and instead
                   11950:                   use:</p>
                   11951:                   <pre class="programlisting">
                   11952: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   11953: </pre>
                   11954: 
                   11955:                   <p>Note that the library is changed to have a
1.45      wiz      11956:                   <code xmlns=
                   11957:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   11958:                   "filename">.la</code> extension, and the objects
                   11959:                   are changed to have a <code xmlns=
                   11960:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11961:                   "filename">.lo</code> extension. Change
                   11962:                   <code class="varname">OBJS</code> as necessary.
                   11963:                   This automatically creates all of the
1.45      wiz      11964:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11965:                   class="filename">.a</code>, <code xmlns=
                   11966:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11967:                   "filename">.so.major.minor</code>, and ELF
                   11968:                   symlinks (if necessary) in the build directory.
                   11969:                   Be sure to include &#8220;<span class=
1.1       grant    11970:                   "quote">-version-info</span>&#8221;, especially
                   11971:                   when major and minor are zero, as libtool will
                   11972:                   otherwise strip off the shared library
                   11973:                   version.</p>
                   11974: 
                   11975:                   <p>From the libtool manual:</p>
                   11976:                   <pre class="programlisting">
                   11977:      So, libtool library versions are described by three integers:
                   11978: 
                   11979: CURRENT
                   11980:        The most recent interface number that this library implements.
                   11981: 
                   11982: REVISION
                   11983:        The implementation number of the CURRENT interface.
                   11984: 
                   11985: AGE
                   11986:        The difference between the newest and oldest interfaces that this
                   11987:        library implements.  In other words, the library implements all the
                   11988:        interface numbers in the range from number `CURRENT - AGE' to
                   11989:        `CURRENT'.
                   11990:        
                   11991:      If two libraries have identical CURRENT and AGE numbers, then the
                   11992: dynamic linker chooses the library with the greater REVISION number. 
                   11993: </pre>
                   11994: 
                   11995:                   <p>The &#8220;<span class=
                   11996:                   "quote">-release</span>&#8221; option will
                   11997:                   produce different results for a.out and ELF
                   11998:                   (excluding symlinks) in only one case. An ELF
                   11999:                   library of the form &#8220;<span class=
                   12000:                   "quote">libfoo-release.so.<span class=
                   12001:                   "emphasis"><em>x</em></span>.<span class=
                   12002:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12003:                   have a symlink of &#8220;<span class=
                   12004:                   "quote">libfoo.so.<span class=
                   12005:                   "emphasis"><em>x</em></span>.<span class=
                   12006:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12007:                   a.out platform. This is handled
                   12008:                   automatically.</p>
                   12009: 
                   12010:                   <p>The &#8220;<span class="quote">-rpath
                   12011:                   argument</span>&#8221; is the install directory
                   12012:                   of the library being built.</p>
                   12013: 
1.45      wiz      12014:                   <p>In the <code xmlns=
                   12015:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12016:                   "filename">PLIST</code>, include only the
                   12017:                   <code xmlns=
                   12018:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12019:                   "filename">.la</code> file, the other files will
                   12020:                   be added automatically.</p>
1.1       grant    12021:                 </li>
                   12022: 
                   12023:                 <li>
1.45      wiz      12024:                   <p>When linking shared object (<code xmlns=
                   12025:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12026:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12027:                   loaded via <a href=
                   12028:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12029:                   <span class="citerefentry"><span class=
                   12030:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12031:                   shared libraries, use &#8220;<span class=
                   12032:                   "quote">-module -avoid-version</span>&#8221; to
                   12033:                   prevent them getting version tacked on.</p>
1.1       grant    12034: 
1.45      wiz      12035:                   <p>The <code xmlns=
                   12036:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12037:                   "filename">PLIST</code> file gets the
                   12038:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12039:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12040:                 </li>
                   12041: 
                   12042:                 <li>
                   12043:                   <p>When linking programs that depend on these
                   12044:                   libraries <span class=
                   12045:                   "emphasis"><em>before</em></span> they are
                   12046:                   installed, preface the <a href=
                   12047:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12048:                   <span class="citerefentry"><span class=
                   12049:                   "refentrytitle">cc</span>(1)</span></a> or
                   12050:                   <a href=
                   12051:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12052:                   <span class="citerefentry"><span class=
                   12053:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12054:                   &#8220;<span class="quote">${LIBTOOL}
                   12055:                   --mode=link</span>&#8221;, and it will find the
                   12056:                   correct libraries (static or shared), but please
                   12057:                   be aware that libtool will not allow you to
                   12058:                   specify a relative path in -L (such as
                   12059:                   &#8220;<span class=
                   12060:                   "quote">-L../somelib</span>&#8221;), because it
                   12061:                   expects you to change that argument to be the
1.45      wiz      12062:                   <code xmlns=
                   12063:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12064:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12065:                   <pre class="programlisting">
                   12066: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   12067: </pre>
                   12068: 
                   12069:                   <p>should be changed to:</p>
                   12070:                   <pre class="programlisting">
1.14      xtraeme  12071: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   12072: "replaceable"><code>someprog</code></em> <em class=
                   12073: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12074: </pre>
                   12075: 
                   12076:                   <p>and it will do the right thing with the
                   12077:                   libraries.</p>
                   12078:                 </li>
                   12079: 
                   12080:                 <li>
                   12081:                   <p>When installing libraries, preface the
                   12082:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12083:                   <span class="citerefentry"><span class=
                   12084:                   "refentrytitle">install</span>(1)</span></a> or
                   12085:                   <a href=
                   12086:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12087:                   <span class="citerefentry"><span class=
                   12088:                   "refentrytitle">cp</span>(1)</span></a> command
                   12089:                   with &#8220;<span class="quote">${LIBTOOL}
                   12090:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12091:                   library name to <code xmlns=
                   12092:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12093:                   "filename">.la</code>. e.g.</p>
1.1       grant    12094:                   <pre class="programlisting">
                   12095: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   12096: </pre>
                   12097: 
1.45      wiz      12098:                   <p>This will install the static <code xmlns=
                   12099:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12100:                   "filename">.a</code>, shared library, any needed
1.1       grant    12101:                   symlinks, and run <a href=
                   12102:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12103:                   <span class="citerefentry"><span class=
                   12104:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12105:                 </li>
                   12106: 
                   12107:                 <li>
1.45      wiz      12108:                   <p>In your <code xmlns=
                   12109:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12110:                   "filename">PLIST</code>, include only the
                   12111:                   <code xmlns=
                   12112:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12113:                   "filename">.la</code> file (this is a change from
                   12114:                   previous behaviour).</p>
1.1       grant    12115:                 </li>
                   12116:               </ol>
                   12117:             </div>
                   12118:           </div>
                   12119: 
                   12120:           <div class="sect2" lang="en" xml:lang="en">
                   12121:             <div class="titlepage">
                   12122:               <div>
                   12123:                 <div>
1.30      wiz      12124:                   <h3 class="title"><a name="using-libtool" id=
1.38      dillo    12125:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12126:                   GNU packages that already support libtool</h3>
1.1       grant    12127:                 </div>
                   12128:               </div>
                   12129:             </div>
                   12130: 
1.14      xtraeme  12131:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12132:             the package Makefile. This will override the package's
                   12133:             own libtool in most cases. For older libtool using
1.1       grant    12134:             packages, libtool is made by ltconfig script during the
                   12135:             do-configure step; you can check the libtool script
1.14      xtraeme  12136:             location by doing <span><strong class="command">make
                   12137:             configure; find work*/ -name
                   12138:             libtool</strong></span>.</p>
                   12139: 
                   12140:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12141:             specifies which libtool scripts, relative to
                   12142:             <code class="varname">WRKSRC</code>, to override. By
                   12143:             default, it is set to &#8220;<span class=
                   12144:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12145:             this does not match the location of the package's
                   12146:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12147: 
1.45      wiz      12148:             <p>If you do not need <code xmlns=
                   12149:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12150:             "filename">*.a</code> static libraries built and
                   12151:             installed, then use <code class=
                   12152:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12153: 
1.47      reed     12154:             <p>If your package makes use of the
                   12155:             platform-independent library for loading dynamic shared
                   12156:             objects, that comes with libtool (libltdl), you should
                   12157:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12158: 
                   12159:             <p>Some packages use libtool incorrectly so that the
                   12160:             package may not work or build in some circumstances.
                   12161:             Some of the more common errors are:</p>
                   12162: 
                   12163:             <div class="itemizedlist">
                   12164:               <ul type="disc">
                   12165:                 <li>
                   12166:                   <p>The inclusion of a shared object (-module) as
                   12167:                   a dependent library in an executable or library.
                   12168:                   This in itself isn't a problem if one of two
                   12169:                   things has been done:</p>
                   12170: 
                   12171:                   <div class="orderedlist">
                   12172:                     <ol type="1">
                   12173:                       <li>
                   12174:                         <p>The shared object is named correctly,
1.45      wiz      12175:                         i.e. <code xmlns=
                   12176:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12177:                         class="filename">libfoo.la</code>, not
                   12178:                         <code xmlns=
                   12179:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12180:                         class="filename">foo.la</code></p>
1.1       grant    12181:                       </li>
                   12182: 
                   12183:                       <li>
                   12184:                         <p>The -dlopen option is used when linking
                   12185:                         an executable.</p>
                   12186:                       </li>
                   12187:                     </ol>
                   12188:                   </div>
                   12189:                 </li>
                   12190: 
                   12191:                 <li>
                   12192:                   <p>The use of libltdl without the correct calls
                   12193:                   to initialisation routines. The function
                   12194:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12195:                   <code class=
                   12196:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12197:                   included in executables.</p>
                   12198:                 </li>
                   12199:               </ul>
                   12200:             </div>
                   12201:           </div>
                   12202: 
                   12203:           <div class="sect2" lang="en" xml:lang="en">
                   12204:             <div class="titlepage">
                   12205:               <div>
                   12206:                 <div>
1.30      wiz      12207:                   <h3 class="title"><a name="autoconf-automake" id=
1.38      dillo    12208:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12209:                   Autoconf/Automake</h3>
                   12210:                 </div>
                   12211:               </div>
                   12212:             </div>
                   12213: 
                   12214:             <p>If a package needs GNU autoconf or automake to be
                   12215:             executed to regenerate the configure script and
                   12216:             Makefile.in makefile templates, then they should be
1.35      jmmv     12217:             executed in a pre-configure target.</p>
1.1       grant    12218: 
                   12219:             <p>For packages that need only autoconf:</p>
                   12220:             <pre class="programlisting">
1.35      jmmv     12221: AUTOCONF_REQD=    2.50     # if default version is not good enough
                   12222: USE_TOOLS+=     autoconf   # use "autoconf213" for autoconf-2.13
1.1       grant    12223: ...
                   12224: 
                   12225: pre-configure:
1.35      jmmv     12226:           cd ${WRKSRC}; autoconf
1.1       grant    12227: 
                   12228: ...
                   12229: </pre>
                   12230: 
                   12231:             <p>and for packages that need automake and
                   12232:             autoconf:</p>
                   12233:             <pre class="programlisting">
1.35      jmmv     12234: AUTOMAKE_REQD=  1.7.1      # if default version is not good enough
1.36      wiz      12235: USE_TOOLS+=     automake   # use "automake14" for automake-1.4
1.1       grant    12236: ...
                   12237: 
                   12238: pre-configure:
                   12239:           cd ${WRKSRC};                                           \
1.35      jmmv     12240:           aclocal; autoheader;                                    \
                   12241:           automake -a --foreign -i; autoconf
1.1       grant    12242: 
                   12243: ...
                   12244: </pre>
                   12245: 
                   12246:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12247:             certainly require GNU Make.</p>
1.1       grant    12248: 
                   12249:             <p>There are times when the configure process makes
                   12250:             additional changes to the generated files, which then
                   12251:             causes the build process to try to re-execute the
                   12252:             automake sequence. This is prevented by touching
                   12253:             various files in the configure stage. If this causes
1.14      xtraeme  12254:             problems with your package you can set <code class=
                   12255:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12256:             Makefile.</p>
                   12257:           </div>
                   12258:         </div>
                   12259: 
                   12260:         <div class="sect1" lang="en" xml:lang="en">
                   12261:           <div class="titlepage">
                   12262:             <div>
                   12263:               <div>
                   12264:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12265:                 "building-considerations" id=
1.38      dillo    12266:                 "building-considerations"></a>15.4.&nbsp;Building
1.1       grant    12267:                 considerations</h2>
                   12268:               </div>
                   12269:             </div>
                   12270:           </div>
                   12271: 
                   12272:           <div class="sect2" lang="en" xml:lang="en">
                   12273:             <div class="titlepage">
                   12274:               <div>
                   12275:                 <div>
1.30      wiz      12276:                   <h3 class="title"><a name="cpp-defines" id=
1.38      dillo    12277:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12278:                 </div>
                   12279:               </div>
                   12280:             </div>
                   12281: 
                   12282:             <p>To port an application to NetBSD, it's usually
                   12283:             necessary for the compiler to be able to judge the
                   12284:             system on which it's compiling, and we use definitions
                   12285:             so that the C pre-processor can do this.</p>
                   12286: 
                   12287:             <p>To test whether you are working on a 4.4 BSD-derived
                   12288:             system, you should use the BSD definition, which is
1.45      wiz      12289:             defined in <code xmlns=
                   12290:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12291:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    12292:             systems.</p>
                   12293:             <pre class="programlisting">
                   12294: #include &lt;sys/param.h&gt;
                   12295: </pre>
                   12296: 
                   12297:             <p>and then you can surround the BSD-specific parts of
                   12298:             your package's C/C++ code using this conditional:</p>
                   12299:             <pre class="programlisting">
                   12300: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   12301:     ...
                   12302: #endif
                   12303: </pre>
                   12304: 
                   12305:             <p>Please use the &#8220;<span class=
                   12306:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   12307:             it should only apply to features of NetBSD that are not
1.47      reed     12308:             present in other 4.4-lite-derived BSDs.</p>
1.1       grant    12309:           </div>
                   12310:         </div>
                   12311: 
                   12312:         <div class="sect1" lang="en" xml:lang="en">
                   12313:           <div class="titlepage">
                   12314:             <div>
                   12315:               <div>
                   12316:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12317:                 "package-specific-actions" id=
1.38      dillo    12318:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    12319:                 specific actions</h2>
                   12320:               </div>
                   12321:             </div>
                   12322:           </div>
                   12323: 
                   12324:           <div class="sect2" lang="en" xml:lang="en">
                   12325:             <div class="titlepage">
                   12326:               <div>
                   12327:                 <div>
1.30      wiz      12328:                   <h3 class="title"><a name="user-interaction" id=
1.38      dillo    12329:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  12330:                   interaction</h3>
1.1       grant    12331:                 </div>
                   12332:               </div>
                   12333:             </div>
                   12334: 
                   12335:             <p>Occasionally, packages require interaction from the
                   12336:             user, and this can be in a number of ways:</p>
                   12337: 
                   12338:             <div class="itemizedlist">
                   12339:               <ul type="disc">
                   12340:                 <li>
                   12341:                   <p>help in fetching the distfiles</p>
                   12342:                 </li>
                   12343: 
                   12344:                 <li>
                   12345:                   <p>help to configure the package before it is
                   12346:                   built</p>
                   12347:                 </li>
                   12348: 
                   12349:                 <li>
                   12350:                   <p>help during the build process</p>
                   12351:                 </li>
                   12352: 
                   12353:                 <li>
                   12354:                   <p>help during the installation of a package</p>
                   12355:                 </li>
                   12356:               </ul>
                   12357:             </div>
                   12358: 
1.14      xtraeme  12359:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    12360:             definition is provided to notify the pkgsrc mechanism
                   12361:             of an interactive stage which will be needed, and this
1.45      wiz      12362:             should be set in the package's <code xmlns=
                   12363:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12364:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    12365:             <pre class="programlisting">
                   12366: INTERACTIVE_STAGE= build
                   12367: </pre>
                   12368: 
                   12369:             <p>Multiple interactive stages can be specified:</p>
                   12370:             <pre class="programlisting">
                   12371: INTERACTIVE_STAGE= configure install
                   12372: </pre>
                   12373:           </div>
                   12374: 
                   12375:           <div class="sect2" lang="en" xml:lang="en">
                   12376:             <div class="titlepage">
                   12377:               <div>
                   12378:                 <div>
1.30      wiz      12379:                   <h3 class="title"><a name="handling-licenses" id=
1.38      dillo    12380:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    12381:                   licenses</h3>
                   12382:                 </div>
                   12383:               </div>
                   12384:             </div>
                   12385: 
1.44      gdt      12386:             <p>A package may be covered by a license which the user
                   12387:             has or has not agreed to accept. For these cases,
                   12388:             pkgsrc contains a mechanism to note that a package is
                   12389:             covered by a particular license, and the package cannot
                   12390:             be built unless the user has accepted the license.
                   12391:             (Installation of binary packages are not currently
                   12392:             subject to this mechanism.) Packages with licenses that
                   12393:             are either Open Source according to the Open Source
                   12394:             Initiative or Free according to the Free Software
                   12395:             Foundation will not be marked with a license tag.
                   12396:             Packages with licenses that have not been determined to
                   12397:             meet either definition will be marked with a license
                   12398:             tag referring to the license. This will prevent
                   12399:             building unless pkgsrc is informed that the license is
                   12400:             acceptable, and enables displaying the license.</p>
                   12401: 
                   12402:             <p>The license tag mechanism is intended to address
                   12403:             copyright-related issues surrounding building,
                   12404:             installing and using a package, and not to address
                   12405:             redistribution issues (see <code class=
                   12406:             "varname">RESTRICTED</code> and <code class=
                   12407:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   12408:             above definition of licenses for which tags are not
                   12409:             needed implies that packages with redistribution
                   12410:             restrictions should have tags.</p>
                   12411: 
                   12412:             <p>Denoting that a package is covered by a particular
1.45      wiz      12413:             license is done by placing the license in <code xmlns=
                   12414:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      12415:             "filename">pkgsrc/licenses</code> and setting the
                   12416:             <code class="varname">LICENSE</code> variable to a
                   12417:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  12418:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      12419:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      12420:             target="_top"><code xmlns="" class=
                   12421:             "filename">graphics/xv</code></a>:</p>
1.1       grant    12422:             <pre class="programlisting">
1.44      gdt      12423: LICENSE=        xv-license
1.1       grant    12424: </pre>
                   12425: 
                   12426:             <p>When trying to build, the user will get a notice
1.44      gdt      12427:             that the package is covered by a license which has not
                   12428:             been accepted:</p>
1.1       grant    12429:             <pre class="programlisting">
1.14      xtraeme  12430: <code class="prompt">%</code> <strong class=
                   12431: "userinput"><code>make</code></strong>
1.44      gdt      12432: ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
1.1       grant    12433: ===&gt;     To view the license, enter "/usr/bin/make show-license".
1.44      gdt      12434: ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   12435: ===&gt;     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    12436: *** Error code 1
                   12437: </pre>
                   12438: 
1.14      xtraeme  12439:             <p>The license can be viewed with <span><strong class=
                   12440:             "command">make show-license</strong></span>, and if it
                   12441:             is considered appropriate, the line printed above can
1.45      wiz      12442:             be added to <code xmlns=
                   12443:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12444:             "filename">/etc/mk.conf</code> to indicate acceptance
                   12445:             of the particular license:</p>
1.1       grant    12446:             <pre class="programlisting">
1.44      gdt      12447: ACCEPTABLE_LICENSES+=xv-license
1.1       grant    12448: </pre>
                   12449: 
                   12450:             <p>When adding a package with a new license, the
1.45      wiz      12451:             license text should be added to <code xmlns=
                   12452:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12453:             "filename">pkgsrc/licenses</code> for displaying. A
                   12454:             list of known licenses can be seen in this directory as
                   12455:             well as by looking at the list of (commented out)
                   12456:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      12457:             variable settings in <code xmlns=
                   12458:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12459:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    12460: 
1.44      gdt      12461:             <p>The use of <code class=
                   12462:             "varname">LICENSE=shareware</code>, <code class=
                   12463:             "varname">LICENSE=no-commercial-use</code>, and similar
                   12464:             language is deprecated because it does not crisply
                   12465:             refer to a particular license text. Another problem
                   12466:             with such usage is that it does not enable a user to
                   12467:             denote acceptance of the license for a single package
                   12468:             without accepting the same license text for another
                   12469:             package. In particular, this can be inappropriate when
                   12470:             e.g. one accepts a particular license to indicate to
                   12471:             pkgsrc that a fee has been paid.</p>
1.1       grant    12472:           </div>
                   12473: 
                   12474:           <div class="sect2" lang="en" xml:lang="en">
                   12475:             <div class="titlepage">
                   12476:               <div>
                   12477:                 <div>
1.30      wiz      12478:                   <h3 class="title"><a name=
                   12479:                   "installing-score-files" id=
1.38      dillo    12480:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      12481:                   score files</h3>
1.1       grant    12482:                 </div>
                   12483:               </div>
                   12484:             </div>
                   12485: 
                   12486:             <p>Certain packages, most of them in the games
                   12487:             category, install a score file that allows all users on
                   12488:             the system to record their highscores. In order for
                   12489:             this to work, the binaries need to be installed setgid
                   12490:             and the score files owned by the appropriate group
                   12491:             and/or owner (traditionally the "games" user/group).
                   12492:             The following variables, documented in more detail in
1.45      wiz      12493:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12494:             class="filename">mk/defaults/mk.conf</code>, control
                   12495:             this behaviour: <code class=
1.14      xtraeme  12496:             "varname">SETGIDGAME</code>, <code class=
                   12497:             "varname">GAMEDATAMODE</code>, <code class=
                   12498:             "varname">GAMEGRP</code>, <code class=
                   12499:             "varname">GAMEMODE</code>, <code class=
                   12500:             "varname">GAMEOWN</code>.</p>
1.1       grant    12501: 
                   12502:             <p>Note that per default, setgid installation of games
1.14      xtraeme  12503:             is disabled; setting <code class=
                   12504:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    12505:             variables accordingly.</p>
                   12506: 
                   12507:             <p>A package should therefor never hard code file
1.14      xtraeme  12508:             ownership or access permissions but rely on
                   12509:             <code class="varname">INSTALL_GAME</code> and
                   12510:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   12511:             these correctly.</p>
1.1       grant    12512:           </div>
                   12513: 
                   12514:           <div class="sect2" lang="en" xml:lang="en">
                   12515:             <div class="titlepage">
                   12516:               <div>
                   12517:                 <div>
1.30      wiz      12518:                   <h3 class="title"><a name="perl-scripts" id=
1.38      dillo    12519:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      12520:                   containing perl scripts</h3>
1.1       grant    12521:                 </div>
                   12522:               </div>
                   12523:             </div>
                   12524: 
                   12525:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  12526:             set <code class="varname">REPLACE_PERL</code> to ensure
                   12527:             that the proper interpreter path is set. <code class=
                   12528:             "varname">REPLACE_PERL</code> should contain a list of
                   12529:             scripts, relative to <code class=
                   12530:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    12531:           </div>
                   12532: 
                   12533:           <div class="sect2" lang="en" xml:lang="en">
                   12534:             <div class="titlepage">
                   12535:               <div>
                   12536:                 <div>
1.30      wiz      12537:                   <h3 class="title"><a name="hardcoded-paths" id=
1.38      dillo    12538:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    12539:                   hardcoded paths to other interpreters</h3>
                   12540:                 </div>
                   12541:               </div>
                   12542:             </div>
                   12543: 
                   12544:             <p>Your package may also contain scripts with hardcoded
                   12545:             paths to other interpreters besides (or as well as)
                   12546:             perl. To correct the full pathname to the script
                   12547:             interpreter, you need to set the following definitions
1.45      wiz      12548:             in your <code xmlns=
                   12549:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12550:             "filename">Makefile</code> (we shall use
                   12551:             <span><strong class="command">tclsh</strong></span> in
                   12552:             this example):</p>
1.1       grant    12553:             <pre class="programlisting">
                   12554:   REPLACE_INTERPRETER+=     tcl
                   12555:     _REPLACE.tcl.old=     .*/bin/tclsh
                   12556:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   12557:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   12558:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   12559: </pre>
                   12560:           </div>
                   12561: 
                   12562:           <div class="sect2" lang="en" xml:lang="en">
                   12563:             <div class="titlepage">
                   12564:               <div>
                   12565:                 <div>
1.30      wiz      12566:                   <h3 class="title"><a name="perl-modules" id=
1.38      dillo    12567:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      12568:                   installing perl modules</h3>
1.1       grant    12569:                 </div>
                   12570:               </div>
                   12571:             </div>
                   12572: 
                   12573:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      12574:             include the Makefile fragment <code xmlns=
                   12575:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12576:             "filename">../../lang/perl5/module.mk</code>. It
                   12577:             provides a <span><strong class=
                   12578:             "command">do-configure</strong></span> target for the
                   12579:             standard perl configuration for such modules as well as
                   12580:             various hooks to tune this configuration. See comments
                   12581:             in this file for details.</p>
1.1       grant    12582: 
                   12583:             <p>Perl5 modules will install into different places
                   12584:             depending on the version of perl used during the build
                   12585:             process. To address this, pkgsrc will append lines to
1.45      wiz      12586:             the <code xmlns=
                   12587:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12588:             "filename">PLIST</code> corresponding to the files
                   12589:             listed in the installed <code xmlns=
                   12590:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12591:             "filename">.packlist</code> file generated by most
                   12592:             perl5 modules. This is invoked by defining <code class=
                   12593:             "varname">PERL5_PACKLIST</code> to a space-separated
                   12594:             list of paths to packlist files, e.g.:</p>
1.1       grant    12595:             <pre class="programlisting">
                   12596: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   12597: </pre>
                   12598: 
1.14      xtraeme  12599:             <p>The variables <code class=
                   12600:             "varname">PERL5_SITELIB</code>, <code class=
                   12601:             "varname">PERL5_SITEARCH</code>, and <code class=
                   12602:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    12603:             locations in which perl5 modules may be installed, and
                   12604:             may be used by perl5 packages that don't have a
                   12605:             packlist. These three variables are also substituted
1.45      wiz      12606:             for in the <code xmlns=
                   12607:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12608:             "filename">PLIST</code>.</p>
1.1       grant    12609:           </div>
                   12610: 
                   12611:           <div class="sect2" lang="en" xml:lang="en">
                   12612:             <div class="titlepage">
                   12613:               <div>
                   12614:                 <div>
                   12615:                   <h3 class="title"><a name="faq.info-files" id=
1.38      dillo    12616:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    12617:                   installing info files</h3>
                   12618:                 </div>
                   12619:               </div>
                   12620:             </div>
                   12621: 
                   12622:             <p>Some packages install info files or use the
                   12623:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   12624:             &#8220;<span class="quote">install-info</span>&#8221;
                   12625:             commands. Each of the info files:</p>
                   12626: 
                   12627:             <div class="itemizedlist">
                   12628:               <ul type="disc">
                   12629:                 <li>
                   12630:                   <p>is considered to be installed in the directory
1.45      wiz      12631:                   <code xmlns=
                   12632:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12633:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    12634:                 </li>
                   12635: 
                   12636:                 <li>
                   12637:                   <p>is registered in the Info directory file
1.45      wiz      12638:                   <code xmlns=
                   12639:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12640:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    12641:                 </li>
                   12642: 
                   12643:                 <li>
                   12644:                   <p>and must be listed as a filename in the
1.14      xtraeme  12645:                   <code class="varname">INFO_FILES</code> variable
                   12646:                   in the package Makefile.</p>
1.1       grant    12647:                 </li>
                   12648:               </ul>
                   12649:             </div>
                   12650: 
1.14      xtraeme  12651:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    12652:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      12653:             be overridden in the package Makefile. <code xmlns=
                   12654:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12655:             "filename">INSTALL</code> and <code xmlns=
                   12656:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12657:             "filename">DEINSTALL</code> scripts will be generated
                   12658:             to handle registration of the info files in the Info
1.1       grant    12659:             directory file. The &#8220;<span class=
                   12660:             "quote">install-info</span>&#8221; command used for the
                   12661:             info files registration is either provided by the
                   12662:             system, or by a special purpose package automatically
                   12663:             added as dependency if needed.</p>
                   12664: 
                   12665:             <p>A package which needs the &#8220;<span class=
                   12666:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  12667:             must define the variable <code class=
                   12668:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    12669:             minimum version of the &#8220;<span class=
                   12670:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  12671:             should be noted with the <code class=
                   12672:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      12673:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12674:             class="filename">Makefile</code>. By default, a minimum
                   12675:             version of 3.12 is required. If the system does not
                   12676:             provide a <span><strong class=
1.14      xtraeme  12677:             "command">makeinfo</strong></span> command or if it
                   12678:             does not match the required minimum, a build dependency
                   12679:             on the <a xmlns=
                   12680:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    12681:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      12682:             target="_top"><code xmlns="" class=
                   12683:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      12684:             added automatically.</p>
1.1       grant    12685: 
                   12686:             <p>The build and installation process of the software
                   12687:             provided by the package should not use the
1.14      xtraeme  12688:             <span><strong class=
                   12689:             "command">install-info</strong></span> command as the
                   12690:             registration of info files is the task of the package
1.45      wiz      12691:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12692:             class="filename">INSTALL</code> script, and it must use
                   12693:             the appropriate <span><strong class=
1.14      xtraeme  12694:             "command">makeinfo</strong></span> command.</p>
1.1       grant    12695: 
1.47      reed     12696:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  12697:             creates overriding scripts for the <span><strong class=
                   12698:             "command">install-info</strong></span> and
                   12699:             <span><strong class="command">makeinfo</strong></span>
                   12700:             commands in a directory listed early in <code class=
                   12701:             "varname">PATH</code>.</p>
1.1       grant    12702: 
1.14      xtraeme  12703:             <p>The script overriding <span><strong class=
                   12704:             "command">install-info</strong></span> has no effect
                   12705:             except the logging of a message. The script overriding
                   12706:             <span><strong class="command">makeinfo</strong></span>
                   12707:             logs a message and according to the value of
                   12708:             <code class="varname">USE_MAKEINFO</code> and
                   12709:             <code class="varname">TEXINFO_REQD</code> either run
                   12710:             the appropriate <span><strong class=
                   12711:             "command">makeinfo</strong></span> command or exit on
                   12712:             error.</p>
1.1       grant    12713:           </div>
                   12714: 
                   12715:           <div class="sect2" lang="en" xml:lang="en">
                   12716:             <div class="titlepage">
                   12717:               <div>
                   12718:                 <div>
1.30      wiz      12719:                   <h3 class="title"><a name="gconf2-data-files" id=
1.38      dillo    12720:                   "gconf2-data-files"></a>15.5.8.&nbsp;Packages
1.30      wiz      12721:                   installing GConf2 data files</h3>
1.1       grant    12722:                 </div>
                   12723:               </div>
                   12724:             </div>
                   12725: 
1.45      wiz      12726:             <p>If a package installs <code xmlns=
                   12727:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12728:             "filename">.schemas</code> or <code xmlns=
                   12729:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12730:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    12731:             need to take some extra steps to make sure they get
                   12732:             registered in the database:</p>
                   12733: 
                   12734:             <div class="orderedlist">
                   12735:               <ol type="1">
                   12736:                 <li>
1.45      wiz      12737:                   <p>Include <code xmlns=
                   12738:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12739:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      12740:                   instead of its <code xmlns=
                   12741:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12742:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    12743:                   care of rebuilding the GConf2 database at
                   12744:                   installation and deinstallation time, and tells
                   12745:                   the package where to install GConf2 data files
                   12746:                   using some standard configure arguments. It also
                   12747:                   disallows any access to the database directly
                   12748:                   from the package.</p>
                   12749:                 </li>
                   12750: 
                   12751:                 <li>
                   12752:                   <p>Ensure that the package installs its
1.45      wiz      12753:                   <code xmlns=
                   12754:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12755:                   "filename">.schemas</code> files under
                   12756:                   <code xmlns=
                   12757:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12758:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      12759:                   If they get installed under <code xmlns=
                   12760:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12761:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    12762:                   manually patch the package.</p>
                   12763:                 </li>
                   12764: 
                   12765:                 <li>
                   12766:                   <p>Check the PLIST and remove any entries under
                   12767:                   the etc/gconf directory, as they will be handled
                   12768:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    12769:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   12770:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     12771:                   location of configuration files?&#8221;</a> for
                   12772:                   more information.</p>
1.1       grant    12773:                 </li>
                   12774: 
                   12775:                 <li>
1.14      xtraeme  12776:                   <p>Define the <code class=
                   12777:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      12778:                   <code xmlns=
                   12779:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12780:                   "filename">Makefile</code> with a list of all
                   12781:                   <code xmlns=
                   12782:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12783:                   "filename">.schemas</code> files installed by the
                   12784:                   package, if any. Names must not contain any
                   12785:                   directories in them.</p>
1.1       grant    12786:                 </li>
                   12787: 
                   12788:                 <li>
1.14      xtraeme  12789:                   <p>Define the <code class=
                   12790:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      12791:                   <code xmlns=
                   12792:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12793:                   "filename">Makefile</code> with a list of all
                   12794:                   <code xmlns=
                   12795:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12796:                   "filename">.entries</code> files installed by the
                   12797:                   package, if any. Names must not contain any
                   12798:                   directories in them.</p>
1.1       grant    12799:                 </li>
                   12800:               </ol>
                   12801:             </div>
                   12802:           </div>
                   12803: 
                   12804:           <div class="sect2" lang="en" xml:lang="en">
                   12805:             <div class="titlepage">
                   12806:               <div>
                   12807:                 <div>
1.30      wiz      12808:                   <h3 class="title"><a name=
                   12809:                   "scrollkeeper-data-files" id=
1.38      dillo    12810:                   "scrollkeeper-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      12811:                   installing scrollkeeper data files</h3>
1.1       grant    12812:                 </div>
                   12813:               </div>
                   12814:             </div>
                   12815: 
1.45      wiz      12816:             <p>If a package installs <code xmlns=
                   12817:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12818:             "filename">.omf</code> files, used by scrollkeeper, you
                   12819:             need to take some extra steps to make sure they get
                   12820:             registered in the database:</p>
1.1       grant    12821: 
                   12822:             <div class="orderedlist">
                   12823:               <ol type="1">
                   12824:                 <li>
1.45      wiz      12825:                   <p>Include <code xmlns=
                   12826:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12827:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      12828:                   instead of its <code xmlns=
                   12829:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12830:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    12831:                   care of rebuilding the scrollkeeper database at
                   12832:                   installation and deinstallation time, and
                   12833:                   disallows any access to it directly from the
                   12834:                   package.</p>
                   12835:                 </li>
                   12836: 
                   12837:                 <li>
                   12838:                   <p>Check the PLIST and remove any entries under
1.45      wiz      12839:                   the <code xmlns=
                   12840:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12841:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    12842:                   as they will be handled automatically.</p>
                   12843:                 </li>
                   12844: 
                   12845:                 <li>
1.45      wiz      12846:                   <p>Remove the <code xmlns=
                   12847:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12848:                   "filename">share/omf</code> directory from the
                   12849:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    12850:                 </li>
                   12851:               </ol>
                   12852:             </div>
                   12853:           </div>
                   12854: 
                   12855:           <div class="sect2" lang="en" xml:lang="en">
                   12856:             <div class="titlepage">
                   12857:               <div>
                   12858:                 <div>
1.30      wiz      12859:                   <h3 class="title"><a name="x11-fonts" id=
1.38      dillo    12860:                   "x11-fonts"></a>15.5.10.&nbsp;Packages installing
1.1       grant    12861:                   X11 fonts</h3>
                   12862:                 </div>
                   12863:               </div>
                   12864:             </div>
                   12865: 
                   12866:             <p>If a package installs font files, you will need to
                   12867:             rebuild the fonts database in the directory where they
                   12868:             get installed at installation and deinstallation time.
1.45      wiz      12869:             This can be automatically done by using <code xmlns=
                   12870:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12871:             "filename">mk/fonts.mk</code>, which you need to
1.45      wiz      12872:             include in your <code xmlns=
                   12873:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12874:             "filename">Makefile</code>.</p>
1.1       grant    12875: 
                   12876:             <p>When the file is included, you can list the
1.14      xtraeme  12877:             directories where fonts are installed in the
                   12878:             <code class="varname">FONTS_<em class=
                   12879:             "replaceable"><code>type</code></em>_DIRS</code>
                   12880:             variables, where <em class=
                   12881:             "replaceable"><code>type</code></em> can be one of
                   12882:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    12883:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   12884:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.45      wiz      12885:             sure that the database file <code xmlns=
                   12886:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12887:             "filename">fonts.dir</code> is not listed in the
1.1       grant    12888:             PLIST.</p>
                   12889: 
                   12890:             <p>Note that you should not create new directories for
                   12891:             fonts; instead use the standard ones to avoid that the
                   12892:             user needs to manually configure his X server to find
                   12893:             them.</p>
                   12894:           </div>
                   12895: 
                   12896:           <div class="sect2" lang="en" xml:lang="en">
                   12897:             <div class="titlepage">
                   12898:               <div>
                   12899:                 <div>
1.30      wiz      12900:                   <h3 class="title"><a name="gtk2-modules" id=
1.38      dillo    12901:                   "gtk2-modules"></a>15.5.11.&nbsp;Packages
1.30      wiz      12902:                   installing GTK2 modules</h3>
1.1       grant    12903:                 </div>
                   12904:               </div>
                   12905:             </div>
                   12906: 
1.47      reed     12907:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    12908:             need to take some extra steps to get them registered in
                   12909:             the GTK2 database properly:</p>
                   12910: 
                   12911:             <div class="orderedlist">
                   12912:               <ol type="1">
                   12913:                 <li>
1.45      wiz      12914:                   <p>Include <code xmlns=
                   12915:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12916:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      12917:                   instead of its <code xmlns=
                   12918:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12919:                   "filename">buildlink3.mk</code> file. This takes
                   12920:                   care of rebuilding the database at installation
                   12921:                   and deinstallation time.</p>
1.1       grant    12922:                 </li>
                   12923: 
                   12924:                 <li>
1.14      xtraeme  12925:                   <p>Set <code class=
                   12926:                   "varname">GTK2_IMMODULES=YES</code> if your
                   12927:                   package installs GTK2 immodules.</p>
1.1       grant    12928:                 </li>
                   12929: 
                   12930:                 <li>
1.14      xtraeme  12931:                   <p>Set <code class=
                   12932:                   "varname">GTK2_LOADERS=YES</code> if your package
                   12933:                   installs GTK2 loaders.</p>
1.1       grant    12934:                 </li>
                   12935: 
                   12936:                 <li>
1.47      reed     12937:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    12938:                   databases directly. These are:</p>
                   12939: 
                   12940:                   <div class="itemizedlist">
                   12941:                     <ul type="disc">
                   12942:                       <li>
1.45      wiz      12943:                         <p><code xmlns=
                   12944:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12945:                         class=
1.14      xtraeme  12946:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    12947:                       </li>
                   12948: 
                   12949:                       <li>
1.45      wiz      12950:                         <p><code xmlns=
                   12951:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12952:                         class=
1.14      xtraeme  12953:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    12954:                       </li>
                   12955:                     </ul>
                   12956:                   </div>
                   12957:                 </li>
                   12958: 
                   12959:                 <li>
                   12960:                   <p>Check the PLIST and remove any entries under
1.45      wiz      12961:                   the <code xmlns=
                   12962:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12963:                   "filename">libdata/gtk-2.0</code> directory, as
                   12964:                   they will be handled automatically.</p>
1.1       grant    12965:                 </li>
                   12966:               </ol>
                   12967:             </div>
                   12968:           </div>
                   12969: 
                   12970:           <div class="sect2" lang="en" xml:lang="en">
                   12971:             <div class="titlepage">
                   12972:               <div>
                   12973:                 <div>
1.30      wiz      12974:                   <h3 class="title"><a name="sgml-xml-data" id=
1.38      dillo    12975:                   "sgml-xml-data"></a>15.5.12.&nbsp;Packages
1.30      wiz      12976:                   installing SGML or XML data</h3>
1.1       grant    12977:                 </div>
                   12978:               </div>
                   12979:             </div>
                   12980: 
                   12981:             <p>If a package installs SGML or XML data files that
                   12982:             need to be registered in system-wide catalogs (like
                   12983:             DTDs, sub-catalogs, etc.), you need to take some extra
                   12984:             steps:</p>
                   12985: 
                   12986:             <div class="orderedlist">
                   12987:               <ol type="1">
                   12988:                 <li>
1.45      wiz      12989:                   <p>Include <code xmlns=
                   12990:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12991:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      12992:                   in your <code xmlns=
                   12993:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12994:                   "filename">Makefile</code>, which takes care of
                   12995:                   registering those files in system-wide catalogs
                   12996:                   at installation and deinstallation time.</p>
1.1       grant    12997:                 </li>
                   12998: 
                   12999:                 <li>
1.14      xtraeme  13000:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13001:                   to the full path of any SGML catalogs installed
                   13002:                   by the package.</p>
1.1       grant    13003:                 </li>
                   13004: 
                   13005:                 <li>
1.14      xtraeme  13006:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13007:                   to the full path of any XML catalogs installed by
1.1       grant    13008:                   the package.</p>
                   13009:                 </li>
                   13010: 
                   13011:                 <li>
1.14      xtraeme  13012:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13013:                   to individual entries to be added to the SGML
1.1       grant    13014:                   catalog. These come in groups of three strings;
                   13015:                   see xmlcatmgr(1) for more information
                   13016:                   (specifically, arguments recognized by the 'add'
                   13017:                   action). Note that you will normally not use this
                   13018:                   variable.</p>
                   13019:                 </li>
                   13020: 
                   13021:                 <li>
1.14      xtraeme  13022:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13023:                   to individual entries to be added to the XML
1.1       grant    13024:                   catalog. These come in groups of three strings;
                   13025:                   see xmlcatmgr(1) for more information
                   13026:                   (specifically, arguments recognized by the 'add'
                   13027:                   action). Note that you will normally not use this
                   13028:                   variable.</p>
                   13029:                 </li>
                   13030:               </ol>
                   13031:             </div>
                   13032:           </div>
                   13033: 
                   13034:           <div class="sect2" lang="en" xml:lang="en">
                   13035:             <div class="titlepage">
                   13036:               <div>
                   13037:                 <div>
1.30      wiz      13038:                   <h3 class="title"><a name="mime-database" id=
1.38      dillo    13039:                   "mime-database"></a>15.5.13.&nbsp;Packages
1.30      wiz      13040:                   installing extensions to the MIME database</h3>
1.1       grant    13041:                 </div>
                   13042:               </div>
                   13043:             </div>
                   13044: 
                   13045:             <p>If a package provides extensions to the MIME
1.45      wiz      13046:             database by installing <code xmlns=
                   13047:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13048:             "filename">.xml</code> files inside <code xmlns=
                   13049:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13050:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13051:             need to take some extra steps to ensure that the
                   13052:             database is kept consistent with respect to these new
                   13053:             files:</p>
1.1       grant    13054: 
                   13055:             <div class="orderedlist">
                   13056:               <ol type="1">
                   13057:                 <li>
1.45      wiz      13058:                   <p>Include <code xmlns=
                   13059:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13060:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13061:                   (avoid using the <code xmlns=
                   13062:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13063:                   "filename">buildlink3.mk</code> file from this
                   13064:                   same directory, which is reserved for inclusion
1.45      wiz      13065:                   from other <code xmlns=
                   13066:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13067:                   "filename">buildlink3.mk</code> files). It takes
                   13068:                   care of rebuilding the MIME database at
                   13069:                   installation and deinstallation time, and
                   13070:                   disallows any access to it directly from the
1.1       grant    13071:                   package.</p>
                   13072:                 </li>
                   13073: 
                   13074:                 <li>
                   13075:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13076:                   the <code xmlns=
                   13077:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13078:                   "filename">share/mime</code> directory,
                   13079:                   <span class="emphasis"><em>except</em></span> for
                   13080:                   files saved under <code xmlns=
                   13081:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13082:                   "filename">share/mime/packages</code>. The former
1.1       grant    13083:                   are handled automatically by the
1.47      reed     13084:                   update-mime-database program, but the latter are
1.1       grant    13085:                   package-dependent and must be removed by the
                   13086:                   package that installed them in the first
                   13087:                   place.</p>
                   13088:                 </li>
                   13089: 
                   13090:                 <li>
1.45      wiz      13091:                   <p>Remove any <code xmlns=
                   13092:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13093:                   "filename">share/mime/*</code> directories from
                   13094:                   the PLIST. They will be handled by the
1.1       grant    13095:                   shared-mime-info package.</p>
                   13096:                 </li>
                   13097:               </ol>
                   13098:             </div>
                   13099:           </div>
                   13100: 
                   13101:           <div class="sect2" lang="en" xml:lang="en">
                   13102:             <div class="titlepage">
                   13103:               <div>
                   13104:                 <div>
1.30      wiz      13105:                   <h3 class="title"><a name="intltool" id=
1.38      dillo    13106:                   "intltool"></a>15.5.14.&nbsp;Packages using
1.1       grant    13107:                   intltool</h3>
                   13108:                 </div>
                   13109:               </div>
                   13110:             </div>
                   13111: 
                   13112:             <p>If a package uses intltool during its build, include
1.45      wiz      13113:             the <code xmlns=
                   13114:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13115:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    13116:             file, which forces it to use the intltool package
                   13117:             provided by pkgsrc, instead of the one bundled with the
                   13118:             distribution file.</p>
                   13119: 
                   13120:             <p>This tracks intltool's build-time dependencies and
                   13121:             uses the latest available version; this way, the
                   13122:             package benefits of any bug fixes that may have
                   13123:             appeared since it was released.</p>
                   13124:           </div>
1.18      xtraeme  13125: 
                   13126:           <div class="sect2" lang="en" xml:lang="en">
                   13127:             <div class="titlepage">
                   13128:               <div>
                   13129:                 <div>
1.30      wiz      13130:                   <h3 class="title"><a name="startup-scripts" id=
1.38      dillo    13131:                   "startup-scripts"></a>15.5.15.&nbsp;Packages
1.30      wiz      13132:                   installing startup scripts</h3>
1.18      xtraeme  13133:                 </div>
                   13134:               </div>
                   13135:             </div>
                   13136: 
                   13137:             <p>If a package contains a rc.d script, it won't be
                   13138:             copied into the startup directory by default, but you
                   13139:             can enable it, by adding the option <code class=
1.45      wiz      13140:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   13141:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13142:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      13143:             the scripts into <code xmlns=
                   13144:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13145:             "filename">/etc/rc.d</code> when a package is
                   13146:             installed, and it will automatically remove the scripts
                   13147:             when the package is deinstalled.</p>
                   13148:           </div>
1.1       grant    13149:         </div>
                   13150: 
                   13151:         <div class="sect1" lang="en" xml:lang="en">
                   13152:           <div class="titlepage">
                   13153:             <div>
                   13154:               <div>
                   13155:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13156:                 "feedback-to-author" id=
1.38      dillo    13157:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      13158:                 author</h2>
1.1       grant    13159:               </div>
                   13160:             </div>
                   13161:           </div>
                   13162: 
                   13163:           <p>If you have found any bugs in the package you make
                   13164:           available, if you had to do special steps to make it run
                   13165:           under NetBSD or if you enhanced the software in various
                   13166:           other ways, be sure to report these changes back to the
                   13167:           original author of the program! With that kind of
                   13168:           support, the next release of the program can incorporate
                   13169:           these fixes, and people not using the NetBSD packages
                   13170:           system can win from your efforts.</p>
                   13171: 
                   13172:           <p>Support the idea of free software!</p>
                   13173:         </div>
                   13174:       </div>
                   13175: 
                   13176:       <div class="chapter" lang="en" xml:lang="en">
                   13177:         <div class="titlepage">
                   13178:           <div>
                   13179:             <div>
                   13180:               <h2 class="title"><a name="debug" id=
1.38      dillo    13181:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    13182:             </div>
                   13183:           </div>
                   13184:         </div>
                   13185: 
                   13186:         <p>To check out all the gotchas when building a package,
                   13187:         here are the steps that I do in order to get a package
                   13188:         working. Please note this is basically the same as what was
                   13189:         explained in the previous sections, only with some
                   13190:         debugging aids.</p>
                   13191: 
                   13192:         <div class="itemizedlist">
                   13193:           <ul type="disc">
                   13194:             <li>
1.14      xtraeme  13195:               <p>Be sure to set <code class=
1.45      wiz      13196:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   13197:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13198:               "filename">/etc/mk.conf</code></p>
1.1       grant    13199:             </li>
                   13200: 
                   13201:             <li>
                   13202:               <p>Install <a xmlns=
                   13203:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13204:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      13205:               target="_top"><code xmlns="" class=
                   13206:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      13207:               directory for a new package, change into it, then run
                   13208:               <span><strong class=
                   13209:               "command">url2pkg</strong></span>:</p>
1.1       grant    13210:               <pre class="screen">
1.14      xtraeme  13211: <code class="prompt">%</code> <strong class=
                   13212: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   13213: "replaceable"><code>category</code></em>/<em class=
                   13214: "replaceable"><code>examplepkg</code></em></code></strong>
                   13215: <code class="prompt">%</code> <strong class=
                   13216: "userinput"><code>cd /usr/pkgsrc/<em class=
                   13217: "replaceable"><code>category</code></em>/<em class=
                   13218: "replaceable"><code>examplepkg</code></em></code></strong>
                   13219: <code class="prompt">%</code> <strong class=
                   13220: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    13221: </pre>
                   13222:             </li>
                   13223: 
                   13224:             <li>
1.45      wiz      13225:               <p>Edit the <code xmlns=
                   13226:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13227:               "filename">Makefile</code> as requested.</p>
1.1       grant    13228:             </li>
                   13229: 
                   13230:             <li>
1.45      wiz      13231:               <p>Fill in the <code xmlns=
                   13232:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13233:               "filename">DESCR</code> file</p>
1.1       grant    13234:             </li>
                   13235: 
                   13236:             <li>
1.14      xtraeme  13237:               <p>Run <span><strong class="command">make
                   13238:               configure</strong></span></p>
1.1       grant    13239:             </li>
                   13240: 
                   13241:             <li>
                   13242:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      13243:               and the configure step to the package's <code xmlns=
                   13244:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13245:               "filename">Makefile</code>.</p>
1.1       grant    13246:             </li>
                   13247: 
                   13248:             <li>
                   13249:               <p>Make the package compile, doing multiple rounds
                   13250:               of</p>
                   13251:               <pre class="screen">
1.14      xtraeme  13252: <code class="prompt">%</code> <strong class=
                   13253: "userinput"><code>make</code></strong>
                   13254: <code class="prompt">%</code> <strong class=
                   13255: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   13256: <code class="prompt">%</code> <strong class=
                   13257: "userinput"><code>mkpatches</code></strong>
                   13258: <code class="prompt">%</code> <strong class=
                   13259: "userinput"><code>patchdiff</code></strong>
                   13260: <code class="prompt">%</code> <strong class=
                   13261: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   13262: <code class="prompt">%</code> <strong class=
                   13263: "userinput"><code>make mps</code></strong>
                   13264: <code class="prompt">%</code> <strong class=
                   13265: "userinput"><code>make clean</code></strong>
1.1       grant    13266: </pre>
                   13267: 
                   13268:               <p>Doing as non-root user will ensure that no files
                   13269:               are modified that shouldn't be, especially during the
1.14      xtraeme  13270:               build phase. <span><strong class=
                   13271:               "command">mkpatches</strong></span>,
                   13272:               <span><strong class=
                   13273:               "command">patchdiff</strong></span> and
                   13274:               <span><strong class="command">pkgvi</strong></span>
                   13275:               are from the <a xmlns=
1.1       grant    13276:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13277:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      13278:               target="_top"><code xmlns="" class=
                   13279:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    13280:             </li>
                   13281: 
                   13282:             <li>
1.45      wiz      13283:               <p>Look at the <code xmlns=
                   13284:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13285:               "filename">Makefile</code>, fix if necessary; see
                   13286:               <a href="#components.Makefile" title=
1.38      dillo    13287:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      13288:               &#8220;<code xmlns=
                   13289:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13290:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    13291:             </li>
                   13292: 
                   13293:             <li>
1.45      wiz      13294:               <p>Generate a <code xmlns=
                   13295:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13296:               "filename">PLIST</code>:</p>
1.1       grant    13297:               <pre class="screen">
1.14      xtraeme  13298: <code class="prompt">#</code> <strong class=
                   13299: "userinput"><code>make install</code></strong>
                   13300: <code class="prompt">#</code> <strong class=
                   13301: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   13302: <code class="prompt">#</code> <strong class=
                   13303: "userinput"><code>make deinstall</code></strong>
                   13304: <code class="prompt">#</code> <strong class=
                   13305: "userinput"><code>make install</code></strong>
                   13306: <code class="prompt">#</code> <strong class=
                   13307: "userinput"><code>make deinstall</code></strong>
1.1       grant    13308: </pre>
                   13309: 
1.45      wiz      13310:               <p>You usually need to be <code xmlns=
                   13311:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13312:               "username">root</code> to do this. Look if there are
1.1       grant    13313:               any files left:</p>
                   13314:               <pre class="screen">
1.14      xtraeme  13315: <code class="prompt">#</code> <strong class=
                   13316: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    13317: </pre>
                   13318: 
                   13319:               <p>If this reveals any files that are missing in
1.45      wiz      13320:               <code xmlns=
                   13321:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13322:               "filename">PLIST</code>, add them.</p>
1.1       grant    13323:             </li>
                   13324: 
                   13325:             <li>
1.45      wiz      13326:               <p>Now that the <code xmlns=
                   13327:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13328:               "filename">PLIST</code> is OK, install the package
                   13329:               again and make a binary package:</p>
1.1       grant    13330:               <pre class="screen">
1.14      xtraeme  13331: <code class="prompt">#</code> <strong class=
                   13332: "userinput"><code>make reinstall</code></strong>
                   13333: <code class="prompt">#</code> <strong class=
                   13334: "userinput"><code>make package</code></strong>
1.1       grant    13335: </pre>
                   13336:             </li>
                   13337: 
                   13338:             <li>
                   13339:               <p>Delete the installed package:</p>
                   13340:               <pre class="screen">
1.14      xtraeme  13341: <code class="prompt">#</code> <strong class=
                   13342: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    13343: </pre>
                   13344:             </li>
                   13345: 
                   13346:             <li>
1.14      xtraeme  13347:               <p>Repeat the above <span><strong class=
                   13348:               "command">make print-PLIST</strong></span> command,
                   13349:               which shouldn't find anything now:</p>
1.1       grant    13350:               <pre class="screen">
1.14      xtraeme  13351: <code class="prompt">#</code> <strong class=
                   13352: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    13353: </pre>
                   13354:             </li>
                   13355: 
                   13356:             <li>
                   13357:               <p>Reinstall the binary package:</p>
                   13358:               <pre class="screen">
1.14      xtraeme  13359: <code class="prompt">#</code> <strong class=
                   13360: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    13361: </pre>
                   13362:             </li>
                   13363: 
                   13364:             <li>
                   13365:               <p>Play with it. Make sure everything works.</p>
                   13366:             </li>
                   13367: 
                   13368:             <li>
1.14      xtraeme  13369:               <p>Run <span><strong class=
                   13370:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    13371:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13372:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      13373:               target="_top"><code xmlns="" class=
                   13374:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      13375:               problems it reports:</p>
1.1       grant    13376:               <pre class="screen">
1.14      xtraeme  13377: <code class="prompt">#</code> <strong class=
                   13378: "userinput"><code>pkglint</code></strong>
1.1       grant    13379: </pre>
                   13380:             </li>
                   13381: 
                   13382:             <li>
                   13383:               <p>Submit (or commit, if you have cvs access); see
                   13384:               <a href="#submit" title=
1.38      dillo    13385:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    13386:               <i>Submitting and Committing</i></a>.</p>
                   13387:             </li>
                   13388:           </ul>
                   13389:         </div>
                   13390:       </div>
                   13391: 
                   13392:       <div class="chapter" lang="en" xml:lang="en">
                   13393:         <div class="titlepage">
                   13394:           <div>
                   13395:             <div>
                   13396:               <h2 class="title"><a name="submit" id=
1.38      dillo    13397:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    13398:               Committing</h2>
                   13399:             </div>
                   13400:           </div>
                   13401:         </div>
                   13402: 
                   13403:         <div class="toc">
                   13404:           <p><b>Table of Contents</b></p>
                   13405: 
                   13406:           <dl>
1.30      wiz      13407:             <dt><span class="sect1"><a href=
1.38      dillo    13408:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      13409:             packages</a></span></dt>
1.1       grant    13410: 
1.30      wiz      13411:             <dt><span class="sect1"><a href=
1.41      wiz      13412:             "#general-notes-for-changes">17.2. General notes when
                   13413:             adding, updating, or removing packages</a></span></dt>
                   13414: 
                   13415:             <dt><span class="sect1"><a href=
                   13416:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      13417:             package into CVS</a></span></dt>
1.1       grant    13418: 
1.30      wiz      13419:             <dt><span class="sect1"><a href=
1.41      wiz      13420:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      13421:             version</a></span></dt>
1.1       grant    13422: 
1.41      wiz      13423:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  13424:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    13425:           </dl>
                   13426:         </div>
                   13427: 
                   13428:         <div class="sect1" lang="en" xml:lang="en">
                   13429:           <div class="titlepage">
                   13430:             <div>
                   13431:               <div>
                   13432:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13433:                 "submitting-your-package" id=
1.38      dillo    13434:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      13435:                 your packages</h2>
1.1       grant    13436:               </div>
                   13437:             </div>
                   13438:           </div>
                   13439: 
                   13440:           <p>You have to separate between binary and
                   13441:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   13442:           packages here:</p>
                   13443: 
                   13444:           <div class="itemizedlist">
                   13445:             <ul type="disc">
                   13446:               <li>
                   13447:                 <p>precompiled binary packages</p>
                   13448: 
                   13449:                 <p>Our policy is that we accept binaries only from
                   13450:                 pkgsrc developers to guarantee that the packages
                   13451:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  13452:                 annoy anyone but rather to protect our users!
1.1       grant    13453:                 You're still free to put up your home-made binary
1.13      hubertf  13454:                 packages and tell the world where to get them.
                   13455:                 NetBSD developers doing bulk builds and wanting to
                   13456:                 upload them please see <a href="#bulk-upload"
1.38      dillo    13457:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   13458:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  13459:                 bulk build&#8221;</a>.</p>
1.1       grant    13460:               </li>
                   13461: 
                   13462:               <li>
                   13463:                 <p>packages</p>
                   13464: 
                   13465:                 <p>First, check that your package is complete,
                   13466:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    13467:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    13468:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      13469:                 Next, generate an uuencoded gzipped <a href=
                   13470:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   13471:                 <span class="citerefentry"><span class=
                   13472:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    13473:                 preferably with all files in a single directory.
1.14      xtraeme  13474:                 Finally, <span><strong class=
                   13475:                 "command">send-pr</strong></span> with category
1.1       grant    13476:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   13477:                 synopsis which includes the package name and
                   13478:                 version number, a short description of your package
                   13479:                 (contents of the COMMENT variable or DESCR file are
                   13480:                 OK) and attach the archive to your PR.</p>
                   13481: 
                   13482:                 <p>If you want to submit several packages, please
                   13483:                 send a separate PR for each one, it's easier for us
                   13484:                 to track things that way.</p>
                   13485: 
                   13486:                 <p>Alternatively, you can also import new packages
                   13487:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   13488:                 work-in-progress</span>&#8221;); see the homepage
                   13489:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   13490:                 target=
                   13491:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   13492:                 details.</p>
                   13493:               </li>
                   13494:             </ul>
                   13495:           </div>
                   13496:         </div>
                   13497: 
                   13498:         <div class="sect1" lang="en" xml:lang="en">
                   13499:           <div class="titlepage">
                   13500:             <div>
                   13501:               <div>
                   13502:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      13503:                 "general-notes-for-changes" id=
                   13504:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   13505:                 notes when adding, updating, or removing
                   13506:                 packages</h2>
                   13507:               </div>
                   13508:             </div>
                   13509:           </div>
                   13510: 
                   13511:           <p>Please note all package additions, updates, moves, and
1.45      wiz      13512:           removals in <code xmlns=
                   13513:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13514:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   13515:           to keep this file up to date and conforming to the
                   13516:           existing format, because it will be used by scripts to
                   13517:           automatically update pages on <a href=
                   13518:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      13519:           and other sites. Additionally, check the <code xmlns=
                   13520:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13521:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   13522:           entry for the package you updated or removed, in case it
                   13523:           was mentioned there.</p>
                   13524: 
                   13525:           <p>There is a make target that helps in creating proper
1.45      wiz      13526:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13527:           class="filename">CHANGES</code> entries:
1.41      wiz      13528:           <span><strong class="command">make
                   13529:           changes-entry</strong></span>. It uses the optional
                   13530:           <code class="varname">CTYPE</code> and <code class=
                   13531:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      13532:           usage is to first make sure that your <code xmlns=
                   13533:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13534:           "filename">CHANGES</code> file is up-to-date (to avoid
                   13535:           having to resolve conflicts later-on) and then to
                   13536:           <span><strong class="command">cd</strong></span> to the
                   13537:           package directory. For package updates,
                   13538:           <span><strong class="command">make
                   13539:           changes-entry</strong></span> is enough. For new
                   13540:           packages, or package moves or removals, set the
                   13541:           <code class="varname">CTYPE</code> variable on the
                   13542:           command line to "Added", "Moved", or "Removed". You can
                   13543:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      13544:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13545:           class="filename">/etc/mk.conf</code> if your local login
                   13546:           name is not the same as your NetBSD login name. Don't
                   13547:           forget to commit the changes to <code xmlns=
                   13548:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13549:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   13550:         </div>
                   13551: 
                   13552:         <div class="sect1" lang="en" xml:lang="en">
                   13553:           <div class="titlepage">
                   13554:             <div>
                   13555:               <div>
                   13556:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13557:                 "committing-importing" id=
1.41      wiz      13558:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      13559:                 Importing a package into CVS</h2>
1.1       grant    13560:               </div>
                   13561:             </div>
                   13562:           </div>
                   13563: 
                   13564:           <p>This section is only of interest for pkgsrc developers
                   13565:           with write access to the pkgsrc repository. Please
                   13566:           remember that cvs imports files relative to the current
                   13567:           working directory, and that the pathname that you give
1.14      xtraeme  13568:           the <span><strong class="command">cvs
                   13569:           import</strong></span> command is so that it knows where
                   13570:           to place the files in the repository. Newly created
                   13571:           packages should be imported with a vendor tag of
                   13572:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   13573:           release tag of &#8220;<span class=
                   13574:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    13575:           <pre class="programlisting">
                   13576:   % cd .../pkgsrc/category/pkgname
                   13577:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   13578: </pre>
                   13579: 
                   13580:           <p>Remember to move the directory from which you imported
                   13581:           out of the way, or cvs will complain the next time you
                   13582:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   13583:           source tree. Also don't forget to add the new package to
1.45      wiz      13584:           the category's <code xmlns=
                   13585:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13586:           "filename">Makefile</code>.</p>
1.1       grant    13587: 
                   13588:           <p>The commit message of the initial import should
1.45      wiz      13589:           include part of the <code xmlns=
                   13590:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   13591:           "filename">DESCR</code> file, so people reading the
                   13592:           mailing lists know what the package is/does.</p>
1.1       grant    13593: 
                   13594:           <p>For new packages, &#8220;<span class="quote">cvs
                   13595:           import</span>&#8221; is preferred to &#8220;<span class=
                   13596:           "quote">cvs add</span>&#8221; because the former gets
                   13597:           everything with a single command, and provides a
                   13598:           consistent tag.</p>
                   13599:         </div>
                   13600: 
                   13601:         <div class="sect1" lang="en" xml:lang="en">
                   13602:           <div class="titlepage">
                   13603:             <div>
                   13604:               <div>
                   13605:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13606:                 "updating-package" id=
1.41      wiz      13607:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      13608:                 package to a newer version</h2>
1.1       grant    13609:               </div>
                   13610:             </div>
                   13611:           </div>
                   13612: 
                   13613:           <p>Please always put a concise, appropriate and relevant
                   13614:           summary of the changes between old and new versions into
                   13615:           the commit log when updating a package. There are various
                   13616:           reasons for this:</p>
                   13617: 
                   13618:           <div class="itemizedlist">
                   13619:             <ul type="disc">
                   13620:               <li>
                   13621:                 <p>A URL is volatile, and can change over time. It
                   13622:                 may go away completely or its information may be
                   13623:                 overwritten by newer information.</p>
                   13624:               </li>
                   13625: 
                   13626:               <li>
                   13627:                 <p>Having the change information between old and
                   13628:                 new versions in our CVS repository is very useful
                   13629:                 for people who use either cvs or anoncvs.</p>
                   13630:               </li>
                   13631: 
                   13632:               <li>
                   13633:                 <p>Having the change information between old and
                   13634:                 new versions in our CVS repository is very useful
                   13635:                 for people who read the pkgsrc-changes mailing
                   13636:                 list, so that they can make tactical decisions
                   13637:                 about when to upgrade the package.</p>
                   13638:               </li>
                   13639:             </ul>
                   13640:           </div>
                   13641: 
1.18      xtraeme  13642:           <p>Please also recognize that, just because a new version
1.1       grant    13643:           of a package has been released, it should not
                   13644:           automatically be upgraded in the CVS repository. We
                   13645:           prefer to be conservative in the packages that are
                   13646:           included in pkgsrc - development or beta packages are not
                   13647:           really the best thing for most places in which pkgsrc is
                   13648:           used. Please use your judgement about what should go into
                   13649:           pkgsrc, and bear in mind that stability is to be
                   13650:           preferred above new and possibly untested features.</p>
                   13651:         </div>
                   13652: 
                   13653:         <div class="sect1" lang="en" xml:lang="en">
                   13654:           <div class="titlepage">
                   13655:             <div>
                   13656:               <div>
                   13657:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13658:                 "moving-package" id=
1.41      wiz      13659:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      13660:                 pkgsrc</h2>
1.1       grant    13661:               </div>
                   13662:             </div>
                   13663:           </div>
                   13664: 
                   13665:           <div class="orderedlist">
                   13666:             <ol type="1">
                   13667:               <li>
                   13668:                 <p>Make a copy of the directory somewhere else.</p>
                   13669:               </li>
                   13670: 
                   13671:               <li>
                   13672:                 <p>Remove all CVS dirs.</p>
                   13673: 
                   13674:                 <p>Alternatively to the first two steps you can
                   13675:                 also do:</p>
                   13676:                 <pre class="screen">
1.14      xtraeme  13677: <code class="prompt">%</code> <strong class=
                   13678: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    13679: </pre>
                   13680: 
                   13681:                 <p>and use that for further work.</p>
                   13682:               </li>
                   13683: 
                   13684:               <li>
1.14      xtraeme  13685:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   13686:                 any <code class="varname">DEPENDS</code> paths that
                   13687:                 just did &#8220;<span class=
1.1       grant    13688:                 "quote">../package</span>&#8221; instead of
                   13689:                 &#8220;<span class=
                   13690:                 "quote">../../category/package</span>&#8221;.</p>
                   13691:               </li>
                   13692: 
                   13693:               <li>
1.14      xtraeme  13694:                 <p><span><strong class="command">cvs
                   13695:                 import</strong></span> the modified package in the
                   13696:                 new place.</p>
1.1       grant    13697:               </li>
                   13698: 
                   13699:               <li>
                   13700:                 <p>Check if any package depends on it:</p>
                   13701:                 <pre class="screen">
1.14      xtraeme  13702: <code class="prompt">%</code> <strong class=
                   13703: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   13704: <code class="prompt">%</code> <strong class=
                   13705: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    13706: </pre>
                   13707:               </li>
                   13708: 
                   13709:               <li>
                   13710:                 <p>Fix paths in packages from step 5 to point to
                   13711:                 new location.</p>
                   13712:               </li>
                   13713: 
                   13714:               <li>
1.14      xtraeme  13715:                 <p><span><strong class="command">cvs rm
                   13716:                 (-f)</strong></span> the package at the old
                   13717:                 location.</p>
1.1       grant    13718:               </li>
                   13719: 
                   13720:               <li>
1.45      wiz      13721:                 <p>Remove from <code xmlns=
                   13722:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13723:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    13724:               </li>
                   13725: 
                   13726:               <li>
1.45      wiz      13727:                 <p>Add to <code xmlns=
                   13728:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13729:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    13730:               </li>
                   13731: 
                   13732:               <li>
                   13733:                 <p>Commit the changed and removed files:</p>
                   13734:                 <pre class="screen">
1.14      xtraeme  13735: <code class="prompt">%</code> <strong class=
                   13736: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    13737: </pre>
                   13738: 
                   13739:                 <p>(and any packages from step 5, of course).</p>
                   13740:               </li>
                   13741:             </ol>
                   13742:           </div>
                   13743:         </div>
                   13744:       </div>
                   13745:     </div>
                   13746: 
                   13747:     <div class="appendix" lang="en" xml:lang="en">
                   13748:       <div class="titlepage">
                   13749:         <div>
                   13750:           <div>
                   13751:             <h2 class="title"><a name="examples" id=
1.46      gdt      13752:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    13753:             package: bison</h2>
                   13754:           </div>
                   13755:         </div>
                   13756:       </div>
                   13757: 
                   13758:       <div class="toc">
                   13759:         <p><b>Table of Contents</b></p>
                   13760: 
                   13761:         <dl>
1.46      gdt      13762:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    13763:           files</a></span></dt>
                   13764: 
                   13765:           <dd>
                   13766:             <dl>
1.30      wiz      13767:               <dt><span class="sect2"><a href=
1.46      gdt      13768:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    13769: 
1.30      wiz      13770:               <dt><span class="sect2"><a href=
1.46      gdt      13771:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    13772: 
1.30      wiz      13773:               <dt><span class="sect2"><a href=
1.46      gdt      13774:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    13775: 
1.30      wiz      13776:               <dt><span class="sect2"><a href=
1.46      gdt      13777:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      13778:               package with <span><strong class=
1.14      xtraeme  13779:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    13780:             </dl>
                   13781:           </dd>
                   13782: 
1.46      gdt      13783:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      13784:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    13785:         </dl>
                   13786:       </div>
                   13787: 
                   13788:       <p>We checked to find a piece of software that wasn't in the
                   13789:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  13790:       would want to have <span><strong class=
                   13791:       "command">bison</strong></span> when Berkeley
                   13792:       <span><strong class="command">yacc</strong></span> is already
                   13793:       present in the tree is beyond us, but it's useful for the
                   13794:       purposes of this exercise.</p>
1.1       grant    13795: 
                   13796:       <div class="sect1" lang="en" xml:lang="en">
                   13797:         <div class="titlepage">
                   13798:           <div>
                   13799:             <div>
                   13800:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13801:               "example-files" id=
1.46      gdt      13802:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    13803:             </div>
                   13804:           </div>
                   13805:         </div>
                   13806: 
                   13807:         <div class="sect2" lang="en" xml:lang="en">
                   13808:           <div class="titlepage">
                   13809:             <div>
                   13810:               <div>
1.30      wiz      13811:                 <h3 class="title"><a name="example-Makefile" id=
1.46      gdt      13812:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    13813:               </div>
                   13814:             </div>
                   13815:           </div>
                   13816:           <pre class="programlisting">
1.17      sketch   13817: # $NetBSD$
1.1       grant    13818: #
                   13819: 
                   13820: DISTNAME=       bison-1.25
                   13821: CATEGORIES=     devel
                   13822: MASTER_SITES=   ${MASTER_SITE_GNU}
                   13823: 
                   13824: MAINTAINER=     thorpej@NetBSD.org
                   13825: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   13826: COMMENT=        GNU yacc clone
                   13827: 
                   13828: GNU_CONFIGURE=  yes
                   13829: INFO_FILES=     bison.info
                   13830: 
                   13831: .include "../../mk/bsd.pkg.mk"
                   13832: </pre>
                   13833:         </div>
                   13834: 
                   13835:         <div class="sect2" lang="en" xml:lang="en">
                   13836:           <div class="titlepage">
                   13837:             <div>
                   13838:               <div>
1.30      wiz      13839:                 <h3 class="title"><a name="example-descr" id=
1.46      gdt      13840:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    13841:               </div>
                   13842:             </div>
                   13843:           </div>
                   13844:           <pre class="programlisting">
                   13845: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   13846: improvements.  Why you would want this when Berkeley <a href=
                   13847: "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
                   13848: of the NetBSD source tree is beyond me.
                   13849: </pre>
                   13850:         </div>
                   13851: 
                   13852:         <div class="sect2" lang="en" xml:lang="en">
                   13853:           <div class="titlepage">
                   13854:             <div>
                   13855:               <div>
1.30      wiz      13856:                 <h3 class="title"><a name="example-plist" id=
1.46      gdt      13857:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    13858:               </div>
                   13859:             </div>
                   13860:           </div>
                   13861:           <pre class="programlisting">
1.17      sketch   13862: @comment $NetBSD$
1.1       grant    13863: bin/bison
                   13864: man/man1/bison.1.gz
                   13865: share/bison.simple
                   13866: share/bison.hairy
                   13867: </pre>
                   13868:         </div>
                   13869: 
                   13870:         <div class="sect2" lang="en" xml:lang="en">
                   13871:           <div class="titlepage">
                   13872:             <div>
                   13873:               <div>
1.30      wiz      13874:                 <h3 class="title"><a name=
                   13875:                 "checking-package-with-pkglint" id=
1.46      gdt      13876:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      13877:                 a package with <span><strong class=
1.14      xtraeme  13878:                 "command">pkglint</strong></span></h3>
1.1       grant    13879:               </div>
                   13880:             </div>
                   13881:           </div>
                   13882: 
                   13883:           <p>The NetBSD package system comes with <a xmlns=
                   13884:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   13885:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      13886:           target="_top"><code xmlns="" class=
                   13887:           "filename">pkgtools/pkglint</code></a> which helps to
                   13888:           check the contents of these files. After installation it
                   13889:           is quite easy to use, just change to the directory of the
1.20      ben      13890:           package you wish to examine and execute
                   13891:           <span><strong class=
                   13892:           "command">pkglint</strong></span>:</p>
1.1       grant    13893:           <pre class="screen">
1.14      xtraeme  13894: <code class="prompt">$</code> <strong class=
                   13895: "userinput"><code>pkglint</code></strong>
1.1       grant    13896: looks fine.
                   13897: </pre>
                   13898: 
                   13899:           <p>Depending on the supplied command line arguments (see
1.47      reed     13900:           pkglint(1)), more verbose checks will be performed. Use
1.14      xtraeme  13901:           e.g. <span><strong class="command">pkglint
                   13902:           -v</strong></span> for a very verbose check.</p>
1.1       grant    13903:         </div>
                   13904:       </div>
                   13905: 
                   13906:       <div class="sect1" lang="en" xml:lang="en">
                   13907:         <div class="titlepage">
                   13908:           <div>
                   13909:             <div>
                   13910:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13911:               "steps-for-b-i-p" id=
1.46      gdt      13912:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      13913:               installing, packaging</h2>
1.1       grant    13914:             </div>
                   13915:           </div>
                   13916:         </div>
                   13917: 
                   13918:         <p>Create the directory where the package lives, plus any
                   13919:         auxiliary directories:</p>
                   13920:         <pre class="screen">
1.14      xtraeme  13921: <code class="prompt">#</code> <strong class=
                   13922: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   13923: <code class="prompt">#</code> <strong class=
                   13924: "userinput"><code>mkdir bison</code></strong>
                   13925: <code class="prompt">#</code> <strong class=
                   13926: "userinput"><code>cd bison</code></strong>
                   13927: <code class="prompt">#</code> <strong class=
                   13928: "userinput"><code>mkdir patches</code></strong>
1.1       grant    13929: </pre>
                   13930: 
1.45      wiz      13931:         <p>Create <code xmlns=
                   13932:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   13933:         "filename">Makefile</code>, <code xmlns=
                   13934:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   13935:         "filename">DESCR</code> and <code xmlns=
                   13936:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13937:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    13938:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
                   13939:         Chapter 8, <i>Package components - files, directories and
1.1       grant    13940:         contents</i></a>) then continue with fetching the
                   13941:         distfile:</p>
                   13942:         <pre class="screen">
1.14      xtraeme  13943: <code class="prompt">#</code> <strong class=
                   13944: "userinput"><code>make fetch</code></strong>
1.1       grant    13945: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   13946: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   13947: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13948: ftp: Error retrieving file: 500 Internal error
                   13949: 
                   13950: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   13951: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13952: ftp: Error retrieving file: 500 Internal error
                   13953: 
                   13954: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   13955: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13956: Successfully retrieved file.
                   13957: </pre>
                   13958: 
1.45      wiz      13959:         <p>Generate the checksum of the distfile into <code xmlns=
                   13960:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13961:         "filename">distinfo</code>:</p>
1.1       grant    13962:         <pre class="screen">
1.14      xtraeme  13963: <code class="prompt">#</code> <strong class=
                   13964: "userinput"><code>make makesum</code></strong>
1.1       grant    13965: </pre>
                   13966: 
                   13967:         <p>Now compile:</p>
                   13968:         <pre class="screen">
1.14      xtraeme  13969: <code class="prompt">#</code> <strong class=
                   13970: "userinput"><code>make</code></strong>
1.1       grant    13971: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   13972: ===&gt;  Extracting for bison-1.25
                   13973: ===&gt;  Patching for bison-1.25
                   13974: ===&gt;   Ignoring empty patch directory
                   13975: ===&gt;  Configuring for bison-1.25
                   13976: creating cache ./config.cache
                   13977: checking for gcc... cc
                   13978: checking whether we are using GNU C... yes
                   13979: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   13980: checking how to run the C preprocessor... cc -E
                   13981: checking for minix/config.h... no
                   13982: checking for POSIXized ISC... no
                   13983: checking whether cross-compiling... no
                   13984: checking for ANSI C header files... yes
                   13985: checking for string.h... yes
                   13986: checking for stdlib.h... yes
                   13987: checking for memory.h... yes
                   13988: checking for working const... yes
                   13989: checking for working alloca.h... no
                   13990: checking for alloca... yes
                   13991: checking for strerror... yes
                   13992: updating cache ./config.cache
                   13993: creating ./config.status
                   13994: creating Makefile
                   13995: ===&gt;  Building for bison-1.25
                   13996: 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
                   13997: 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
                   13998: 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
                   13999: 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
                   14000: 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
                   14001: 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 
                   14002: 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
                   14003: 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
                   14004: 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
                   14005: 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
                   14006: 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
                   14007: 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
                   14008: 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
                   14009: 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
                   14010: 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
                   14011: 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
                   14012: 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
                   14013: 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
                   14014: 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
                   14015: 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
                   14016: 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
                   14017: 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
                   14018: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   14019: rm -f bison.s1
                   14020: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   14021: </pre>
                   14022: 
                   14023:         <p>Everything seems OK, so install the files:</p>
                   14024:         <pre class="screen">
1.14      xtraeme  14025: <code class="prompt">#</code> <strong class=
                   14026: "userinput"><code>make install</code></strong>
1.1       grant    14027: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14028: ===&gt;  Installing for bison-1.25
                   14029: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   14030: rm -f /usr/pkg/bin/bison
                   14031: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   14032: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   14033: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   14034: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   14035: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   14036: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   14037: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   14038: ===&gt;  Registering installation for bison-1.25
                   14039: </pre>
                   14040: 
                   14041:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  14042:         remove it with <span><strong class="command">pkg_delete
                   14043:         bison</strong></span>. Should you decide that you want a
                   14044:         binary package, do this now:</p>
1.1       grant    14045:         <pre class="screen">
1.14      xtraeme  14046: <code class="prompt">#</code> <strong class=
                   14047: "userinput"><code>make package</code></strong>
1.1       grant    14048: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14049: ===&gt;  Building package for bison-1.25
                   14050: Creating package bison-1.25.tgz
                   14051: Registering depends:.
                   14052: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   14053: </pre>
                   14054: 
                   14055:         <p>Now that you don't need the source and object files any
                   14056:         more, clean up:</p>
                   14057:         <pre class="screen">
1.14      xtraeme  14058: <code class="prompt">#</code> <strong class=
                   14059: "userinput"><code>make clean</code></strong>
1.1       grant    14060: ===&gt;  Cleaning for bison-1.25
                   14061: </pre>
                   14062:       </div>
                   14063:     </div>
                   14064: 
                   14065:     <div class="appendix" lang="en" xml:lang="en">
                   14066:       <div class="titlepage">
                   14067:         <div>
                   14068:           <div>
                   14069:             <h2 class="title"><a name="logs" id=
1.46      gdt      14070:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    14071:           </div>
                   14072:         </div>
                   14073:       </div>
                   14074: 
                   14075:       <div class="toc">
                   14076:         <p><b>Table of Contents</b></p>
                   14077: 
                   14078:         <dl>
1.46      gdt      14079:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    14080:           Building figlet</a></span></dt>
                   14081: 
1.46      gdt      14082:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    14083:           Packaging figlet</a></span></dt>
                   14084:         </dl>
                   14085:       </div>
                   14086: 
                   14087:       <div class="sect1" lang="en" xml:lang="en">
                   14088:         <div class="titlepage">
                   14089:           <div>
                   14090:             <div>
                   14091:               <h2 class="title" style="clear: both"><a name=
                   14092:               "logs.building" id=
1.46      gdt      14093:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    14094:             </div>
                   14095:           </div>
                   14096:         </div>
                   14097:         <pre class="screen">
1.14      xtraeme  14098: <code class="prompt">#</code> <strong class=
                   14099: "userinput"><code>make</code></strong>
1.1       grant    14100: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14101: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   14102: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   14103: =&gt; [172219 bytes]
                   14104: Connected to ftp.plig.net.
                   14105: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   14106: 331 Guest login ok, send your complete e-mail address as password.
                   14107: 230-You are user #5 of 500 simultaneous users allowed.
                   14108: 230-
                   14109: 230-  ___ _             _ _                   
                   14110: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   14111: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   14112: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   14113: 230-         |_|   |_|     |___|         |___|
                   14114: 230-
                   14115: 230-** Welcome to ftp.plig.org **
                   14116: 230-
                   14117: 230-Please note that all transfers from this FTP site are logged. If you
                   14118: 230-do not like this, please disconnect now.
                   14119: 230-
                   14120: 230-This arhive is available via
                   14121: 230-
                   14122: 230-HTTP:  http://ftp.plig.org/
                   14123: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   14124: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   14125: 230-
                   14126: 230-Please email comments, bug reports and requests for packages to be
                   14127: 230-mirrored to ftp-admin@plig.org.   
                   14128: 230-
                   14129: 230-
                   14130: 230 Logged in anonymously.
                   14131: Remote system type is UNIX.
                   14132: Using binary mode to transfer files.
                   14133: 200 Type okay.
                   14134: 250 "/pub" is new cwd.
                   14135: 250-"/pub/figlet" is new cwd.
                   14136: 250-
                   14137: 250-Welcome to the figlet archive at ftp.figlet.org
                   14138: 250-    
                   14139: 250-    ftp://ftp.figlet.org/pub/figlet/
                   14140: 250-
                   14141: 250-The official FIGlet web page is:
                   14142: 250-    http://www.figlet.org/
                   14143: 250-
                   14144: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   14145: 250-contribute a font or something else, you can email us.
                   14146: 250 
                   14147: 250 "/pub/figlet/program" is new cwd.
                   14148: 250 "/pub/figlet/program/unix" is new cwd.
                   14149: local: figlet221.tar.gz remote: figlet221.tar.gz
                   14150: 502 Unimplemented command.
                   14151: 227 Entering Passive Mode (195,40,6,41,246,104)
                   14152: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   14153: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   14154: 226 Transfer completed.
                   14155: 172219 bytes received in 00:02 (75.99 KB/s)
                   14156: 221 Goodbye.
                   14157: =&gt; Checksum OK for figlet221.tar.gz.
                   14158: ===&gt; Extracting for figlet-2.2.1nb2
                   14159: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   14160: ===&gt; Patching for figlet-2.2.1nb2
                   14161: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   14162: ===&gt; Overriding tools for figlet-2.2.1nb2
                   14163: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   14164: ===&gt; Configuring for figlet-2.2.1nb2
                   14165: ===&gt; Building for figlet-2.2.1nb2
                   14166: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   14167: chmod a+x figlet
                   14168: gcc -O2 -o chkfont chkfont.c
                   14169: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  14170: <code class="prompt">#</code>
                   14171: <code class="prompt">#</code> <strong class=
                   14172: "userinput"><code>make install</code></strong>
1.1       grant    14173: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14174: ===&gt; Installing for figlet-2.2.1nb2
                   14175: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   14176: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   14177: mkdir -p /usr/pkg/share/figlet
                   14178: cp figlet /usr/pkg/bin
                   14179: cp chkfont /usr/pkg/bin
                   14180: chmod 555 figlist showfigfonts
                   14181: cp figlist /usr/pkg/bin
                   14182: cp showfigfonts /usr/pkg/bin
                   14183: cp fonts/*.flf /usr/pkg/share/figlet
                   14184: cp fonts/*.flc /usr/pkg/share/figlet
                   14185: cp figlet.6 /usr/pkg/man/man6
                   14186: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  14187: <code class="prompt">#</code>
1.1       grant    14188: </pre>
                   14189:       </div>
                   14190: 
                   14191:       <div class="sect1" lang="en" xml:lang="en">
                   14192:         <div class="titlepage">
                   14193:           <div>
                   14194:             <div>
                   14195:               <h2 class="title" style="clear: both"><a name=
                   14196:               "logs.package" id=
1.46      gdt      14197:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    14198:             </div>
                   14199:           </div>
                   14200:         </div>
                   14201:         <pre class="screen">
1.14      xtraeme  14202: <code class="prompt">#</code> <strong class=
                   14203: "userinput"><code>make package</code></strong>
1.1       grant    14204: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14205: ===&gt; Packaging figlet-2.2.1nb2
                   14206: ===&gt; Building binary package for figlet-2.2.1nb2
                   14207: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   14208: Using SrcDir value of /usr/pkg
                   14209: Registering depends:.  
1.14      xtraeme  14210: <code class="prompt">#</code>
1.1       grant    14211: </pre>
                   14212:       </div>
                   14213:     </div>
                   14214: 
                   14215:     <div class="appendix" lang="en" xml:lang="en">
                   14216:       <div class="titlepage">
                   14217:         <div>
                   14218:           <div>
                   14219:             <h2 class="title"><a name="ftp-layout" id=
1.46      gdt      14220:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    14221:             FTP server's package archive</h2>
                   14222:           </div>
                   14223:         </div>
                   14224:       </div>
                   14225: 
                   14226:       <p>Layout for precompiled binary packages on
                   14227:       ftp.NetBSD.org:</p>
                   14228:       <pre class="programlisting">
                   14229: /pub/NetBSD/packages/
                   14230:                 distfiles/
                   14231: 
                   14232:                 # Unpacked pkgsrc trees
                   14233:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   14234:                 pkgsrc-2003Q4 -&gt; N/A
                   14235:                 pkgsrc-2004Q1/pkgsrc
                   14236: 
                   14237:                 # pkgsrc archives
                   14238:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   14239:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   14240:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   14241: 
                   14242:                 # Per pkgsrc-release/OS-release/arch package archives
                   14243:                 pkgsrc-2003Q4/
                   14244:                         NetBSD-1.6.2/
                   14245:                                 i386/
                   14246:                                         All/
                   14247:                                         archivers/
                   14248:                                                 foo -&gt; ../All/foo
                   14249:                                         ...
                   14250:                 pkgsrc-2004Q1/
                   14251:                         NetBSD-1.6.2/
                   14252:                                 i386/
                   14253:                                         All/
                   14254:                                         ...
                   14255:                         NetBSD-2.0/
                   14256:                                 i386/
                   14257:                                         All/
                   14258:                                         ...
                   14259:                         SunOS-5.9/
                   14260:                                 sparc/
                   14261:                                         All/
                   14262:                                         ...
                   14263:                                 x86/
                   14264:                                         All/
                   14265:                                         ...
                   14266: 
                   14267:                 # Per os-release package archive convenience links
                   14268:                 NetBSD-1.6.2 -&gt; 1.6.2
                   14269:                 1.6.2/
                   14270:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   14271:                         m68k/
                   14272:                                 All/
                   14273:                                 archivers/
                   14274:                                         foo -&gt; ../All/foo
                   14275:                                 ...
                   14276:                         amiga -&gt; m68k
                   14277:                         atari -&gt; m68k
                   14278:                         ...
                   14279: 
                   14280:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   14281:                 NetBSD-2.0/
                   14282:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   14283:                 SunOS-5.9/
                   14284:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   14285:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   14286:                         
                   14287: </pre>
                   14288: 
                   14289:       <p>To create:</p>
                   14290: 
                   14291:       <div class="orderedlist">
                   14292:         <ol type="1">
                   14293:           <li>
                   14294:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.38      dillo    14295:             "6.3.&nbsp;Doing a bulk build of all packages">Section
                   14296:             6.3, &#8220;Doing a bulk build of all
1.1       grant    14297:             packages&#8221;</a></p>
                   14298:           </li>
                   14299: 
                   14300:           <li>
                   14301:             <p>Upload /usr/pkgsrc/packages to</p>
                   14302:             <pre class="programlisting">
                   14303:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  14304:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    14305:         `uname -s`-`uname -r`/                  # OS &amp; version
                   14306:         `uname -p`                              # architecture
                   14307:        
                   14308: </pre>
                   14309:           </li>
                   14310: 
                   14311:           <li>
1.14      xtraeme  14312:             <p>If necessary, create a symlink <span><strong class=
                   14313:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   14314:             (amiga -&gt; m68k, ...)</p>
1.1       grant    14315:           </li>
                   14316:         </ol>
                   14317:       </div>
                   14318:     </div>
1.2       hubertf  14319: 
                   14320:     <div class="appendix" lang="en" xml:lang="en">
                   14321:       <div class="titlepage">
                   14322:         <div>
                   14323:           <div>
                   14324:             <h2 class="title"><a name="editing" id=
1.46      gdt      14325:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  14326:             for the pkgsrc guide</h2>
                   14327:           </div>
                   14328:         </div>
                   14329:       </div>
                   14330: 
                   14331:       <div class="toc">
                   14332:         <p><b>Table of Contents</b></p>
                   14333: 
                   14334:         <dl>
1.46      gdt      14335:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  14336:           Targets</a></span></dt>
                   14337: 
1.46      gdt      14338:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  14339:           Procedure</a></span></dt>
                   14340:         </dl>
                   14341:       </div>
                   14342: 
                   14343:       <p>This section contains information on editing the pkgsrc
                   14344:       guide itself.</p>
                   14345: 
                   14346:       <div class="sect1" lang="en" xml:lang="en">
                   14347:         <div class="titlepage">
                   14348:           <div>
                   14349:             <div>
                   14350:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14351:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  14352:             </div>
                   14353:           </div>
                   14354:         </div>
                   14355: 
1.45      wiz      14356:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   14357:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14358:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  14359:         are created from it:</p>
                   14360: 
                   14361:         <div class="itemizedlist">
                   14362:           <ul type="disc">
                   14363:             <li>
1.45      wiz      14364:               <p><code xmlns=
                   14365:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      14366:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  14367:             </li>
                   14368: 
                   14369:             <li>
1.45      wiz      14370:               <p><code xmlns=
                   14371:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14372:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  14373:             </li>
                   14374: 
                   14375:             <li>
1.45      wiz      14376:               <p><code xmlns=
                   14377:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14378:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  14379:               the documentation on the NetBSD website will be built
                   14380:               from pkgsrc and kept up to date on the web server
                   14381:               itself. This means you <span class=
                   14382:               "emphasis"><em>must</em></span> make sure that your
                   14383:               changes haven't broken the build!</p>
                   14384:             </li>
1.6       hubertf  14385: 
                   14386:             <li>
1.45      wiz      14387:               <p><code xmlns=
                   14388:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14389:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  14390:               PDF version of the pkgsrc guide.</p>
                   14391:             </li>
                   14392: 
                   14393:             <li>
1.45      wiz      14394:               <p><code xmlns=
                   14395:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14396:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  14397:               PostScript version of the pkgsrc guide.</p>
                   14398:             </li>
1.2       hubertf  14399:           </ul>
                   14400:         </div>
                   14401:       </div>
                   14402: 
                   14403:       <div class="sect1" lang="en" xml:lang="en">
                   14404:         <div class="titlepage">
                   14405:           <div>
                   14406:             <div>
                   14407:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      14408:               "procedure" id=
1.46      gdt      14409:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  14410:             </div>
                   14411:           </div>
                   14412:         </div>
                   14413: 
                   14414:         <p>The procedure to edit the pkgsrc guide is:</p>
                   14415: 
                   14416:         <div class="itemizedlist">
                   14417:           <ul type="disc">
                   14418:             <li>
1.6       hubertf  14419:               <p>Make sure you have the packages needed to
                   14420:               re-generate the pkgsrc guide (and other XML-based
                   14421:               NetBSD documentation) installed. These are
1.11      ben      14422:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     14423:               for creating the ASCII and HTML versions, and
1.6       hubertf  14424:               &#8220;<span class=
1.47      reed     14425:               "quote">netbsd-doc-print</span>&#8221; for the
                   14426:               PostScript and PDF versions. You will need both
1.6       hubertf  14427:               packages installed, to make sure documentation is
                   14428:               consistent across all formats. The packages can be
1.45      wiz      14429:               found in <code xmlns=
                   14430:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14431:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      14432:               <code xmlns=
                   14433:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14434:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  14435:             </li>
                   14436: 
                   14437:             <li>
1.45      wiz      14438:               <p>Edit the XML file(s) in <code xmlns=
                   14439:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14440:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  14441:             </li>
                   14442: 
                   14443:             <li>
1.14      xtraeme  14444:               <p>Run <span><strong class="command">make extract
                   14445:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      14446:               <code xmlns=
                   14447:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14448:               "filename">pkgsrc/doc/guide</code> to check the XML
                   14449:               syntax, and fix it if needed.</p>
1.4       hubertf  14450:             </li>
                   14451: 
                   14452:             <li>
1.14      xtraeme  14453:               <p>Run <span><strong class=
1.45      wiz      14454:               "command">make</strong></span> in <code xmlns=
                   14455:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14456:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   14457:               and ASCII version.</p>
1.2       hubertf  14458:             </li>
                   14459: 
                   14460:             <li>
1.14      xtraeme  14461:               <p>If all is well, run <span><strong class=
                   14462:               "command">make install-doc</strong></span> to put the
1.45      wiz      14463:               generated files into <code xmlns=
                   14464:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14465:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  14466:             </li>
                   14467: 
                   14468:             <li>
1.14      xtraeme  14469:               <p><span><strong class="command">cvs commit
                   14470:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  14471:             </li>
                   14472: 
                   14473:             <li>
1.14      xtraeme  14474:               <p><span><strong class="command">cvs commit -m
                   14475:               re-generate
                   14476:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  14477:             </li>
1.4       hubertf  14478: 
                   14479:             <li>
                   14480:               <p>Until the webserver on www.NetBSD.org is really
                   14481:               updated automatically to pick up changes to the
1.14      xtraeme  14482:               pkgsrc guide automatically, also run
1.18      xtraeme  14483:               <span><strong class="command">make install-htdocs
1.14      xtraeme  14484:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   14485:               similar, adjust <code class=
                   14486:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  14487:             </li>
                   14488: 
                   14489:             <li>
1.14      xtraeme  14490:               <p><span><strong class="command">cvs commit
                   14491:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  14492:             </li>
1.2       hubertf  14493:           </ul>
                   14494:         </div>
                   14495:       </div>
                   14496:     </div>
1.1       grant    14497:   </div>
                   14498: </body>
                   14499: </html>

CVSweb <webmaster@jp.NetBSD.org>