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

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
                   6156:                 provide it if it differs from DISTNAME. Usually it
                   6157:                 is the directory name together with the version
                   6158:                 number. It must match the regular expression
                   6159:                 <code class=
                   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.45      wiz      6309:                 email address of the contact person for this
                   6310:                 package. The person who feels responsible for this
                   6311:                 package, and who is most likely to look at problems
                   6312:                 or questions regarding this package which have been
                   6313:                 reported with <a href=
                   6314:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   6315:                 <span class="citerefentry"><span class=
                   6316:                 "refentrytitle">send-pr</span>(1)</span></a>. The
                   6317:                 right person to contact before making major changes
                   6318:                 to the package. When packaging a new program, set
                   6319:                 <code class="varname">MAINTAINER</code> to
                   6320:                 yourself. If you really can't maintain the package
                   6321:                 for future updates, set it to <code class=
                   6322:                 "email">&lt;<a href=
                   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
                   6346:                 subdirectory of <code xmlns=
                   6347:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6348:                 "filename">${WRKDIR}</code> to which the
                   6349:                 distribution actually unpacks. The default is
                   6350:                 <code xmlns=
                   6351:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6352:                 "filename">${WRKDIR}/${DISTNAME}</code>. The value
                   6353:                 of <code class="varname">WRKSRC</code> should be
                   6354:                 set explicitly if the package does not follow
                   6355:                 standard conventions and include the package's name
                   6356:                 as a subdirectory.</p>
                   6357:               </li>
                   6358:             </ul>
1.1       grant    6359:           </div>
                   6360: 
                   6361:           <p>Please pay attention to the following gotchas:</p>
                   6362: 
                   6363:           <div class="itemizedlist">
                   6364:             <ul type="disc">
                   6365:               <li>
1.14      xtraeme  6366:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     6367:                 if man pages are installed in compressed form by
                   6368:                 the package; see comment in <code xmlns=
1.45      wiz      6369:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6370:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    6371:               </li>
                   6372: 
                   6373:               <li>
1.45      wiz      6374:                 <p>Replace <code xmlns=
                   6375:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6376:                 "filename">/usr/local</code> with
                   6377:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   6378:                 in all files (see patches, below).</p>
1.1       grant    6379:               </li>
                   6380: 
                   6381:               <li>
                   6382:                 <p>If the package installs any info files, see
                   6383:                 <a href="#faq.info-files" title=
1.45      wiz      6384:                 "15.5.7.&nbsp;Packages installing info files">Section&nbsp;15.5.7,
                   6385:                 &#8220;Packages installing info
1.1       grant    6386:                 files&#8221;</a>.</p>
                   6387:               </li>
                   6388:             </ul>
                   6389:           </div>
                   6390:         </div>
                   6391: 
                   6392:         <div class="sect1" lang="en" xml:lang="en">
                   6393:           <div class="titlepage">
                   6394:             <div>
                   6395:               <div>
                   6396:                 <h2 class="title" style="clear: both"><a name=
                   6397:                 "components.distinfo" id=
1.45      wiz      6398:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   6399:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6400:                 "filename">distinfo</code></h2>
1.1       grant    6401:               </div>
                   6402:             </div>
                   6403:           </div>
                   6404: 
                   6405:           <p>Most important, the mandatory message digest, or
                   6406:           checksum, of all the distfiles needed for the package to
                   6407:           compile, confirming they match the original file
                   6408:           distributed by the author. This ensures that the distfile
                   6409:           retrieved from the Internet has not been corrupted during
                   6410:           transfer or altered by a malign force to introduce a
1.14      xtraeme  6411:           security hole. It is generated using the
                   6412:           <span><strong class="command">make
                   6413:           makesum</strong></span> command. The digest algorithm
                   6414:           used was, at one stage, md5, but that was felt lacking
                   6415:           compared to sha1, and so sha1 is now the default
1.1       grant    6416:           algorithm. The distfile size is also generated and stored
                   6417:           in new distinfo files. The <a xmlns=
                   6418:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6419:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      6420:           target="_top"><code xmlns="" class=
                   6421:           "filename">pkgtools/digest</code></a> utility calculates
1.20      ben      6422:           all of the digests in the distinfo file, and it provides
                   6423:           various different algorithms. At the current time, the
                   6424:           algorithms provided are: <span class=
                   6425:           "emphasis"><em>md5</em></span>, <span class=
                   6426:           "emphasis"><em>rmd160</em></span>, <span class=
                   6427:           "emphasis"><em>sha1</em></span>, <span class=
                   6428:           "emphasis"><em>sha256</em></span>, <span class=
                   6429:           "emphasis"><em>sha384</em></span> and <span class=
                   6430:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    6431: 
                   6432:           <p>Some packages have different sets of distfiles on a
                   6433:           per architecture basis, for example <a xmlns=
                   6434:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6435:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      6436:           target="_top"><code xmlns="" class=
                   6437:           "filename">www/navigator</code></a>). These are kept in
                   6438:           the same distinfo file and care should be taken when
1.20      ben      6439:           upgrading such a package to ensure distfile information
                   6440:           is not lost.</p>
1.1       grant    6441: 
                   6442:           <p>The message digest/checksum for all the official
1.45      wiz      6443:           patches found in the <code xmlns=
                   6444:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6445:           "filename">patches/</code> directory (see <a href=
                   6446:           "#components.patches" title=
1.38      dillo    6447:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    6448:           &#8220;patches/*&#8221;</a>) for the package is also
1.45      wiz      6449:           stored in the <code xmlns=
                   6450:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6451:           "filename">distinfo</code> file. This is a message
                   6452:           digest/checksum of all lines in the patch file except the
                   6453:           NetBSD RCS Id. This file is generated by invoking
                   6454:           <span><strong class="command">make
1.14      xtraeme  6455:           makepatchsum</strong></span> (or <span><strong class=
                   6456:           "command">make mps</strong></span> if you're in a
                   6457:           hurry).</p>
1.1       grant    6458:         </div>
                   6459: 
                   6460:         <div class="sect1" lang="en" xml:lang="en">
                   6461:           <div class="titlepage">
                   6462:             <div>
                   6463:               <div>
                   6464:                 <h2 class="title" style="clear: both"><a name=
                   6465:                 "components.patches" id=
1.38      dillo    6466:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    6467:               </div>
                   6468:             </div>
                   6469:           </div>
                   6470: 
                   6471:           <p>This directory contains files that are used by the
                   6472:           <a href=
                   6473:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   6474:           <span class="citerefentry"><span class=
                   6475:           "refentrytitle">patch</span>(1)</span></a> command to
                   6476:           modify the sources as distributed in the distribution
                   6477:           file into a form that will compile and run perfectly on
                   6478:           NetBSD. The files are applied successively in alphabetic
                   6479:           order (as returned by a shell &#8220;<span class=
                   6480:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      6481:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6482:           class="filename">patch-aa</code> is applied before
                   6483:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6484:           class="filename">patch-ab</code>, etc.</p>
                   6485: 
                   6486:           <p>The <code xmlns=
                   6487:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6488:           "filename">patch-*</code> files should be in
                   6489:           <span><strong class="command">diff -bu</strong></span>
                   6490:           format, and apply without a fuzz to avoid problems. (To
                   6491:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  6492:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    6493:           not put changes for more than one file into a single
1.47      reed     6494:           patch file, as this will make future modifications more
1.1       grant    6495:           difficult.</p>
                   6496: 
                   6497:           <p>Similar, a file should be patched at most once, not
                   6498:           several times by several different patches. If a file
                   6499:           needs several patches, they should be combined into one
                   6500:           file.</p>
                   6501: 
                   6502:           <p>One important thing to mention is to pay attention
                   6503:           that no RCS IDs get stored in the patch files, as these
                   6504:           will cause problems when later checked into the NetBSD
1.14      xtraeme  6505:           CVS tree. Use the <span><strong class=
                   6506:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    6507:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6508:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      6509:           target="_top"><code xmlns="" class=
                   6510:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      6511:           these problems.</p>
1.1       grant    6512: 
                   6513:           <p>For even more automation, we recommend using
1.14      xtraeme  6514:           <span><strong class="command">mkpatches</strong></span>
                   6515:           from the same package to make a whole set of patches. You
                   6516:           just have to backup files before you edit them to
1.45      wiz      6517:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6518:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  6519:           <span><strong class="command">cp -p filename
                   6520:           filename.orig</strong></span> or, easier, by using
                   6521:           <span><strong class="command">pkgvi</strong></span> again
                   6522:           from the same package. If you upgrade a package this way,
                   6523:           you can easily compare the new set of patches with the
                   6524:           previously existing one with <span><strong class=
                   6525:           "command">patchdiff</strong></span>.</p>
1.1       grant    6526: 
                   6527:           <p>When you have finished a package, remember to generate
                   6528:           the checksums for the patch files by using the
1.14      xtraeme  6529:           <span><strong class="command">make
                   6530:           makepatchsum</strong></span> command, see <a href=
                   6531:           "#components.distinfo" title=
1.38      dillo    6532:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      6533:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6534:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    6535: 
1.46      gdt      6536:           <p>When adding a patch that corrects a problem in the
                   6537:           distfile (rather than e.g. enforcing pkgsrc's view of
                   6538:           where man pages should go), send the patch as a bug
                   6539:           report to the maintainer. This benefits non-pkgsrc users
                   6540:           of the package, and usually enables removing the patch in
                   6541:           future version.</p>
                   6542: 
1.1       grant    6543:           <p>Patch files that are distributed by the author or
1.14      xtraeme  6544:           other maintainers can be listed in <code class=
                   6545:           "varname">$PATCHFILES</code>.</p>
1.1       grant    6546: 
                   6547:           <p>If it is desired to store any patches that should not
                   6548:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      6549:           pkgsrc tree in the <code xmlns=
                   6550:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6551:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    6552:           tree there is expected to have the same
                   6553:           &#8220;<span class="quote">category/package</span>&#8221;
                   6554:           structure as pkgsrc, and patches are expected to be
1.45      wiz      6555:           stored inside these dirs (also known as <code xmlns=
                   6556:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     6557:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   6558:           if you want to keep a private patch for <code xmlns=
1.45      wiz      6559:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6560:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      6561:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6562:           class=
1.14      xtraeme  6563:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   6564:           files in the named directory are expected to be patch
1.1       grant    6565:           files, and <span class="emphasis"><em>they are applied
                   6566:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   6567:         </div>
                   6568: 
                   6569:         <div class="sect1" lang="en" xml:lang="en">
                   6570:           <div class="titlepage">
                   6571:             <div>
                   6572:               <div>
                   6573:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6574:                 "other-mandatory-files" id=
1.38      dillo    6575:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   6576:                 mandatory files</h2>
                   6577:               </div>
                   6578:             </div>
                   6579:           </div>
                   6580: 
                   6581:           <div class="variablelist">
                   6582:             <dl>
1.45      wiz      6583:               <dt><span class="term"><code xmlns=
                   6584:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6585:               "filename">DESCR</code></span></dt>
                   6586: 
                   6587:               <dd>
                   6588:                 <p>A multi-line description of the piece of
                   6589:                 software. This should include any credits where
                   6590:                 they are due. Please bear in mind that others do
                   6591:                 not share your sense of humour (or spelling
                   6592:                 idiosyncrasies), and that others will read
                   6593:                 everything that you write here.</p>
                   6594:               </dd>
                   6595: 
1.45      wiz      6596:               <dt><span class="term"><code xmlns=
                   6597:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6598:               "filename">PLIST</code></span></dt>
                   6599: 
                   6600:               <dd>
                   6601:                 <p>This file governs the files that are installed
                   6602:                 on your system: all the binaries, manual pages,
                   6603:                 etc. There are other directives which may be
                   6604:                 entered in this file, to control the creation and
                   6605:                 deletion of directories, and the location of
                   6606:                 inserted files. See <a href="#plist" title=
1.38      dillo    6607:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   6608:                 <i>PLIST issues</i></a> for more information.</p>
                   6609:               </dd>
                   6610:             </dl>
                   6611:           </div>
                   6612:         </div>
                   6613: 
                   6614:         <div class="sect1" lang="en" xml:lang="en">
                   6615:           <div class="titlepage">
                   6616:             <div>
                   6617:               <div>
                   6618:                 <h2 class="title" style="clear: both"><a name=
                   6619:                 "components.optional" id=
1.38      dillo    6620:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   6621:                 files</h2>
                   6622:               </div>
                   6623:             </div>
                   6624:           </div>
                   6625: 
                   6626:           <div class="variablelist">
                   6627:             <dl>
1.45      wiz      6628:               <dt><span class="term"><code xmlns=
                   6629:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6630:               "filename">INSTALL</code></span></dt>
                   6631: 
                   6632:               <dd>
                   6633:                 <p>This shell script is invoked twice by <a href=
                   6634:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6635:                 <span class="citerefentry"><span class=
                   6636:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   6637:                 time after package extraction and before files are
                   6638:                 moved in place, the second time after the files to
                   6639:                 install are moved in place. This can be used to do
                   6640:                 any custom procedures not possible with @exec
1.45      wiz      6641:                 commands in <code xmlns=
                   6642:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6643:                 "filename">PLIST</code>. See <a href=
1.27      rillig   6644:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   6645:                 <span class="citerefentry"><span class=
                   6646:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   6647:                 <a href=
                   6648:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6649:                 <span class="citerefentry"><span class=
                   6650:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6651:                 more information.</p>
                   6652:               </dd>
                   6653: 
1.45      wiz      6654:               <dt><span class="term"><code xmlns=
                   6655:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6656:               "filename">DEINSTALL</code></span></dt>
                   6657: 
                   6658:               <dd>
                   6659:                 <p>This script is executed before and after any
                   6660:                 files are removed. It is this script's
                   6661:                 responsibility to clean up any additional messy
                   6662:                 details around the package's installation, since
                   6663:                 all pkg_delete knows is how to delete the files
                   6664:                 created in the original distribution. See <a href=
                   6665:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   6666:                 <span class="citerefentry"><span class=
                   6667:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   6668:                 <a href=
                   6669:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6670:                 <span class="citerefentry"><span class=
                   6671:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   6672:                 more information.</p>
                   6673:               </dd>
                   6674: 
1.45      wiz      6675:               <dt><span class="term"><code xmlns=
                   6676:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6677:               "filename">MESSAGE</code></span></dt>
                   6678: 
                   6679:               <dd>
                   6680:                 <p>Display this file after installation of the
                   6681:                 package. Useful for things like legal notices on
                   6682:                 almost-free software and hints for updating config
                   6683:                 files after installing modules for apache, PHP etc.
                   6684:                 Please note that you can modify variables in it
                   6685:                 easily by using <code class=
                   6686:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      6687:                 <code xmlns=
                   6688:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   6689:                 "filename">Makefile</code>:</p>
1.27      rillig   6690:                 <pre class="programlisting">
                   6691: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   6692: </pre>
                   6693: 
                   6694:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      6695:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   6696:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6697:                 "filename">MESSAGE</code>.</p>
                   6698:               </dd>
                   6699:             </dl>
                   6700:           </div>
                   6701:         </div>
                   6702: 
                   6703:         <div class="sect1" lang="en" xml:lang="en">
                   6704:           <div class="titlepage">
                   6705:             <div>
                   6706:               <div>
                   6707:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6708:                 "work-dir" id="work-dir"></a>8.6.&nbsp;<code xmlns=
                   6709:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6710:                 "filename">work*</code></h2>
                   6711:               </div>
                   6712:             </div>
                   6713:           </div>
                   6714: 
                   6715:           <p>When you type <span><strong class=
1.47      reed     6716:           "command">make</strong></span>, the distribution files
                   6717:           are unpacked into the directory denoted by <code class=
1.45      wiz      6718:           "varname">WRKDIR</code>. It can be removed by running
                   6719:           <span><strong class="command">make clean</strong></span>.
                   6720:           Besides the sources, this directory is also used to keep
                   6721:           various timestamp files. The directory gets <span class=
                   6722:           "emphasis"><em>removed completely</em></span> on clean.
                   6723:           The default is <code xmlns=
                   6724:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6725:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   6726:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6727:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   6728:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   6729: 
                   6730:           <p>If a package doesn't create a subdirectory for itself
                   6731:           (like GNU software does, for instance), but extracts
                   6732:           itself in the current directory, you should set
                   6733:           <code class="varname">WRKSRC</code> accordingly, e.g.
                   6734:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   6735:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.45      wiz      6736:           target="_top"><code xmlns="" class=
                   6737:           "filename">editors/sam</code></a> again, but the quick
1.27      rillig   6738:           answer is:</p>
                   6739:           <pre class="programlisting">
                   6740: WRKSRC=             ${WRKDIR}
                   6741: </pre>
                   6742: 
1.45      wiz      6743:           <p>If a package doesn't create a subdir with the name of
                   6744:           <code class="varname">DISTNAME</code> but some different
                   6745:           name, set <code class="varname">WRKSRC</code> to point to
                   6746:           the proper name in <code xmlns=
                   6747:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6748:           "filename">${WRKDIR}</code>. See <a xmlns=
                   6749:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.27      rillig   6750:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.45      wiz      6751:           target="_top"><code xmlns="" class=
                   6752:           "filename">lang/tcl</code></a> and <a xmlns=
1.27      rillig   6753:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6754:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
1.45      wiz      6755:           target="_top"><code xmlns="" class=
                   6756:           "filename">x11/tk</code></a> for examples, and here is
1.27      rillig   6757:           another one:</p>
                   6758:           <pre class="programlisting">
                   6759: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   6760: </pre>
                   6761: 
                   6762:           <p>The name of the working directory created by pkgsrc is
1.45      wiz      6763:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6764:           class="filename">work</code> by default. If the same
                   6765:           pkgsrc tree should be used on several different
1.27      rillig   6766:           platforms, the variable <code class=
                   6767:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
                   6768:           attach the platform to the directory name, e.g.
1.45      wiz      6769:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6770:           class="filename">work.i386</code> or <code xmlns=
                   6771:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6772:           "filename">work.sparc</code>.</p>
                   6773:         </div>
                   6774: 
                   6775:         <div class="sect1" lang="en" xml:lang="en">
                   6776:           <div class="titlepage">
                   6777:             <div>
                   6778:               <div>
                   6779:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      6780:                 "files-dir" id=
1.45      wiz      6781:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   6782:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6783:                 "filename">files/*</code></h2>
                   6784:               </div>
                   6785:             </div>
                   6786:           </div>
                   6787: 
                   6788:           <p>If you have any files that you wish to be placed in
                   6789:           the package prior to configuration or building, you could
                   6790:           place these files here and use a &#8220;<span class=
                   6791:           "quote">${CP}</span>&#8221; command in the
                   6792:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   6793:           target to achieve this. Alternatively, you could simply
1.45      wiz      6794:           diff the file against <code xmlns=
                   6795:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6796:           "filename">/dev/null</code> and use the patch mechanism
                   6797:           to manage the creation of this file.</p>
                   6798:         </div>
                   6799:       </div>
                   6800: 
                   6801:       <div class="chapter" lang="en" xml:lang="en">
                   6802:         <div class="titlepage">
                   6803:           <div>
                   6804:             <div>
                   6805:               <h2 class="title"><a name="makefile" id=
1.38      dillo    6806:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      6807:               <code xmlns=
                   6808:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6809:               "filename">Makefile</code>s</h2>
1.27      rillig   6810:             </div>
                   6811:           </div>
                   6812:         </div>
                   6813: 
                   6814:         <div class="toc">
                   6815:           <p><b>Table of Contents</b></p>
                   6816: 
                   6817:           <dl>
                   6818:             <dt><span class="sect1"><a href=
1.45      wiz      6819:             "#makefile.variables">9.1. <code xmlns=
                   6820:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6821:             "filename">Makefile</code> variables</a></span></dt>
                   6822: 
                   6823:             <dd>
                   6824:               <dl>
                   6825:                 <dt><span class="sect2"><a href=
1.38      dillo    6826:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6827:                 conventions</a></span></dt>
                   6828:               </dl>
                   6829:             </dd>
                   6830: 
1.38      dillo    6831:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   6832:             Code snippets</a></span></dt>
                   6833: 
                   6834:             <dd>
                   6835:               <dl>
1.30      wiz      6836:                 <dt><span class="sect2"><a href=
1.38      dillo    6837:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      6838:                 list</a></span></dt>
1.27      rillig   6839: 
1.30      wiz      6840:                 <dt><span class="sect2"><a href=
1.38      dillo    6841:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   6842:                 Converting an internal list into an external
                   6843:                 list</a></span></dt>
                   6844: 
1.30      wiz      6845:                 <dt><span class="sect2"><a href=
1.38      dillo    6846:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6847:                 variables to a shell command</a></span></dt>
1.27      rillig   6848: 
1.30      wiz      6849:                 <dt><span class="sect2"><a href=
1.38      dillo    6850:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      6851:                 guideline</a></span></dt>
1.27      rillig   6852: 
1.30      wiz      6853:                 <dt><span class="sect2"><a href=
1.38      dillo    6854:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      6855:                 bug in BSD Make</a></span></dt>
1.27      rillig   6856:               </dl>
                   6857:             </dd>
                   6858:           </dl>
                   6859:         </div>
                   6860: 
1.45      wiz      6861:         <p>Pkgsrc consists of many <code xmlns=
                   6862:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6863:         "filename">Makefile</code> fragments, each of which forms a
                   6864:         well-defined part of the pkgsrc system. Using the <a href=
                   6865:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6866:         <span class="citerefentry"><span class=
                   6867:         "refentrytitle">make</span>(1)</span></a> system as a
                   6868:         programming language for a big system like pkgsrc requires
                   6869:         some discipline to keep the code correct and
                   6870:         understandable.</p>
                   6871: 
1.45      wiz      6872:         <p>The basic ingredients for <code xmlns=
                   6873:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6874:         "filename">Makefile</code> programming are variables (which
                   6875:         are actually macros) and shell commands. Among these shell
                   6876:         commands may even be more complex ones like <a href=
                   6877:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   6878:         <span class="citerefentry"><span class=
                   6879:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   6880:         sure that every shell command runs as intended it is
                   6881:         necessary to quote all variables correctly when they are
                   6882:         used.</p>
                   6883: 
                   6884:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      6885:         often in <code xmlns=
                   6886:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   6887:         "filename">Makefile</code>s, including the pitfalls that
                   6888:         come along with them.</p>
1.27      rillig   6889: 
                   6890:         <div class="sect1" lang="en" xml:lang="en">
                   6891:           <div class="titlepage">
                   6892:             <div>
                   6893:               <div>
                   6894:                 <h2 class="title" style="clear: both"><a name=
                   6895:                 "makefile.variables" id=
1.45      wiz      6896:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   6897:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6898:                 "filename">Makefile</code> variables</h2>
                   6899:               </div>
                   6900:             </div>
                   6901:           </div>
                   6902: 
1.45      wiz      6903:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6904:           class="filename">Makefile</code> variables contain
                   6905:           strings that can be processed using the five operators
                   6906:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   6907:           described in the <a href=
1.27      rillig   6908:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6909:           <span class="citerefentry"><span class=
                   6910:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   6911: 
1.45      wiz      6912:           <p>When a variable's value is parsed from a <code xmlns=
                   6913:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6914:           "filename">Makefile</code>, the hash character ``#'' and
                   6915:           the backslash character ``\'' are handled specially. If a
                   6916:           backslash is followed by a newline, any whitespace
                   6917:           immediately in front of the backslash, the backslash, the
                   6918:           newline, and any whitespace immediately behind the
                   6919:           newline are replaced with a single space. A backspace
                   6920:           character and an immediately following hash character are
1.47      reed     6921:           replaced with a single hash character. Otherwise, the
1.27      rillig   6922:           backslash is passed as is. In a variable assignment, any
                   6923:           hash character that is not preceded by a backslash starts
                   6924:           a comment that continues upto the end of the logical
                   6925:           line.</p>
                   6926: 
                   6927:           <p><span class="emphasis"><em>Note:</em></span> Because
                   6928:           of this parsing algorithm the only way to create a
                   6929:           variable consisting of a single backslash is using the
                   6930:           ``!='' operator, for example: <code class=
                   6931:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   6932: 
                   6933:           <p>So far for defining variables. The other thing you can
                   6934:           do with variables is evaluating them. A variable is
                   6935:           evaluated when it is part of the right side of the ``:=''
                   6936:           or the ``!='' operator, or directly before executing a
                   6937:           shell command which the variable is part of. In all other
1.47      reed     6938:           cases, <a href=
1.27      rillig   6939:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6940:           <span class="citerefentry"><span class=
                   6941:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   6942:           evaluation, that is, variables are not evaluated until
                   6943:           there's no other way. The ``modifiers'' mentioned in the
                   6944:           man page also evaluate the variable.</p>
                   6945: 
                   6946:           <p>Some of the modifiers split the string into words and
                   6947:           then operate on the words, others operate on the string
1.47      reed     6948:           as a whole. When a string is split into words, it is
                   6949:           split as you would expect it from <a href=
1.27      rillig   6950:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   6951:           <span class="citerefentry"><span class=
                   6952:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   6953: 
                   6954:           <p>No rule without exception&#8212;the
                   6955:           <span><strong class="command">.for</strong></span> loop
                   6956:           does not follow the shell quoting rules but splits at
                   6957:           sequences of whitespace.</p>
                   6958: 
                   6959:           <p>There are several types of variables that should be
                   6960:           handled differently. Strings and two types of lists.</p>
                   6961: 
                   6962:           <div class="itemizedlist">
                   6963:             <ul type="disc">
                   6964:               <li>
                   6965:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     6966:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   6967:                 should restrict yourself to only using printable
                   6968:                 characters. Examples are <code class=
                   6969:                 "varname">PREFIX</code> and <code class=
                   6970:                 "varname">COMMENT</code>.</p>
                   6971:               </li>
                   6972: 
                   6973:               <li>
                   6974:                 <p><span class="emphasis"><em>Internal
                   6975:                 lists</em></span> are lists that are never exported
                   6976:                 to any shell command. Their elements are separated
1.47      reed     6977:                 by whitespace. Therefore, the elements themselves
1.27      rillig   6978:                 cannot have embedded whitespace. Any other
                   6979:                 characters are allowed. Internal lists can be used
                   6980:                 in <span><strong class=
                   6981:                 "command">.for</strong></span> loops. Examples are
                   6982:                 <code class="varname">DEPENDS</code> and
                   6983:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   6984:               </li>
                   6985: 
                   6986:               <li>
                   6987:                 <p><span class="emphasis"><em>External
                   6988:                 lists</em></span> are lists that may be exported to
                   6989:                 a shell command. Their elements can contain any
                   6990:                 characters, including whitespace. That's why they
                   6991:                 cannot be used in <span><strong class=
                   6992:                 "command">.for</strong></span> loops. Examples are
                   6993:                 <code class="varname">DISTFILES</code> and
                   6994:                 <code class="varname">MASTER_SITES</code>.</p>
                   6995:               </li>
                   6996:             </ul>
                   6997:           </div>
                   6998: 
                   6999:           <div class="sect2" lang="en" xml:lang="en">
                   7000:             <div class="titlepage">
                   7001:               <div>
                   7002:                 <div>
                   7003:                   <h3 class="title"><a name=
                   7004:                   "makefile.variables.names" id=
1.38      dillo    7005:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7006:                   conventions</h3>
                   7007:                 </div>
                   7008:               </div>
                   7009:             </div>
                   7010: 
                   7011:             <div class="itemizedlist">
                   7012:               <ul type="disc">
                   7013:                 <li>
                   7014:                   <p>All variable names starting with an underscore
                   7015:                   are reserved for use by the pkgsrc
                   7016:                   infrastructure. They shall not be used by package
1.45      wiz      7017:                   <code xmlns=
                   7018:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7019:                   "filename">Makefile</code>s.</p>
1.27      rillig   7020:                 </li>
                   7021: 
                   7022:                 <li>
                   7023:                   <p>In <span><strong class=
                   7024:                   "command">.for</strong></span> loops you should
                   7025:                   use lowercase variable names for the iteration
                   7026:                   variables.</p>
                   7027:                 </li>
                   7028: 
                   7029:                 <li>
                   7030:                   <p>All list variables should have a ``plural''
                   7031:                   name, e.g. <code class=
                   7032:                   "varname">PKG_OPTIONS</code> or <code class=
                   7033:                   "varname">DISTFILES</code>.</p>
                   7034:                 </li>
                   7035:               </ul>
                   7036:             </div>
                   7037:           </div>
                   7038:         </div>
                   7039: 
                   7040:         <div class="sect1" lang="en" xml:lang="en">
                   7041:           <div class="titlepage">
                   7042:             <div>
                   7043:               <div>
                   7044:                 <h2 class="title" style="clear: both"><a name=
                   7045:                 "makefile.code" id=
1.38      dillo    7046:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7047:               </div>
                   7048:             </div>
                   7049:           </div>
                   7050: 
                   7051:           <p>This section presents you with some code snippets you
                   7052:           should use in your own code. If you don't find anything
                   7053:           appropriate here, you should test your code and add it
                   7054:           here.</p>
                   7055: 
                   7056:           <div class="sect2" lang="en" xml:lang="en">
                   7057:             <div class="titlepage">
                   7058:               <div>
                   7059:                 <div>
1.30      wiz      7060:                   <h3 class="title"><a name="adding-to-list" id=
1.38      dillo    7061:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7062:                   a list</h3>
1.27      rillig   7063:                 </div>
                   7064:               </div>
                   7065:             </div>
                   7066:             <pre class="programlisting">
                   7067: STRING=                 foo * bar `date`
                   7068: INT_LIST=               # empty
                   7069: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7070: EXT_LIST=               # empty
                   7071: ANOTHER_EXT_LIST=       a=b c=d
                   7072: 
                   7073: INT_LIST+=              ${STRING}               # 1
                   7074: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7075: EXT_LIST+=              ${STRING:Q}             # 3
                   7076: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
                   7077:       
                   7078: </pre>
                   7079: 
                   7080:             <p>When you add a string to an external list (example
                   7081:             3), it must be quoted. In all other cases, you must not
                   7082:             add a quoting level. You must not merge internal and
                   7083:             external lists, unless you are sure that all entries
                   7084:             are correctly interpreted in both lists.</p>
                   7085:           </div>
                   7086: 
                   7087:           <div class="sect2" lang="en" xml:lang="en">
                   7088:             <div class="titlepage">
                   7089:               <div>
                   7090:                 <div>
1.30      wiz      7091:                   <h3 class="title"><a name=
                   7092:                   "converting-internal-to-external" id=
1.38      dillo    7093:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7094:                   an internal list into an external list</h3>
1.27      rillig   7095:                 </div>
                   7096:               </div>
                   7097:             </div>
                   7098:             <pre class="programlisting">
                   7099: EXT_LIST=       # empty
                   7100: .for i in ${INT_LIST}
                   7101: EXT_LIST+=      ${i:Q}""
                   7102: .endfor
                   7103:       
                   7104: </pre>
                   7105: 
                   7106:             <p>This code converts the internal list <code class=
                   7107:             "varname">INT_LIST</code> into the external list
                   7108:             <code class="varname">EXT_LIST</code>. As the elements
                   7109:             of an internal list are unquoted they must be quoted
                   7110:             here. The reason for appending <code class=
                   7111:             "varname">""</code> is explained below.</p>
                   7112:           </div>
1.1       grant    7113: 
1.27      rillig   7114:           <div class="sect2" lang="en" xml:lang="en">
                   7115:             <div class="titlepage">
1.1       grant    7116:               <div>
1.27      rillig   7117:                 <div>
1.30      wiz      7118:                   <h3 class="title"><a name=
                   7119:                   "passing-variable-to-shell" id=
1.38      dillo    7120:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7121:                   variables to a shell command</h3>
1.27      rillig   7122:                 </div>
1.1       grant    7123:               </div>
                   7124:             </div>
1.27      rillig   7125:             <pre class="programlisting">
                   7126: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7127: EXT_LIST=       string=${STRING:Q} x=second\ item
                   7128: 
                   7129: all:
                   7130:         echo ${STRING}                  # 1
                   7131:         echo "${STRING}"                # 2
                   7132:         echo "${STRING:Q}"              # 3
                   7133:         echo ${STRING:Q}                # 4
                   7134:         echo x${STRING:Q} | sed 1s,.,,  # 5
                   7135:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
                   7136:       
                   7137: </pre>
                   7138: 
                   7139:             <p>Example 1 leads to a syntax error in the shell, as
                   7140:             the characters are just copied.</p>
                   7141: 
                   7142:             <p>Example 2 leads to a syntax error too, and if you
                   7143:             leave out the last " character from <code class=
                   7144:             "varname">${STRING}</code>, <a href=
                   7145:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7146:             <span class="citerefentry"><span class=
                   7147:             "refentrytitle">date</span>(1)</span></a> will be
                   7148:             executed. The <code class="varname">$HOME</code> shell
                   7149:             variable would be evaluated, too.</p>
                   7150: 
                   7151:             <p>Example 3 outputs each space character preceded by a
                   7152:             backslash (or not), depending on the implementation of
                   7153:             the <a href=
                   7154:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7155:             <span class="citerefentry"><span class=
                   7156:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7157: 
1.27      rillig   7158:             <p>Example 4 handles correctly every string that does
                   7159:             not start with a dash. In that case, the result depends
                   7160:             on the implementation of the <a href=
                   7161:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7162:             <span class="citerefentry"><span class=
                   7163:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7164:             long as you can guarantee that your input does not
1.47      reed     7165:             start with a dash, this form is appropriate.</p>
1.1       grant    7166: 
1.27      rillig   7167:             <p>Example 5 handles even the case of a leading dash
                   7168:             correctly.</p>
1.1       grant    7169: 
1.27      rillig   7170:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7171:             need to be quoted because the quoting has already been
1.27      rillig   7172:             done when adding elements to the list.</p>
1.1       grant    7173: 
1.27      rillig   7174:             <p>As internal lists shall not be passed to the shell,
                   7175:             there is no example for it.</p>
1.1       grant    7176:           </div>
                   7177: 
1.27      rillig   7178:           <div class="sect2" lang="en" xml:lang="en">
                   7179:             <div class="titlepage">
1.1       grant    7180:               <div>
1.27      rillig   7181:                 <div>
1.30      wiz      7182:                   <h3 class="title"><a name="quoting-guideline" id=
1.38      dillo    7183:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7184:                   guideline</h3>
                   7185:                 </div>
1.1       grant    7186:               </div>
                   7187:             </div>
                   7188: 
1.27      rillig   7189:             <p>There are many possible sources of wrongly quoted
                   7190:             variables. This section lists some of the commonly
                   7191:             known ones.</p>
1.1       grant    7192: 
1.27      rillig   7193:             <div class="itemizedlist">
                   7194:               <ul type="disc">
                   7195:                 <li>
                   7196:                   <p>Whenever you use the value of a list, think
                   7197:                   about what happens to leading or trailing
                   7198:                   whitespace. If the list is a well-formed shell
1.47      reed     7199:                   expression, you can apply the <code class=
1.27      rillig   7200:                   "varname">:M*</code> modifier to strip leading
                   7201:                   and trailing whitespace from each word. The
                   7202:                   <code class="varname">:M</code> operator first
                   7203:                   splits its argument according to the rules of the
                   7204:                   shell, and then creates a new list consisting of
                   7205:                   all words that match the shell glob expression
                   7206:                   <code class="varname">*</code>, that is: all. One
                   7207:                   class of situations where this is needed is when
                   7208:                   adding a variable like <code class=
                   7209:                   "varname">CPPFLAGS</code> to <code class=
                   7210:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7211:                   script invokes other configure scripts, it strips
1.27      rillig   7212:                   the leading and trailing whitespace from the
                   7213:                   variable and then passes it to the other
                   7214:                   configure scripts. But these configure scripts
                   7215:                   expect the (child) <code class=
                   7216:                   "varname">CPPFLAGS</code> variable to be the same
                   7217:                   as the parent <code class=
                   7218:                   "varname">CPPFLAGS</code>. That's why we better
                   7219:                   pass the <code class="varname">CPPFLAGS</code>
                   7220:                   value properly trimmed. And here is how we do
                   7221:                   it:</p>
                   7222:                   <pre class="programlisting">
                   7223: CPPFLAGS=               # empty
                   7224: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7225: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    7226: 
1.27      rillig   7227: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    7228: 
1.27      rillig   7229: all:
                   7230:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7231:         echo x${CONFIGURE_ARGS}x        # properly trimmed
                   7232:         
                   7233: </pre>
                   7234:                 </li>
1.1       grant    7235: 
1.27      rillig   7236:                 <li>
                   7237:                   <p>The example above contains one bug: The
                   7238:                   <code class="varname">${PREFIX}</code> is a
                   7239:                   properly quoted shell expression, but there is
                   7240:                   the C compiler after it, which also expects a
                   7241:                   properly quoted string (this time in C syntax).
                   7242:                   The version above is therefore only correct if
                   7243:                   <code class="varname">${PREFIX}</code> does not
                   7244:                   have embedded backslashes or double quotes. If
                   7245:                   you want to allow these, you have to add another
                   7246:                   layer of quoting to each variable that is used as
                   7247:                   a C string literal. You cannot use the
                   7248:                   <code class="varname">:Q</code> operator for it,
                   7249:                   as this operator only works for the shell.</p>
                   7250:                 </li>
1.1       grant    7251: 
1.27      rillig   7252:                 <li>
1.47      reed     7253:                   <p>Whenever a variable can be empty, the
1.27      rillig   7254:                   <code class="varname">:Q</code> operator can have
                   7255:                   surprising results. Here are two completely
                   7256:                   different cases which can be solved with the same
                   7257:                   trick.</p>
                   7258:                   <pre class="programlisting">
                   7259: EMPTY=                  # empty
                   7260: empty_test:
                   7261:         for i in a ${EMPTY:Q} c; do \
                   7262:                 echo "$$i"; \
                   7263:         done
                   7264: 
                   7265: for_test:
                   7266: .for i in a:\ a:\test.txt
                   7267:         echo ${i:Q}
                   7268:         echo "foo"
                   7269: .endfor
                   7270:         
1.1       grant    7271: </pre>
                   7272: 
1.27      rillig   7273:                   <p>The first example will only print two of the
                   7274:                   three lines we might have expected. This is
                   7275:                   because <code class="varname">${EMPTY:Q}</code>
                   7276:                   expands to the empty string, which the shell
                   7277:                   cannot see. The workaround is to write
                   7278:                   <code class="varname">${EMPTY:Q}""</code>. This
                   7279:                   pattern can be often found as <code class=
                   7280:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   7281:                   <code class="varname">${TEST} -f
                   7282:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   7283: 
                   7284:                   <p>The second example will only print three lines
                   7285:                   instead of four. The first line looks like
                   7286:                   <code class="varname">a:\ echo foo</code>. This
                   7287:                   is because the backslash of the value
                   7288:                   <code class="varname">a:\</code> is interpreted
                   7289:                   as a line-continuation by <a href=
                   7290:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7291:                   <span class="citerefentry"><span class=
                   7292:                   "refentrytitle">make</span>(1)</span></a>, which
                   7293:                   makes the second line the arguments of the
                   7294:                   <a href=
                   7295:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7296:                   <span class="citerefentry"><span class=
                   7297:                   "refentrytitle">echo</span>(1)</span></a> command
                   7298:                   from the first line. To avoid this, write
                   7299:                   <code class="varname">${i:Q}""</code>.</p>
                   7300:                 </li>
                   7301:               </ul>
                   7302:             </div>
1.1       grant    7303:           </div>
                   7304: 
1.27      rillig   7305:           <div class="sect2" lang="en" xml:lang="en">
                   7306:             <div class="titlepage">
1.1       grant    7307:               <div>
1.27      rillig   7308:                 <div>
1.30      wiz      7309:                   <h3 class="title"><a name=
                   7310:                   "bsd-make-bug-workaround" id=
1.38      dillo    7311:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      7312:                   for a bug in BSD Make</h3>
1.27      rillig   7313:                 </div>
1.1       grant    7314:               </div>
                   7315:             </div>
                   7316: 
1.27      rillig   7317:             <p>The pkgsrc bmake program does not handle the
                   7318:             following assignment correctly. In case <code class=
                   7319:             "varname">_othervar_</code> contains a ``-'' character,
                   7320:             one of the closing braces is included in <code class=
                   7321:             "varname">${VAR}</code> after this code executes.</p>
                   7322:             <pre class="programlisting">
                   7323:         VAR:= ${VAR:N${_othervar_:C/-//}}
                   7324:       
1.1       grant    7325: </pre>
                   7326: 
1.27      rillig   7327:             <p>For a more complex code snippet and a workaround,
                   7328:             see the package <a xmlns=
                   7329:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   7330:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      7331:             target="_top"><code xmlns="" class=
                   7332:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   7333:             <code class="varname">bug1</code>.</p>
1.1       grant    7334:           </div>
                   7335:         </div>
                   7336:       </div>
                   7337: 
                   7338:       <div class="chapter" lang="en" xml:lang="en">
                   7339:         <div class="titlepage">
                   7340:           <div>
                   7341:             <div>
                   7342:               <h2 class="title"><a name="plist" id=
1.38      dillo    7343:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    7344:             </div>
                   7345:           </div>
                   7346:         </div>
                   7347: 
                   7348:         <div class="toc">
                   7349:           <p><b>Table of Contents</b></p>
                   7350: 
                   7351:           <dl>
1.38      dillo    7352:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    7353:             ID</a></span></dt>
                   7354: 
1.30      wiz      7355:             <dt><span class="sect1"><a href=
1.38      dillo    7356:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      7357:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7358:             class="filename">PLIST</code>
1.14      xtraeme  7359:             generation</a></span></dt>
1.1       grant    7360: 
1.38      dillo    7361:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  7362:             Tweaking output of <span><strong class="command">make
                   7363:             print-PLIST</strong></span></a></span></dt>
1.1       grant    7364: 
1.38      dillo    7365:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    7366:             Variable substitution in PLIST</a></span></dt>
                   7367: 
1.30      wiz      7368:             <dt><span class="sect1"><a href=
1.48      dillo    7369:             "#manpage-compression">10.5. Man page
                   7370:             compression</a></span></dt>
1.1       grant    7371: 
1.38      dillo    7372:             <dt><span class="sect1"><a href=
                   7373:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   7374:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    7375: 
1.30      wiz      7376:             <dt><span class="sect1"><a href=
1.47      reed     7377:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      7378:             differing PLISTs</a></span></dt>
1.1       grant    7379: 
1.38      dillo    7380:             <dt><span class="sect1"><a href=
                   7381:             "#faq.common-dirs">10.8. Sharing directories between
                   7382:             packages</a></span></dt>
1.1       grant    7383:           </dl>
                   7384:         </div>
                   7385: 
1.45      wiz      7386:         <p>The <code xmlns=
                   7387:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7388:         "filename">PLIST</code> file contains a package's
                   7389:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   7390:         a list of files that belong to the package (relative to the
                   7391:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7392:         class="filename">${PREFIX}</code> directory it's been
                   7393:         installed in) plus some additional statements - see the
                   7394:         <a href=
1.1       grant    7395:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7396:         <span class="citerefentry"><span class=
1.47      reed     7397:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   7398:         for a full list. This chapter addresses some issues that
                   7399:         need attention when dealing with the <code xmlns=
1.45      wiz      7400:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7401:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    7402: 
                   7403:         <div class="sect1" lang="en" xml:lang="en">
                   7404:           <div class="titlepage">
                   7405:             <div>
                   7406:               <div>
                   7407:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7408:                 "rcs-id" id="rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    7409:               </div>
                   7410:             </div>
                   7411:           </div>
                   7412: 
                   7413:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      7414:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7415:           class="filename">PLIST</code> file you write:</p>
1.1       grant    7416:           <pre class="programlisting">
1.17      sketch   7417: @comment $NetBSD$
1.1       grant    7418: </pre>
                   7419:         </div>
                   7420: 
                   7421:         <div class="sect1" lang="en" xml:lang="en">
                   7422:           <div class="titlepage">
                   7423:             <div>
                   7424:               <div>
                   7425:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7426:                 "automatic-plist-generation" id=
1.38      dillo    7427:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      7428:                 <code xmlns=
                   7429:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7430:                 "filename">PLIST</code> generation</h2>
1.1       grant    7431:               </div>
                   7432:             </div>
                   7433:           </div>
                   7434: 
1.14      xtraeme  7435:           <p>You can use the <span><strong class="command">make
                   7436:           print-PLIST</strong></span> command to output a PLIST
                   7437:           that matches any new files since the package was
                   7438:           extracted. See <a href="#build.helpful-targets" title=
1.38      dillo    7439:           "14.3.&nbsp;Other helpful targets">Section&nbsp;14.3,
1.1       grant    7440:           &#8220;Other helpful targets&#8221;</a> for more
                   7441:           information on this target.</p>
                   7442:         </div>
                   7443: 
                   7444:         <div class="sect1" lang="en" xml:lang="en">
                   7445:           <div class="titlepage">
                   7446:             <div>
                   7447:               <div>
                   7448:                 <h2 class="title" style="clear: both"><a name=
                   7449:                 "print-PLIST" id=
1.38      dillo    7450:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  7451:                 <span><strong class="command">make
                   7452:                 print-PLIST</strong></span></h2>
1.1       grant    7453:               </div>
                   7454:             </div>
                   7455:           </div>
                   7456: 
                   7457:           <p>If you have used any of the *-dirs packages, as
                   7458:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    7459:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    7460:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  7461:           you may have noticed that <span><strong class=
                   7462:           "command">make print-PLIST</strong></span> outputs a set
                   7463:           of <code class="varname">@comment</code>s instead of real
                   7464:           <code class="varname">@dirrm</code> lines. You can also
                   7465:           do this for specific directories and files, so that the
                   7466:           results of that command are very close to reality. This
                   7467:           helps <span class="emphasis"><em>a lot</em></span> during
                   7468:           the update of packages.</p>
                   7469: 
                   7470:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   7471:           variable takes a set of AWK patterns and actions that are
                   7472:           used to filter the output of print-PLIST. You can
                   7473:           <span class="emphasis"><em>append</em></span> any chunk
                   7474:           of AWK scripting you like to it, but be careful with
1.1       grant    7475:           quoting.</p>
                   7476: 
1.45      wiz      7477:           <p>For example, to get all files inside the <code xmlns=
                   7478:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7479:           "filename">libdata/foo</code> directory removed from the
1.1       grant    7480:           resulting PLIST:</p>
                   7481:           <pre class="programlisting">
                   7482:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   7483:     
                   7484: </pre>
                   7485: 
1.14      xtraeme  7486:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    7487:           lines referring to a specific (shared) directory
1.14      xtraeme  7488:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    7489:           <pre class="programlisting">
                   7490:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   7491:     
                   7492: </pre>
                   7493:         </div>
                   7494: 
                   7495:         <div class="sect1" lang="en" xml:lang="en">
                   7496:           <div class="titlepage">
                   7497:             <div>
                   7498:               <div>
                   7499:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7500:                 "plist.misc" id=
                   7501:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   7502:                 in PLIST</h2>
1.1       grant    7503:               </div>
                   7504:             </div>
                   7505:           </div>
                   7506: 
                   7507:           <p>A number of variables are substituted automatically in
                   7508:           PLISTs when a package is installed on a system. This
                   7509:           includes the following variables:</p>
                   7510: 
                   7511:           <div class="variablelist">
                   7512:             <dl>
1.14      xtraeme  7513:               <dt><span class="term"><code class=
                   7514:               "varname">${MACHINE_ARCH}</code>, <code class=
                   7515:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    7516: 
                   7517:               <dd>
                   7518:                 <p>Some packages like emacs and perl embed
                   7519:                 information about which architecture they were
                   7520:                 built on into the pathnames where they install
1.47      reed     7521:                 their files. To handle this case, PLIST will be
1.1       grant    7522:                 preprocessed before actually used, and the symbol
1.14      xtraeme  7523:                 &#8220;<span class="quote"><code class=
                   7524:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   7525:                 be replaced by what <span><strong class=
                   7526:                 "command">uname -p</strong></span> gives. The same
                   7527:                 is done if the string <code class=
                   7528:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   7529:                 PLIST somewhere - use this on packages that have
1.47      reed     7530:                 GNU autoconf-created configure scripts.</p>
1.1       grant    7531: 
                   7532:                 <div class="note" style=
                   7533:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   7534:                   <h3 class="title">Legacy note</h3>
                   7535: 
                   7536:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  7537:                   "quote"><code class=
                   7538:                   "varname">$ARCH</code></span>&#8221; that was
                   7539:                   replaced by the output of <span><strong class=
                   7540:                   "command">uname -m</strong></span>, but that's no
1.1       grant    7541:                   longer supported and has been removed.</p>
                   7542:                 </div>
                   7543:               </dd>
                   7544: 
1.14      xtraeme  7545:               <dt><span class="term"><code class=
                   7546:               "varname">${OPSYS}</code>, <code class=
                   7547:               "varname">${LOWER_OPSYS}</code>, <code class=
                   7548:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    7549: 
                   7550:               <dd>
                   7551:                 <p>Some packages want to embed the OS name and
                   7552:                 version into some paths. To do this, use these
1.45      wiz      7553:                 variables in the <code xmlns=
                   7554:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7555:                 "filename">PLIST</code>:</p>
1.1       grant    7556: 
                   7557:                 <div class="itemizedlist">
                   7558:                   <ul type="disc">
                   7559:                     <li>
1.14      xtraeme  7560:                       <p><code class="varname">${OPSYS}</code> -
                   7561:                       output of &#8220;<span class=
                   7562:                       "quote"><span><strong class="command">uname
                   7563:                       -s</strong></span></span>&#8221;</p>
1.1       grant    7564:                     </li>
                   7565: 
                   7566:                     <li>
1.14      xtraeme  7567:                       <p><code class=
                   7568:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   7569:                       common name (eg. &#8220;<span class=
                   7570:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    7571:                     </li>
                   7572: 
                   7573:                     <li>
1.14      xtraeme  7574:                       <p><code class="varname">${OS_VERSION}</code>
                   7575:                       - &#8220;<span class=
                   7576:                       "quote"><span><strong class="command">uname
                   7577:                       -r</strong></span></span>&#8221;</p>
1.1       grant    7578:                     </li>
                   7579:                   </ul>
                   7580:                 </div>
                   7581:               </dd>
                   7582: 
1.14      xtraeme  7583:               <dt><span class="term"><code class=
                   7584:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    7585: 
                   7586:               <dd>
                   7587:                 <p>Packages that install locale files should list
                   7588:                 them in the PLIST as &#8220;<span class=
                   7589:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   7590:                 instead of &#8220;<span class=
                   7591:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   7592:                 This properly handles the fact that different
                   7593:                 operating systems expect locale files to be either
1.45      wiz      7594:                 in <code xmlns=
                   7595:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7596:                 "filename">share</code> or <code xmlns=
                   7597:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7598:                 "filename">lib</code> by default.</p>
1.1       grant    7599:               </dd>
                   7600:             </dl>
                   7601:           </div>
                   7602: 
                   7603:           <p>For a complete list of values which are replaced by
1.45      wiz      7604:           default, please look in <code xmlns=
                   7605:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7606:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    7607:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   7608: 
                   7609:           <p>If you want to change other variables not listed
                   7610:           above, you can add variables and their expansions to this
1.14      xtraeme  7611:           variable in the following way, similar to <code class=
                   7612:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    7613:           "#components.optional" title=
1.38      dillo    7614:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    7615:           &#8220;Optional files&#8221;</a>):</p>
                   7616:           <pre class="programlisting">
                   7617: PLIST_SUBST+=    SOMEVAR="somevalue"
                   7618: </pre>
                   7619: 
                   7620:           <p>This replaces all occurrences of &#8220;<span class=
                   7621:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   7622:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   7623:         </div>
                   7624: 
                   7625:         <div class="sect1" lang="en" xml:lang="en">
                   7626:           <div class="titlepage">
                   7627:             <div>
                   7628:               <div>
                   7629:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7630:                 "manpage-compression" id=
1.48      dillo    7631:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   7632:                 compression</h2>
1.1       grant    7633:               </div>
                   7634:             </div>
                   7635:           </div>
                   7636: 
1.47      reed     7637:           <p>Man pages should be installed in compressed form if
1.45      wiz      7638:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   7639:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7640:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      7641:           otherwise. To handle this in the <code xmlns=
                   7642:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7643:           "filename">PLIST</code> file, the suffix
                   7644:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     7645:           appended/removed automatically for man pages according to
1.14      xtraeme  7646:           <code class="varname">MANZ</code> and <code class=
                   7647:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      7648:           above for details. This modification of the <code xmlns=
                   7649:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7650:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      7651:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7652:           class="filename">PLIST</code> itself.</p>
1.1       grant    7653:         </div>
                   7654: 
                   7655:         <div class="sect1" lang="en" xml:lang="en">
                   7656:           <div class="titlepage">
                   7657:             <div>
                   7658:               <div>
                   7659:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7660:                 "using-PLIST_SRC" id=
1.38      dillo    7661:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      7662:                 source with <code class=
1.14      xtraeme  7663:                 "varname">PLIST_SRC</code></h2>
1.1       grant    7664:               </div>
                   7665:             </div>
                   7666:           </div>
                   7667: 
1.14      xtraeme  7668:           <p>To use one or more files as source for the
1.45      wiz      7669:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7670:           class="filename">PLIST</code> used in generating the
                   7671:           binary package, set the variable <code class=
1.14      xtraeme  7672:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      7673:           The files are later concatenated using <a href=
                   7674:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   7675:           <span class="citerefentry"><span class=
                   7676:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   7677:           things is important.</p>
1.1       grant    7678:         </div>
                   7679: 
                   7680:         <div class="sect1" lang="en" xml:lang="en">
                   7681:           <div class="titlepage">
                   7682:             <div>
                   7683:               <div>
                   7684:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7685:                 "platform-specific-plist" id=
1.47      reed     7686:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   7687:                 and differing PLISTs</h2>
1.1       grant    7688:               </div>
                   7689:             </div>
                   7690:           </div>
                   7691: 
                   7692:           <p>Some packages decide to install a different set of
                   7693:           files based on the operating system being used. These
                   7694:           differences can be automatically handled by using the
                   7695:           following files:</p>
                   7696: 
                   7697:           <div class="itemizedlist">
                   7698:             <ul type="disc">
                   7699:               <li>
1.45      wiz      7700:                 <p><code xmlns=
                   7701:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7702:                 "filename">PLIST.common</code></p>
1.1       grant    7703:               </li>
                   7704: 
                   7705:               <li>
1.45      wiz      7706:                 <p><code xmlns=
                   7707:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7708:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    7709:               </li>
                   7710: 
                   7711:               <li>
1.45      wiz      7712:                 <p><code xmlns=
                   7713:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7714:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   7715:               </li>
                   7716: 
                   7717:               <li>
1.45      wiz      7718:                 <p><code xmlns=
                   7719:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      7720:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   7721:               </li>
                   7722: 
                   7723:               <li>
1.45      wiz      7724:                 <p><code xmlns=
                   7725:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7726:                 "filename">PLIST.common_end</code></p>
1.1       grant    7727:               </li>
                   7728:             </ul>
                   7729:           </div>
                   7730:         </div>
                   7731: 
                   7732:         <div class="sect1" lang="en" xml:lang="en">
                   7733:           <div class="titlepage">
                   7734:             <div>
                   7735:               <div>
                   7736:                 <h2 class="title" style="clear: both"><a name=
                   7737:                 "faq.common-dirs" id=
1.38      dillo    7738:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   7739:                 directories between packages</h2>
1.1       grant    7740:               </div>
                   7741:             </div>
                   7742:           </div>
                   7743: 
                   7744:           <p>A &#8220;<span class="quote">shared
                   7745:           directory</span>&#8221; is a directory where multiple
                   7746:           (and unrelated) packages install files. These directories
                   7747:           are problematic because you have to add special tricks in
                   7748:           the PLIST to conditionally remove them, or have some
                   7749:           centralized package handle them.</p>
                   7750: 
                   7751:           <p>Within pkgsrc, you'll find both approaches. If a
                   7752:           directory is shared by a few unrelated packages, it's
                   7753:           often not worth to add an extra package to remove it.
                   7754:           Therefore, one simply does:</p>
                   7755:           <pre class="programlisting">
                   7756:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   7757:     
                   7758: </pre>
                   7759: 
                   7760:           <p>in the PLISTs of all affected packages, instead of the
                   7761:           regular "@dirrm" line.</p>
                   7762: 
                   7763:           <p>However, if the directory is shared across many
                   7764:           packages, two different solutions are available:</p>
                   7765: 
                   7766:           <div class="orderedlist">
                   7767:             <ol type="1">
                   7768:               <li>
                   7769:                 <p>If the packages have a common dependency, the
                   7770:                 directory can be removed in that. For example, see
                   7771:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7772:                 href=
                   7773:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      7774:                 target="_top"><code xmlns="" class=
                   7775:                 "filename">textproc/scrollkeeper</code></a>, which
                   7776:                 removes the shared directory <code xmlns=
                   7777:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      7778:                 "filename">share/omf</code>.</p>
1.1       grant    7779:               </li>
                   7780: 
                   7781:               <li>
                   7782:                 <p>If the packages using the directory are not
                   7783:                 related at all (they have no common dependencies),
                   7784:                 a *-dirs package is used.</p>
                   7785:               </li>
                   7786:             </ol>
                   7787:           </div>
                   7788: 
                   7789:           <p>From now on, we'll discuss the second solution. To get
                   7790:           an idea of the *-dirs packages available, issue:</p>
                   7791:           <pre class="programlisting">
1.14      xtraeme  7792:       <code class="prompt">%</code> cd .../pkgsrc
                   7793:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    7794:     
                   7795: </pre>
                   7796: 
                   7797:           <p>Their use from other packages is very simple. The
1.14      xtraeme  7798:           <code class="varname">USE_DIRS</code> variable takes a
                   7799:           list of package names (without the &#8220;<span class=
1.1       grant    7800:           "quote">-dirs</span>&#8221; part) together with the
                   7801:           required version number (always pick the latest one when
1.34      wiz      7802:           writing new packages).</p>
1.1       grant    7803: 
                   7804:           <p>For example, if a package installs files under
1.45      wiz      7805:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7806:           class="filename">share/applications</code>, it should
                   7807:           have the following line in it:</p>
1.1       grant    7808:           <pre class="programlisting">
                   7809:       USE_DIRS+= xdg-1.1
                   7810:     
                   7811: </pre>
                   7812: 
1.14      xtraeme  7813:           <p>After regenerating the PLIST using
                   7814:           <span><strong class="command">make
                   7815:           print-PLIST</strong></span>, you should get the right
                   7816:           (commented out) lines.</p>
1.1       grant    7817: 
1.47      reed     7818:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      7819:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7820:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    7821:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      7822:           part and pkgsrc (in particular, <code xmlns=
                   7823:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7824:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    7825:         </div>
                   7826:       </div>
                   7827: 
                   7828:       <div class="chapter" lang="en" xml:lang="en">
                   7829:         <div class="titlepage">
                   7830:           <div>
                   7831:             <div>
                   7832:               <h2 class="title"><a name="buildlink" id=
1.38      dillo    7833:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    7834:               methodology</h2>
                   7835:             </div>
                   7836:           </div>
                   7837:         </div>
                   7838: 
                   7839:         <div class="toc">
                   7840:           <p><b>Table of Contents</b></p>
                   7841: 
                   7842:           <dl>
1.30      wiz      7843:             <dt><span class="sect1"><a href=
1.38      dillo    7844:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      7845:             to use buildlink3</a></span></dt>
1.1       grant    7846: 
1.30      wiz      7847:             <dt><span class="sect1"><a href=
1.45      wiz      7848:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   7849:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      7850:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    7851: 
                   7852:             <dd>
                   7853:               <dl>
1.25      rillig   7854:                 <dt><span class="sect2"><a href=
1.38      dillo    7855:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      7856:                 buildlink3.mk file</a></span></dt>
1.1       grant    7857: 
1.25      rillig   7858:                 <dt><span class="sect2"><a href=
1.38      dillo    7859:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      7860:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  7861:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      7862:                 <code xmlns=
                   7863:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7864:                 "filename">buildlink3.mk</code>
1.1       grant    7865:                 files</a></span></dt>
                   7866:               </dl>
                   7867:             </dd>
                   7868: 
1.30      wiz      7869:             <dt><span class="sect1"><a href=
1.45      wiz      7870:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   7871:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      7872:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    7873: 
                   7874:             <dd>
                   7875:               <dl>
1.25      rillig   7876:                 <dt><span class="sect2"><a href=
1.38      dillo    7877:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      7878:                 <code xmlns=
                   7879:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7880:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    7881: 
1.25      rillig   7882:                 <dt><span class="sect2"><a href=
1.38      dillo    7883:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      7884:                 preferences for native or pkgsrc
                   7885:                 software</a></span></dt>
1.1       grant    7886:               </dl>
                   7887:             </dd>
                   7888:           </dl>
                   7889:         </div>
                   7890: 
                   7891:         <p>Buildlink is a framework in pkgsrc that controls what
                   7892:         headers and libraries are seen by a package's configure and
                   7893:         build processes. This is implemented in a two step
                   7894:         process:</p>
                   7895: 
                   7896:         <div class="orderedlist">
                   7897:           <ol type="1">
                   7898:             <li>
                   7899:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  7900:               into <code class="varname">BUILDLINK_DIR</code>,
                   7901:               which by default is a subdirectory of <code class=
                   7902:               "varname">WRKDIR</code>.</p>
1.1       grant    7903:             </li>
                   7904: 
                   7905:             <li>
                   7906:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  7907:               the normal compiler tools that translate <code class=
                   7908:               "option">-I${LOCALBASE}/include</code> and
                   7909:               <code class="option">-L${LOCALBASE}/lib</code> into
                   7910:               references to <code class=
                   7911:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   7912:               also make native compiler on some operating systems
                   7913:               look like GCC, so that packages that expect GCC won't
                   7914:               require modifications to build with those native
                   7915:               compilers.</p>
1.1       grant    7916:             </li>
                   7917:           </ol>
                   7918:         </div>
                   7919: 
                   7920:         <p>This normalizes the environment in which a package is
                   7921:         built so that the package may be built consistently despite
                   7922:         what other software may be installed. Please note that the
1.45      wiz      7923:         normal system header and library paths, e.g. <code xmlns=
                   7924:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7925:         "filename">/usr/include</code>, <code xmlns=
                   7926:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7927:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    7928:         buildlink3 is designed to insulate the package build from
                   7929:         non-system-supplied software.</p>
                   7930: 
                   7931:         <div class="sect1" lang="en" xml:lang="en">
                   7932:           <div class="titlepage">
                   7933:             <div>
                   7934:               <div>
                   7935:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      7936:                 "converting-to-buildlink3" id=
1.38      dillo    7937:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      7938:                 packages to use buildlink3</h2>
1.1       grant    7939:               </div>
                   7940:             </div>
                   7941:           </div>
                   7942: 
                   7943:           <p>The process of converting packages to use the
                   7944:           buildlink3 framework (&#8220;<span class=
                   7945:           "quote">bl3ifying</span>&#8221;) is fairly
                   7946:           straightforward. The things to keep in mind are:</p>
                   7947: 
                   7948:           <div class="orderedlist">
                   7949:             <ol type="1">
                   7950:               <li>
                   7951:                 <p>Ensure that the build always calls the wrapper
                   7952:                 scripts instead of the actual toolchain. Some
                   7953:                 packages are tricky, and the only way to know for
1.45      wiz      7954:                 sure is the check <code xmlns=
                   7955:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7956:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    7957:                 wrappers are being invoked.</p>
                   7958:               </li>
                   7959: 
                   7960:               <li>
1.14      xtraeme  7961:                 <p>Don't override <code class=
                   7962:                 "varname">PREFIX</code> from within the package
                   7963:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      7964:                 because the code to symlink files into <code xmlns=
                   7965:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7966:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    7967:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  7968:                 <em class=
                   7969:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    7970:               </li>
                   7971: 
                   7972:               <li>
                   7973:                 <p>Remember that <span class=
1.45      wiz      7974:                 "emphasis"><em>only</em></span> the <code xmlns=
                   7975:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7976:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    7977:                 in a package's Makefile are added as dependencies
                   7978:                 for that package.</p>
                   7979:               </li>
                   7980:             </ol>
                   7981:           </div>
                   7982: 
                   7983:           <p>If a dependency on a particular package is required
                   7984:           for its libraries and headers, then we replace:</p>
                   7985:           <pre class="programlisting">
1.27      rillig   7986: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    7987: </pre>
                   7988: 
                   7989:           <p>with</p>
                   7990:           <pre class="programlisting">
                   7991: .include "../../category/foo/buildlink3.mk"
                   7992: </pre>
                   7993: 
1.47      reed     7994:           <p>The buildlink3.mk files usually define the required
                   7995:           dependencies. If you need a newer version of the
                   7996:           dependency when using buildlink3.mk files, then you can
                   7997:           define it in your Makefile; for example:</p>
                   7998:           <pre class="programlisting">
                   7999: BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8000: .include "../../category/foo/buildlink3.mk"
                   8001: </pre>
                   8002: 
1.45      wiz      8003:           <p>There are several <code xmlns=
                   8004:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8005:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8006:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8007:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8008:           issues:</p>
                   8009: 
                   8010:           <div class="itemizedlist">
                   8011:             <ul type="disc">
                   8012:               <li>
1.45      wiz      8013:                 <p><code xmlns=
                   8014:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8015:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8016:                 the native or a pkgsrc Berkeley DB implementation
                   8017:                 based on the values of <code class=
1.14      xtraeme  8018:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8019:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8020:               </li>
                   8021: 
                   8022:               <li>
1.45      wiz      8023:                 <p><code xmlns=
                   8024:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8025:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8026:                 system comes with neither Curses nor NCurses, this
                   8027:                 will take care to install the <a xmlns=
                   8028:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8029:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8030:                 target="_top"><code xmlns="" class=
                   8031:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8032:               </li>
                   8033: 
                   8034:               <li>
1.45      wiz      8035:                 <p><code xmlns=
                   8036:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8037:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8038:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8039:                 choose between adding a dependency on Heimdal or
                   8040:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8041:                 implementation.</p>
                   8042:               </li>
                   8043: 
                   8044:               <li>
1.45      wiz      8045:                 <p><code xmlns=
                   8046:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8047:                 "filename">motif.buildlink3.mk</code> checks for a
                   8048:                 system-provided Motif installation or adds a
                   8049:                 dependency on <a xmlns=
1.1       grant    8050:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8051:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8052:                 target="_top"><code xmlns="" class=
                   8053:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8054:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8055:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8056:                 target="_top"><code xmlns="" class=
1.47      reed     8057:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8058:               </li>
                   8059: 
                   8060:               <li>
1.45      wiz      8061:                 <p><code xmlns=
                   8062:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8063:                 "filename">ossaudio.buildlink3.mk</code> defines
                   8064:                 several variables that may be used by packages that
1.47      reed     8065:                 use the Open Sound System (OSS) API.</p>
1.1       grant    8066:               </li>
                   8067: 
                   8068:               <li>
1.45      wiz      8069:                 <p><code xmlns=
                   8070:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8071:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8072:                 either Postgres 7.3 or 7.4, whichever is found
                   8073:                 installed. See the file for more information.</p>
1.1       grant    8074:               </li>
                   8075: 
                   8076:               <li>
1.45      wiz      8077:                 <p><code xmlns=
                   8078:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8079:                 "filename">pthread.buildlink3.mk</code> uses the
                   8080:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8081:                 and checks for native pthreads or adds a dependency
                   8082:                 on <a xmlns=
1.1       grant    8083:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8084:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8085:                 target="_top"><code xmlns="" class=
1.47      reed     8086:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8087:               </li>
                   8088: 
                   8089:               <li>
1.45      wiz      8090:                 <p><code xmlns=
                   8091:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8092:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8093:                 of <code class="varname">XAW_TYPE</code> to choose
                   8094:                 a particular Athena widgets library.</p>
1.1       grant    8095:               </li>
                   8096:             </ul>
                   8097:           </div>
                   8098: 
1.45      wiz      8099:           <p>The comments in those <code xmlns=
                   8100:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8101:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8102:           complete description of how to use them properly.</p>
                   8103:         </div>
                   8104: 
                   8105:         <div class="sect1" lang="en" xml:lang="en">
                   8106:           <div class="titlepage">
                   8107:             <div>
                   8108:               <div>
                   8109:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      8110:                 "creating-buildlink3.mk" id=
1.38      dillo    8111:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8112:                 <code xmlns=
                   8113:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8114:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8115:               </div>
                   8116:             </div>
                   8117:           </div>
                   8118: 
1.45      wiz      8119:           <p>A package's <code xmlns=
                   8120:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8121:           "filename">buildlink3.mk</code> file is included by
                   8122:           Makefiles to indicate the need to compile and link
                   8123:           against header files and libraries provided by the
1.45      wiz      8124:           package. A <code xmlns=
                   8125:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8126:           "filename">buildlink3.mk</code> file should always
                   8127:           provide enough information to add the correct type of
                   8128:           dependency relationship and include any other
                   8129:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8130:           class="filename">buildlink3.mk</code> files that it needs
                   8131:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8132: 
1.45      wiz      8133:           <p>To generate an initial <code xmlns=
                   8134:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8135:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8136:           Rene Hexel's <a xmlns=
                   8137:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8138:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8139:           target="_top"><code xmlns="" class=
                   8140:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8141:           highly recommended. For most packages, the following
                   8142:           command will generate a good starting point for
1.45      wiz      8143:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8144:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8145:           <pre class="screen">
1.14      xtraeme  8146: <code class="prompt">%</code> <strong class=
                   8147: "userinput"><code>cd pkgsrc/<em class=
                   8148: "replaceable"><code>category</code></em>/<em class=
                   8149: "replaceable"><code>pkgdir</code></em>
                   8150: <code class=
1.49    ! rillig   8151: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8152: </pre>
                   8153: 
                   8154:           <div class="sect2" lang="en" xml:lang="en">
                   8155:             <div class="titlepage">
                   8156:               <div>
                   8157:                 <div>
1.30      wiz      8158:                   <h3 class="title"><a name="anatomy-of-bl3" id=
1.38      dillo    8159:                   "anatomy-of-bl3"></a>11.2.1. Anatomy of a
1.25      rillig   8160:                   buildlink3.mk file</h3>
1.1       grant    8161:                 </div>
                   8162:               </div>
                   8163:             </div>
                   8164: 
1.45      wiz      8165:             <p>The following real-life example <code xmlns=
                   8166:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8167:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8168:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8169:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8170:             <pre class="programlisting">
1.17      sketch   8171: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8172: 
                   8173: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8174: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   8175: 
                   8176: .if !empty(BUILDLINK_DEPTH:M+)
                   8177: BUILDLINK_DEPENDS+=     tiff
                   8178: .endif
                   8179: 
                   8180: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8181: BUILDLINK_PACKAGES+=    tiff
                   8182: 
                   8183: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8184: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8185: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8186: .endif  # TIFF_BUILDLINK3_MK
                   8187: 
                   8188: .include "../../devel/zlib/buildlink3.mk"
                   8189: .include "../../graphics/jpeg/buildlink3.mk"
                   8190: 
                   8191: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   8192: </pre>
                   8193: 
1.14      xtraeme  8194:             <p>The header and footer manipulate <code class=
                   8195:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8196:             across all <code xmlns=
                   8197:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8198:             "filename">buildlink3.mk</code> files and is used to
                   8199:             track at what depth we are including <code xmlns=
                   8200:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8201:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8202: 
                   8203:             <p>The first section controls if the dependency on
1.14      xtraeme  8204:             <em class="replaceable"><code>pkg</code></em> is added.
                   8205:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8206:             global list of packages for which dependencies are
                   8207:             added by buildlink3.</p>
                   8208: 
                   8209:             <p>The second section advises pkgsrc that the
1.45      wiz      8210:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8211:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8212:             <em class="replaceable"><code>pkg</code></em> has been
                   8213:             included at some point. <code class=
                   8214:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8215:             of packages for which <code xmlns=
                   8216:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8217:             "filename">buildlink3.mk</code> files have been
                   8218:             included. It must <span class=
                   8219:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8220:             a <code xmlns=
                   8221:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8222:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8223: 
                   8224:             <p>The third section is protected from multiple
1.14      xtraeme  8225:             inclusion and controls how the dependency on <em class=
                   8226:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8227:             important variables are set in the section:</p>
                   8228: 
                   8229:             <div class="itemizedlist">
                   8230:               <ul type="disc">
                   8231:                 <li>
1.14      xtraeme  8232:                   <p><code class=
                   8233:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8234:                   "replaceable"><code>pkg</code></em></code> is the
                   8235:                   actual dependency recorded in the installed
                   8236:                   package; this should always be set using
                   8237:                   <span><strong class="command">+=</strong></span>
                   8238:                   to ensure that we're appending to any
                   8239:                   pre-existing list of values. This variable should
                   8240:                   be set to the first version of the package that
                   8241:                   had the last change in the major number of a
                   8242:                   shared library or that had a major API
                   8243:                   change.</p>
1.1       grant    8244:                 </li>
                   8245: 
                   8246:                 <li>
1.14      xtraeme  8247:                   <p><code class=
                   8248:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8249:                   "replaceable"><code>pkg</code></em></code> is the
                   8250:                   location of the <em class=
                   8251:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8252:                   directory.</p>
1.1       grant    8253:                 </li>
                   8254: 
                   8255:                 <li>
1.14      xtraeme  8256:                   <p><code class=
                   8257:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8258:                   "replaceable"><code>pkg</code></em></code> (not
                   8259:                   shown above) controls whether we use <code class=
                   8260:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8261:                   "varname">DEPENDS</code> to add the dependency on
                   8262:                   <em class="replaceable"><code>pkg</code></em>.
                   8263:                   The build dependency is selected by setting
                   8264:                   <code class=
                   8265:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8266:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8267:                   &#8220;<span class="quote">build</span>&#8221;.
                   8268:                   By default, the full dependency is used.</p>
                   8269:                 </li>
                   8270: 
                   8271:                 <li>
1.14      xtraeme  8272:                   <p><code class=
                   8273:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8274:                   "replaceable"><code>pkg</code></em></code> and
                   8275:                   <code class=
                   8276:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   8277:                   <code>pkg</code></em></code> (not shown above)
1.45      wiz      8278:                   are lists of subdirectories of <code xmlns=
                   8279:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8280:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8281:                   "replaceable"><code>pkg</code></em>}</code> to
                   8282:                   add to the header and library search paths. These
1.1       grant    8283:                   default to &#8220;<span class=
                   8284:                   "quote">include</span>&#8221; and
                   8285:                   &#8220;<span class="quote">lib</span>&#8221;
                   8286:                   respectively.</p>
                   8287:                 </li>
                   8288: 
                   8289:                 <li>
1.14      xtraeme  8290:                   <p><code class=
                   8291:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   8292:                   "replaceable"><code>pkg</code></em></code> (not
                   8293:                   shown above) is the list of preprocessor flags to
                   8294:                   add to <code class="varname">CPPFLAGS</code>,
                   8295:                   which are passed on to the configure and build
                   8296:                   phases. The &#8220;<span class=
                   8297:                   "quote">-I</span>&#8221; option should be avoided
                   8298:                   and instead be handled using <code class=
                   8299:                   "varname">BUILDLINK_INCDIRS.<em class=
                   8300:                   "replaceable"><code>pkg</code></em></code> as
                   8301:                   above.</p>
1.1       grant    8302:                 </li>
                   8303:               </ul>
                   8304:             </div>
                   8305: 
                   8306:             <p>The following variables are all optionally defined
                   8307:             within this second section (protected against multiple
                   8308:             inclusion) and control which package files are
1.45      wiz      8309:             symlinked into <code xmlns=
                   8310:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8311:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    8312:             are transformed during the symlinking:</p>
                   8313: 
                   8314:             <div class="itemizedlist">
                   8315:               <ul type="disc">
                   8316:                 <li>
1.14      xtraeme  8317:                   <p><code class=
                   8318:                   "varname">BUILDLINK_FILES.<em class=
                   8319:                   "replaceable"><code>pkg</code></em></code> (not
                   8320:                   shown above) is a shell glob pattern relative to
1.45      wiz      8321:                   <code xmlns=
                   8322:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8323:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8324:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      8325:                   symlinked into <code xmlns=
                   8326:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8327:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      8328:                   <code xmlns=
                   8329:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8330:                   "filename">include/*.h</code>.</p>
1.1       grant    8331:                 </li>
                   8332: 
                   8333:                 <li>
1.14      xtraeme  8334:                   <p><code class=
                   8335:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   8336:                   "replaceable"><code>pkg</code></em></code> (not
                   8337:                   shown above) is a shell pipeline that outputs to
1.45      wiz      8338:                   stdout a list of files relative to <code xmlns=
                   8339:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8340:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8341:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    8342:                   resulting files are to be symlinked into
1.45      wiz      8343:                   <code xmlns=
                   8344:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8345:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   8346:                   this takes the <code xmlns=
                   8347:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8348:                   "filename">+CONTENTS</code> of a <em class=
                   8349:                   "replaceable"><code>pkg</code></em> and filters
                   8350:                   it through <code class=
                   8351:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   8352:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    8353:                 </li>
                   8354: 
                   8355:                 <li>
1.14      xtraeme  8356:                   <p><code class=
                   8357:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8358:                   "replaceable"><code>pkg</code></em></code> (not
                   8359:                   shown above) is a filter command that filters
1.45      wiz      8360:                   <code xmlns=
                   8361:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8362:                   "filename">+CONTENTS</code> input into a list of
                   8363:                   files relative to <code xmlns=
                   8364:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8365:                   "filename">${BUILDLINK_PREFIX.<em class=
                   8366:                   "replaceable"><code>pkg</code></em>}</code> on
                   8367:                   stdout. By default for overwrite packages,
                   8368:                   <code class=
                   8369:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   8370:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      8371:                   outputs the contents of the <code xmlns=
                   8372:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8373:                   "filename">include</code> and <code xmlns=
                   8374:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8375:                   "filename">lib</code> directories in the package
1.45      wiz      8376:                   <code xmlns=
                   8377:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8378:                   "filename">+CONTENTS</code>, and for pkgviews
                   8379:                   packages, it outputs any libtool archives in
                   8380:                   <code xmlns=
                   8381:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8382:                   "filename">lib</code> directories.</p>
1.1       grant    8383:                 </li>
                   8384: 
                   8385:                 <li>
1.14      xtraeme  8386:                   <p><code class=
                   8387:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   8388:                   "replaceable"><code>pkg</code></em></code> (not
                   8389:                   shown above) is a list of sed arguments used to
1.1       grant    8390:                   transform the name of the source filename into a
1.14      xtraeme  8391:                   destination filename, e.g. <span><strong class=
1.1       grant    8392:                   "command">-e
1.14      xtraeme  8393:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    8394:                 </li>
                   8395:               </ul>
                   8396:             </div>
                   8397: 
1.45      wiz      8398:             <p>The last section includes any <code xmlns=
                   8399:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8400:             "filename">buildlink3.mk</code> needed for <em class=
                   8401:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      8402:             dependencies. Including these <code xmlns=
                   8403:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8404:             "filename">buildlink3.mk</code> files means that the
                   8405:             headers and libraries for these dependencies are also
1.45      wiz      8406:             symlinked into <code xmlns=
                   8407:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8408:             "filename">${BUILDLINK_DIR}</code> whenever the
                   8409:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      8410:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8411:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  8412:             included.</p>
1.1       grant    8413:           </div>
                   8414: 
                   8415:           <div class="sect2" lang="en" xml:lang="en">
                   8416:             <div class="titlepage">
                   8417:               <div>
                   8418:                 <div>
1.30      wiz      8419:                   <h3 class="title"><a name=
                   8420:                   "updating-buildlink-depends" id=
1.38      dillo    8421:                   "updating-buildlink-depends"></a>11.2.2. Updating
1.30      wiz      8422:                   <code class=
                   8423:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
1.45      wiz      8424:                   <code>pkg</code></em></code> in <code xmlns=
                   8425:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8426:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    8427:                 </div>
                   8428:               </div>
                   8429:             </div>
                   8430: 
                   8431:             <p>There are two situations that require increasing the
1.14      xtraeme  8432:             dependency listed in <code class=
                   8433:             "varname">BUILDLINK_DEPENDS.<em class=
                   8434:             "replaceable"><code>pkg</code></em></code> after a
                   8435:             package update:</p>
1.1       grant    8436: 
                   8437:             <div class="orderedlist">
                   8438:               <ol type="1">
                   8439:                 <li>
                   8440:                   <p>if the sonames (major number of the library
                   8441:                   version) of any installed shared libraries
1.47      reed     8442:                   change.</p>
1.1       grant    8443:                 </li>
                   8444: 
                   8445:                 <li>
                   8446:                   <p>if the API or interface to the header files
                   8447:                   change.</p>
                   8448:                 </li>
                   8449:               </ol>
                   8450:             </div>
                   8451: 
1.14      xtraeme  8452:             <p>In these cases, <code class=
                   8453:             "varname">BUILDLINK_DEPENDS.<em class=
                   8454:             "replaceable"><code>pkg</code></em></code> should be
                   8455:             adjusted to require at least the new package version.
                   8456:             In some cases, the packages that depend on this new
                   8457:             version may need their <code class=
                   8458:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      8459:             have <code xmlns=
                   8460:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8461:             "filename">buildlink3.mk</code> files, their
                   8462:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8463:             "replaceable"><code>pkg</code></em></code> adjusted,
                   8464:             too. This is needed so that binary packages made using
                   8465:             it will require the correct package dependency and not
                   8466:             settle for an older one which will not contain the
                   8467:             necessary shared libraries.</p>
1.1       grant    8468: 
                   8469:             <p>Please take careful consideration before adjusting
1.14      xtraeme  8470:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   8471:             "replaceable"><code>pkg</code></em></code> as we don't
                   8472:             want to cause unneeded package deletions and rebuilds.
                   8473:             In many cases, new versions of packages work just fine
                   8474:             with older dependencies. See <a href="#dependencies"
1.38      dillo    8475:             title="15.1.4.&nbsp;Handling dependencies">Section
                   8476:             15.1.4, &#8220;Handling dependencies&#8221;</a> for
1.36      wiz      8477:             more information about dependencies on other packages,
1.25      rillig   8478:             including the <code class=
                   8479:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   8480:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    8481:           </div>
                   8482:         </div>
                   8483: 
                   8484:         <div class="sect1" lang="en" xml:lang="en">
                   8485:           <div class="titlepage">
                   8486:             <div>
                   8487:               <div>
                   8488:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      8489:                 "writing-builtin.mk" id=
1.38      dillo    8490:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      8491:                 <code xmlns=
                   8492:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8493:                 "filename">builtin.mk</code> files</h2>
1.1       grant    8494:               </div>
                   8495:             </div>
                   8496:           </div>
                   8497: 
                   8498:           <p>Some packages in pkgsrc install headers and libraries
                   8499:           that coincide with headers and libraries present in the
1.45      wiz      8500:           base system. Aside from a <code xmlns=
                   8501:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8502:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      8503:           should also include a <code xmlns=
                   8504:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8505:           "filename">builtin.mk</code> file that includes the
                   8506:           necessary checks to decide whether using the built-in
                   8507:           software or the pkgsrc software is appropriate.</p>
1.1       grant    8508: 
                   8509:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  8510:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    8511: 
                   8512:           <div class="orderedlist">
                   8513:             <ol type="1">
                   8514:               <li>
1.14      xtraeme  8515:                 <p>It should set <code class=
                   8516:                 "varname">USE_BUILTIN.<em class=
                   8517:                 "replaceable"><code>pkg</code></em></code> to
                   8518:                 either &#8220;<span class="quote">yes</span>&#8221;
                   8519:                 or &#8220;<span class="quote">no</span>&#8221;
                   8520:                 after it is included.</p>
1.1       grant    8521:               </li>
                   8522: 
                   8523:               <li>
                   8524:                 <p>It should <span class=
                   8525:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  8526:                 <code class="varname">USE_BUILTIN.<em class=
                   8527:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      8528:                 already set before the <code xmlns=
                   8529:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8530:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    8531:               </li>
                   8532: 
                   8533:               <li>
                   8534:                 <p>It should be written to allow multiple
                   8535:                 inclusion. This is <span class=
                   8536:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      8537:                 careful attention to <code xmlns=
                   8538:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8539:                 "filename">Makefile</code> coding.</p>
1.1       grant    8540:               </li>
                   8541:             </ol>
                   8542:           </div>
                   8543: 
                   8544:           <div class="sect2" lang="en" xml:lang="en">
                   8545:             <div class="titlepage">
                   8546:               <div>
                   8547:                 <div>
1.30      wiz      8548:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
                   8549:                   id=
1.38      dillo    8550:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      8551:                   of a <code xmlns=
                   8552:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   8553:                   "filename">builtin.mk</code> file</h3>
1.1       grant    8554:                 </div>
                   8555:               </div>
                   8556:             </div>
                   8557: 
                   8558:             <p>The following is the recommended template for
                   8559:             builtin.mk files:</p>
                   8560:             <pre class="programlisting">
                   8561: .if !defined(IS_BUILTIN.foo)
                   8562: #
                   8563: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   8564: # genuinely exists in the system or not.
                   8565: #
                   8566: IS_BUILTIN.foo?=        no
                   8567: 
                   8568: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   8569: # version can be determined.
                   8570: #
                   8571: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   8572: BUILTIN_PKG.foo?=       foo-1.0
                   8573: .  endif
                   8574: .endif  # IS_BUILTIN.foo
                   8575: 
                   8576: .if !defined(USE_BUILTIN.foo)
                   8577: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   8578: .  if defined(BUILTIN_PKG.foo)
                   8579: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   8580: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   8581: USE_BUILTIN.foo!=                                                       \
                   8582:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   8583:               ${ECHO} "yes";                                            \
                   8584:       else                                                              \
                   8585:               ${ECHO} "no";                                             \
                   8586:       fi
                   8587: .      endif
                   8588: .    endfor
                   8589: .  endif
                   8590: .endif  # USE_BUILTIN.foo
                   8591: 
                   8592: CHECK_BUILTIN.foo?=     no
                   8593: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   8594: #
                   8595: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   8596: # "yes" or "no".
                   8597: #
                   8598: .endif  # CHECK_BUILTIN.foo
                   8599:       
                   8600: </pre>
                   8601: 
1.14      xtraeme  8602:             <p>The first section sets <code class=
                   8603:             "varname">IS_BUILTIN.<em class=
                   8604:             "replaceable"><code>pkg</code></em></code> depending on
                   8605:             if <em class="replaceable"><code>pkg</code></em> really
                   8606:             exists in the base system. This should not be a base
                   8607:             system software with similar functionality to
                   8608:             <em class="replaceable"><code>pkg</code></em>; it
                   8609:             should only be &#8220;<span class=
                   8610:             "quote">yes</span>&#8221; if the actual package is
                   8611:             included as part of the base system. This variable is
1.45      wiz      8612:             only used internally within the <code xmlns=
                   8613:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8614:             "filename">builtin.mk</code> file.</p>
                   8615: 
                   8616:             <p>The second section sets <code class=
                   8617:             "varname">BUILTIN_PKG.<em class=
                   8618:             "replaceable"><code>pkg</code></em></code> to the
                   8619:             version of <em class=
                   8620:             "replaceable"><code>pkg</code></em> in the base system
                   8621:             if it exists (if <code class=
                   8622:             "varname">IS_BUILTIN.<em class=
                   8623:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8624:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  8625:             variable is only used internally within the
1.45      wiz      8626:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8627:             class="filename">builtin.mk</code> file.</p>
1.1       grant    8628: 
1.14      xtraeme  8629:             <p>The third section sets <code class=
                   8630:             "varname">USE_BUILTIN.<em class=
                   8631:             "replaceable"><code>pkg</code></em></code> and is
                   8632:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      8633:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8634:             class="filename">builtin.mk</code> files. The code in
                   8635:             this section must make the determination whether the
                   8636:             built-in software is adequate to satisfy the
                   8637:             dependencies listed in <code class=
1.14      xtraeme  8638:             "varname">BUILDLINK_DEPENDS.<em class=
                   8639:             "replaceable"><code>pkg</code></em></code>. This is
                   8640:             typically done by comparing <code class=
                   8641:             "varname">BUILTIN_PKG.<em class=
                   8642:             "replaceable"><code>pkg</code></em></code> against each
                   8643:             of the dependencies in <code class=
                   8644:             "varname">BUILDLINK_DEPENDS.<em class=
                   8645:             "replaceable"><code>pkg</code></em></code>.
                   8646:             <code class="varname">USE_BUILTIN.<em class=
                   8647:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    8648:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      8649:             value by the end of the <code xmlns=
                   8650:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8651:             "filename">builtin.mk</code> file. Note that
                   8652:             <code class="varname">USE_BUILTIN.<em class=
                   8653:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    8654:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  8655:             <code class="varname">IS_BUILTIN.<em class=
                   8656:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    8657:             &#8220;<span class="quote">no</span>&#8221; because we
                   8658:             may make the determination that the built-in version of
                   8659:             the software is similar enough to be used as a
                   8660:             replacement.</p>
                   8661: 
1.14      xtraeme  8662:             <p>The last section is guarded by <code class=
                   8663:             "varname">CHECK_BUILTIN.<em class=
                   8664:             "replaceable"><code>pkg</code></em></code>, and
                   8665:             includes code that uses the value of <code class=
                   8666:             "varname">USE_BUILTIN.<em class=
                   8667:             "replaceable"><code>pkg</code></em></code> set in the
                   8668:             previous section. This typically includes, e.g., adding
1.1       grant    8669:             additional dependency restrictions and listing
1.45      wiz      8670:             additional files to symlink into <code xmlns=
                   8671:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8672:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   8673:             "varname">BUILDLINK_FILES.<em class=
                   8674:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    8675:           </div>
                   8676: 
                   8677:           <div class="sect2" lang="en" xml:lang="en">
                   8678:             <div class="titlepage">
                   8679:               <div>
                   8680:                 <div>
1.30      wiz      8681:                   <h3 class="title"><a name=
                   8682:                   "native-or-pkgsrc-preference" id=
1.38      dillo    8683:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      8684:                   preferences for native or pkgsrc software</h3>
1.1       grant    8685:                 </div>
                   8686:               </div>
                   8687:             </div>
                   8688: 
                   8689:             <p>When building packages, it's possible to choose
                   8690:             whether to set a global preference for using either the
                   8691:             built-in (native) version or the pkgsrc version of
                   8692:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  8693:             setting <code class="varname">PREFER_PKGSRC</code> and
                   8694:             <code class="varname">PREFER_NATIVE</code>. These
                   8695:             variables take values of either &#8220;<span class=
1.1       grant    8696:             "quote">yes</span>&#8221;, &#8220;<span class=
                   8697:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  8698:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   8699:             to use the pkgsrc versions of software, while
                   8700:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   8701:             to use the built-in versions. Preferences are
                   8702:             determined by the most specific instance of the package
                   8703:             in either <code class="varname">PREFER_PKGSRC</code> or
                   8704:             <code class="varname">PREFER_NATIVE</code>. If a
                   8705:             package is specified in neither or in both variables,
                   8706:             then <code class="varname">PREFER_PKGSRC</code> has
                   8707:             precedence over <code class=
                   8708:             "varname">PREFER_NATIVE</code>. For example, to require
                   8709:             using pkgsrc versions of software for all but the most
                   8710:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    8711:             <pre class="programlisting">
                   8712:         PREFER_PKGSRC=  yes
                   8713:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   8714:       
                   8715: </pre>
                   8716: 
                   8717:             <p>A package <span class=
1.45      wiz      8718:             "emphasis"><em>must</em></span> have a <code xmlns=
                   8719:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8720:             "filename">builtin.mk</code> file to be listed in
                   8721:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   8722:             it is simply ignored in that list.</p>
1.1       grant    8723:           </div>
                   8724:         </div>
                   8725:       </div>
                   8726: 
                   8727:       <div class="chapter" lang="en" xml:lang="en">
                   8728:         <div class="titlepage">
                   8729:           <div>
                   8730:             <div>
1.35      jmmv     8731:               <h2 class="title"><a name="pkginstall" id=
1.38      dillo    8732:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     8733:               framework</h2>
1.1       grant    8734:             </div>
                   8735:           </div>
                   8736:         </div>
                   8737: 
                   8738:         <div class="toc">
                   8739:           <p><b>Table of Contents</b></p>
                   8740: 
                   8741:           <dl>
1.30      wiz      8742:             <dt><span class="sect1"><a href=
1.38      dillo    8743:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     8744:             directories outside the installation
                   8745:             prefix</a></span></dt>
                   8746: 
                   8747:             <dd>
                   8748:               <dl>
                   8749:                 <dt><span class="sect2"><a href=
1.38      dillo    8750:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     8751:                 manipulation</a></span></dt>
                   8752: 
                   8753:                 <dt><span class="sect2"><a href=
1.38      dillo    8754:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     8755:                 manipulation</a></span></dt>
                   8756:               </dl>
                   8757:             </dd>
                   8758: 
1.38      dillo    8759:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     8760:             Configuration files</a></span></dt>
                   8761: 
                   8762:             <dd>
                   8763:               <dl>
                   8764:                 <dt><span class="sect2"><a href=
1.38      dillo    8765:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     8766:                 "varname">PKG_SYSCONFDIR</code> is
                   8767:                 set</a></span></dt>
                   8768: 
                   8769:                 <dt><span class="sect2"><a href=
1.38      dillo    8770:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     8771:                 software where configuration files
1.35      jmmv     8772:                 are</a></span></dt>
                   8773: 
                   8774:                 <dt><span class="sect2"><a href=
1.38      dillo    8775:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     8776:                 installations</a></span></dt>
                   8777: 
                   8778:                 <dt><span class="sect2"><a href=
1.38      dillo    8779:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     8780:                 configuration files</a></span></dt>
                   8781:               </dl>
                   8782:             </dd>
                   8783: 
1.38      dillo    8784:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     8785:             System startup scripts</a></span></dt>
                   8786: 
                   8787:             <dd>
                   8788:               <dl>
                   8789:                 <dt><span class="sect2"><a href=
1.38      dillo    8790:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     8791:                 of system startup scripts</a></span></dt>
                   8792:               </dl>
                   8793:             </dd>
1.1       grant    8794: 
1.30      wiz      8795:             <dt><span class="sect1"><a href=
1.38      dillo    8796:             "#users-and-groups">12.4. System users and
1.35      jmmv     8797:             groups</a></span></dt>
                   8798: 
1.38      dillo    8799:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     8800:             shells</a></span></dt>
                   8801: 
                   8802:             <dd>
                   8803:               <dl>
                   8804:                 <dt><span class="sect2"><a href=
1.38      dillo    8805:                 "#shells-disable">12.5.1. Disabling handling of
1.35      jmmv     8806:                 configuration files</a></span></dt>
                   8807:               </dl>
                   8808:             </dd>
1.1       grant    8809:           </dl>
                   8810:         </div>
                   8811: 
1.35      jmmv     8812:         <p>This chapter describes the framework known as
                   8813:         <code class="literal">pkginstall</code>, whose key features
                   8814:         are:</p>
                   8815: 
                   8816:         <div class="itemizedlist">
                   8817:           <ul type="disc">
                   8818:             <li>
                   8819:               <p>Generic installation and manipulation of
                   8820:               directories and files outside the pkgsrc-handled
                   8821:               tree, <code class="varname">LOCALBASE</code>.</p>
                   8822:             </li>
                   8823: 
                   8824:             <li>
                   8825:               <p>Automatic handling of configuration files during
                   8826:               installation, provided that packages are correctly
                   8827:               designed.</p>
                   8828:             </li>
                   8829: 
                   8830:             <li>
                   8831:               <p>Generation and installation of system startup
                   8832:               scripts.</p>
                   8833:             </li>
                   8834: 
                   8835:             <li>
                   8836:               <p>Registration of system users and groups.</p>
                   8837:             </li>
                   8838: 
                   8839:             <li>
                   8840:               <p>Registration of system shells.</p>
                   8841:             </li>
                   8842:           </ul>
                   8843:         </div>
                   8844: 
                   8845:         <p>The following sections inspect each of the above points
1.47      reed     8846:         in detail. Note that in order to use any of the described
1.35      jmmv     8847:         functionalities, you must add the following to your
1.45      wiz      8848:         package's <code xmlns=
                   8849:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8850:         "filename">Makefile</code>:</p>
1.35      jmmv     8851:         <pre class="programlisting">
                   8852: USE_PKGINSTALL=YES
                   8853: </pre>
                   8854: 
                   8855:         <p>You may be thinking that many of the things described
                   8856:         here could be easily done with simple code in the package's
                   8857:         post-installation target (<code class=
                   8858:         "literal">post-install</code>). <span class=
                   8859:         "emphasis"><em>This is incorrect</em></span>, as the code
                   8860:         in them is only executed when building from source.
                   8861:         Machines using binary packages could not benefit from it at
                   8862:         all (as the code itself could be unavailable). Therefore,
                   8863:         the only way to achieve any of the items described above is
                   8864:         by means of the installation scripts, which are
                   8865:         automatically generated by pkginstall.</p>
1.1       grant    8866: 
                   8867:         <div class="sect1" lang="en" xml:lang="en">
                   8868:           <div class="titlepage">
                   8869:             <div>
                   8870:               <div>
                   8871:                 <h2 class="title" style="clear: both"><a name=
1.35      jmmv     8872:                 "files-and-dirs-outside-prefix" id=
1.38      dillo    8873:                 "files-and-dirs-outside-prefix"></a>12.1. Files and
1.35      jmmv     8874:                 directories outside the installation prefix</h2>
1.1       grant    8875:               </div>
                   8876:             </div>
                   8877:           </div>
                   8878: 
1.45      wiz      8879:           <p>As you already know, the <code xmlns=
                   8880:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8881:           "filename">PLIST</code> file holds a list of files and
                   8882:           directories that belong to a package. The names used in
1.45      wiz      8883:           it are relative to the installation prefix (<code xmlns=
                   8884:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8885:           "filename">${PREFIX}</code>), which means that it cannot
                   8886:           register files outside this directory (absolute path
                   8887:           names are not allowed). Despite this restriction, some
                   8888:           packages need to install files outside this location;
1.45      wiz      8889:           e.g., under <code xmlns=
                   8890:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8891:           "filename">${VARBASE}</code> or <code xmlns=
                   8892:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8893:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     8894: 
                   8895:           <p>The only way to achieve this is to create such files
                   8896:           during installation time by using the installation
                   8897:           scripts. These scripts can run arbitrary commands, so
                   8898:           they have the potential to create and manage files
1.47      reed     8899:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     8900:           comes into play: it provides generic scripts to abstract
                   8901:           the manipulation of such files and directories based on
1.45      wiz      8902:           variables set in the package's <code xmlns=
                   8903:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8904:           "filename">Makefile</code>. The rest of this section
1.47      reed     8905:           describes these variables.</p>
1.1       grant    8906: 
1.35      jmmv     8907:           <div class="sect2" lang="en" xml:lang="en">
                   8908:             <div class="titlepage">
1.1       grant    8909:               <div>
1.35      jmmv     8910:                 <div>
                   8911:                   <h3 class="title"><a name="dirs-outside-prefix"
1.38      dillo    8912:                   id="dirs-outside-prefix"></a>12.1.1. Directory
1.35      jmmv     8913:                   manipulation</h3>
                   8914:                 </div>
1.1       grant    8915:               </div>
                   8916:             </div>
                   8917: 
1.35      jmmv     8918:             <p>The following variables can be set to request the
1.47      reed     8919:             creation of directories anywhere in the file
                   8920:             system:</p>
1.27      rillig   8921: 
1.35      jmmv     8922:             <div class="itemizedlist">
                   8923:               <ul type="disc">
                   8924:                 <li>
                   8925:                   <p><code class="varname">MAKE_DIRS</code> and
                   8926:                   <code class="varname">OWN_DIRS</code> contain a
                   8927:                   list of directories that should be created and
                   8928:                   should attempt to be destroyed by the
                   8929:                   installation scripts. The difference between the
                   8930:                   two is that the latter prompts the administrator
                   8931:                   to remove any directories that may be left after
                   8932:                   deinstallation (because they were not empty),
                   8933:                   while the former does not.</p>
                   8934:                 </li>
1.1       grant    8935: 
1.35      jmmv     8936:                 <li>
                   8937:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   8938:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   8939:                   contain a list of tuples describing which
                   8940:                   directories should be created and should attempt
                   8941:                   to be destroyed by the installation scripts. Each
                   8942:                   tuple holds the following values, separated by
                   8943:                   spaces: the directory name, its owner, its group
                   8944:                   and its numerical mode. For example:</p>
                   8945:                   <pre class="programlisting">
                   8946: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
                   8947: </pre>
1.1       grant    8948: 
1.35      jmmv     8949:                   <p>The difference between the two is exactly the
                   8950:                   same as their non-<code class=
                   8951:                   "varname">PERMS</code> counterparts.</p>
                   8952:                 </li>
                   8953:               </ul>
                   8954:             </div>
                   8955:           </div>
                   8956: 
                   8957:           <div class="sect2" lang="en" xml:lang="en">
                   8958:             <div class="titlepage">
                   8959:               <div>
                   8960:                 <div>
                   8961:                   <h3 class="title"><a name="files-outside-prefix"
1.38      dillo    8962:                   id="files-outside-prefix"></a>12.1.2. File
1.35      jmmv     8963:                   manipulation</h3>
                   8964:                 </div>
                   8965:               </div>
                   8966:             </div>
                   8967: 
                   8968:             <p>Creating non-empty files outside the installation
1.45      wiz      8969:             prefix is tricky because the <code xmlns=
                   8970:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     8971:             "filename">PLIST</code> forces all files to be inside
                   8972:             it. To overcome this problem, the only solution is to
                   8973:             extract the file in the known place (i.e., inside the
                   8974:             installation prefix) and copy it to the appropriate
                   8975:             location during installation (done by the installation
                   8976:             scripts generated by pkginstall). We will call the
                   8977:             former the <span class="emphasis"><em>master
                   8978:             file</em></span> in the following paragraphs, which
                   8979:             describe the variables that can be used to
                   8980:             automatically and consistently handle files outside the
                   8981:             installation prefix:</p>
                   8982: 
                   8983:             <div class="itemizedlist">
                   8984:               <ul type="disc">
                   8985:                 <li>
                   8986:                   <p><code class="varname">CONF_FILES</code> and
                   8987:                   <code class="varname">SUPPORT_FILES</code> are
                   8988:                   pairs of master and target files. During
                   8989:                   installation time, the master file is copied to
                   8990:                   the target one if and only if the latter does not
                   8991:                   exist. Upon deinstallation, the target file is
                   8992:                   removed provided that it was not modified by the
                   8993:                   installation.</p>
                   8994: 
                   8995:                   <p>The difference between the two is that the
                   8996:                   latter prompts the administrator to remove any
                   8997:                   files that may be left after deinstallation
                   8998:                   (because they were not empty), while the former
                   8999:                   does not.</p>
                   9000:                 </li>
                   9001: 
                   9002:                 <li>
                   9003:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9004:                   and <code class=
                   9005:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9006:                   tuples describing master files as well as their
                   9007:                   target locations. For each of them, it also
                   9008:                   specifies their owner, their group and their
                   9009:                   numeric permissions, in this order. For
                   9010:                   example:</p>
                   9011:                   <pre class="programlisting">
                   9012: SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
                   9013: </pre>
                   9014: 
                   9015:                   <p>The difference between the two is exactly the
                   9016:                   same as their non-<code class=
                   9017:                   "varname">PERMS</code> counterparts.</p>
                   9018:                 </li>
                   9019:               </ul>
                   9020:             </div>
                   9021:           </div>
                   9022:         </div>
                   9023: 
                   9024:         <div class="sect1" lang="en" xml:lang="en">
                   9025:           <div class="titlepage">
                   9026:             <div>
                   9027:               <div>
                   9028:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9029:                 "conf-files" id="conf-files"></a>12.2.
1.35      jmmv     9030:                 Configuration files</h2>
                   9031:               </div>
                   9032:             </div>
                   9033:           </div>
                   9034: 
                   9035:           <p>Configuration files are special in the sense that they
                   9036:           are installed in their own specific directory,
                   9037:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9038:           special treatment during installation (most of which is
                   9039:           automated by pkginstall). The main concept you must bear
1.36      wiz      9040:           in mind is that files marked as configuration files are
1.35      jmmv     9041:           automatically copied to the right place (somewhere inside
                   9042:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9043:           installation <span class="emphasis"><em>if and only
                   9044:           if</em></span> they didn't exist before. Similarly, they
                   9045:           will not be removed if they have local modifications.
1.36      wiz      9046:           This ensures that administrators never lose any custom
1.35      jmmv     9047:           changes they may have made.</p>
                   9048: 
                   9049:           <div class="sect2" lang="en" xml:lang="en">
                   9050:             <div class="titlepage">
                   9051:               <div>
                   9052:                 <div>
                   9053:                   <h3 class="title"><a name="conf-files-sysconfdir"
1.38      dillo    9054:                   id="conf-files-sysconfdir"></a>12.2.1. How
1.35      jmmv     9055:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9056:                   set</h3>
                   9057:                 </div>
                   9058:               </div>
                   9059:             </div>
                   9060: 
                   9061:             <p>As said before, the <code class=
                   9062:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9063:             where configuration files shall be installed. Its
                   9064:             contents are set based upon the following
                   9065:             variables:</p>
                   9066: 
                   9067:             <div class="itemizedlist">
                   9068:               <ul type="disc">
                   9069:                 <li>
                   9070:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9071:                   The configuration's root directory. Defaults to
1.45      wiz      9072:                   <code xmlns=
                   9073:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9074:                   "filename">${PREFIX}/etc</code> although it may
                   9075:                   be overridden by the user to point to his
                   9076:                   preferred location (e.g., <code xmlns=
                   9077:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9078:                   "filename">/etc</code>, <code xmlns=
                   9079:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9080:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9081:                   not use it directly.</p>
                   9082:                 </li>
                   9083: 
                   9084:                 <li>
                   9085:                   <p><code class=
                   9086:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9087:                   subdirectory of <code class=
                   9088:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9089:                   configuration files for the package being built
                   9090:                   shall be installed. The definition of this
                   9091:                   variable only makes sense in the package's
1.45      wiz      9092:                   <code xmlns=
                   9093:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9094:                   "filename">Makefile</code> (i.e., it is not
                   9095:                   user-customizable).</p>
1.35      jmmv     9096: 
                   9097:                   <p>As an example, consider the Apache package,
                   9098:                   <a xmlns=
                   9099:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9100:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9101:                   target="_top"><code xmlns="" class=
                   9102:                   "filename">www/apache2</code></a>, which places
                   9103:                   its configuration files under the <code xmlns=
                   9104:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9105:                   "filename">httpd/</code> subdirectory of
                   9106:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9107:                   This should be set in the package Makefile.</p>
                   9108:                 </li>
                   9109: 
                   9110:                 <li>
                   9111:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9112:                   Specifies the name of the variable that holds
                   9113:                   this package's configuration directory (if
                   9114:                   different from <code class=
                   9115:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9116:                   <code class="varname">PKGBASE</code>'s value, and
                   9117:                   is always prefixed with <code class=
                   9118:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9119:                 </li>
                   9120: 
                   9121:                 <li>
                   9122:                   <p><code class=
                   9123:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9124:                   Holds the directory where the configuration files
                   9125:                   for the package identified by <code class=
                   9126:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9127:                   placed.</p>
                   9128:                 </li>
                   9129:               </ul>
                   9130:             </div>
                   9131: 
                   9132:             <p>Based on the above variables, pkginstall determines
                   9133:             the value of <code class=
                   9134:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9135:             <span class="emphasis"><em>only</em></span> variable
                   9136:             that can be used within a package to refer to its
                   9137:             configuration directory. The algorithm used to set its
                   9138:             value is basically the following:</p>
                   9139: 
                   9140:             <div class="orderedlist">
                   9141:               <ol type="1">
                   9142:                 <li>
                   9143:                   <p>If <code class=
                   9144:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9145:                   is set, its value is used.</p>
                   9146:                 </li>
                   9147: 
                   9148:                 <li>
                   9149:                   <p>If the previous variable is not defined but
                   9150:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9151:                   set in the package's <code xmlns=
                   9152:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9153:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9154:                   is <code xmlns=
                   9155:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9156:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9157:                 </li>
                   9158: 
                   9159:                 <li>
1.45      wiz      9160:                   <p>Otherwise, it is set to <code xmlns=
                   9161:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9162:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9163:                 </li>
                   9164:               </ol>
                   9165:             </div>
                   9166: 
1.45      wiz      9167:             <p>It is worth mentioning that <code xmlns=
                   9168:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9169:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9170:             added to <code xmlns=
                   9171:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9172:             "filename">OWN_DIRS</code>. See <a href=
                   9173:             "#dirs-outside-prefix" title=
1.38      dillo    9174:             "12.1.1.&nbsp;Directory manipulation">Section 12.1.1,
1.35      jmmv     9175:             &#8220;Directory manipulation&#8221;</a> what this
                   9176:             means.</p>
                   9177:           </div>
                   9178: 
                   9179:           <div class="sect2" lang="en" xml:lang="en">
                   9180:             <div class="titlepage">
                   9181:               <div>
                   9182:                 <div>
                   9183:                   <h3 class="title"><a name="conf-files-configure"
1.38      dillo    9184:                   id="conf-files-configure"></a>12.2.2. Telling the
1.47      reed     9185:                   software where configuration files are</h3>
1.35      jmmv     9186:                 </div>
                   9187:               </div>
                   9188:             </div>
                   9189: 
                   9190:             <p>Given that pkgsrc (and users!) expect configuration
                   9191:             files to be in a known place, you need to teach each
1.36      wiz      9192:             package where it shall install its files. In some cases
1.35      jmmv     9193:             you will have to patch the package Makefiles to achieve
                   9194:             it. If you are lucky, though, it may be as easy as
                   9195:             passing an extra flag to the configuration script; this
1.47      reed     9196:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9197:             <pre class="programlisting">
                   9198: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
                   9199: </pre>
                   9200: 
                   9201:             <p>Note that this specifies where the package has to
                   9202:             <span class="emphasis"><em>look for</em></span> its
                   9203:             configuration files, not where they will be originally
                   9204:             installed (although the difference is never explicit,
                   9205:             unfortunately).</p>
                   9206:           </div>
                   9207: 
                   9208:           <div class="sect2" lang="en" xml:lang="en">
                   9209:             <div class="titlepage">
                   9210:               <div>
                   9211:                 <div>
                   9212:                   <h3 class="title"><a name="conf-files-patching"
1.38      dillo    9213:                   id="conf-files-patching"></a>12.2.3. Patching
1.35      jmmv     9214:                   installations</h3>
                   9215:                 </div>
                   9216:               </div>
                   9217:             </div>
                   9218: 
                   9219:             <p>As said before, pkginstall automatically handles
                   9220:             configuration files. This means that <span class=
                   9221:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9222:             the contents of <code xmlns=
                   9223:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9224:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9225:             directly</strong></span>. Bad news is that many
                   9226:             software installation scripts will, out of the box,
                   9227:             mess with the contents of that directory. So what is
                   9228:             the correct procedure to fix this issue?</p>
1.35      jmmv     9229: 
                   9230:             <p>You must teach the package (usually by manually
                   9231:             patching it) to install any configuration files under
1.45      wiz      9232:             the examples hierarchy, <code xmlns=
                   9233:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9234:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9235:             the <code xmlns=
                   9236:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9237:             "filename">PLIST</code> registers them and the
                   9238:             administrator always has the original copies
1.35      jmmv     9239:             available.</p>
                   9240: 
                   9241:             <p>Once the required configuration files are in place
                   9242:             (i.e., under the examples hierarchy), the pkginstall
                   9243:             framework can use them as master copies during the
1.45      wiz      9244:             package installation to update what is in <code xmlns=
                   9245:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9246:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9247:             the variables <code class="varname">CONF_FILES</code>
                   9248:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9249:             used. Check out <a href="#files-outside-prefix" title=
1.38      dillo    9250:             "12.1.2.&nbsp;File manipulation">Section 12.1.2,
1.35      jmmv     9251:             &#8220;File manipulation&#8221;</a> for information
                   9252:             about their syntax and their purpose. Here is an
                   9253:             example, taken from the <a xmlns=
                   9254:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9255:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9256:             target="_top"><code xmlns="" class=
                   9257:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9258:             <pre class="programlisting">
                   9259: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9260: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   9261: </pre>
                   9262: 
                   9263:             <p>Note that the <code class="varname">EGDIR</code>
                   9264:             variable is specific to that package and has no meaning
                   9265:             outside it.</p>
                   9266:           </div>
                   9267: 
                   9268:           <div class="sect2" lang="en" xml:lang="en">
                   9269:             <div class="titlepage">
                   9270:               <div>
                   9271:                 <div>
                   9272:                   <h3 class="title"><a name="conf-files-disable"
1.38      dillo    9273:                   id="conf-files-disable"></a>12.2.4. Disabling
1.35      jmmv     9274:                   handling of configuration files</h3>
                   9275:                 </div>
                   9276:               </div>
                   9277:             </div>
                   9278: 
                   9279:             <p>The automatic copying of config files can be toggled
                   9280:             by setting the environment variable <code class=
                   9281:             "varname">PKG_CONFIG</code> prior to package
                   9282:             installation.</p>
                   9283:           </div>
                   9284:         </div>
                   9285: 
                   9286:         <div class="sect1" lang="en" xml:lang="en">
                   9287:           <div class="titlepage">
                   9288:             <div>
                   9289:               <div>
                   9290:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9291:                 "rcd-scripts" id="rcd-scripts"></a>12.3. System
1.35      jmmv     9292:                 startup scripts</h2>
                   9293:               </div>
                   9294:             </div>
                   9295:           </div>
                   9296: 
                   9297:           <p>System startup scripts are special files because they
                   9298:           must be installed in a place known by the underlying OS,
                   9299:           usually outside the installation prefix. Therefore, the
                   9300:           same rules described in <a href=
                   9301:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    9302:           "12.1.&nbsp;Files and directories outside the installation prefix">
                   9303:           Section 12.1, &#8220;Files and directories outside the
1.35      jmmv     9304:           installation prefix&#8221;</a> apply, and the same
                   9305:           solutions can be used. However, pkginstall provides a
1.36      wiz      9306:           special mechanism to handle these files.</p>
1.35      jmmv     9307: 
                   9308:           <p>In order to provide system startup scripts, the
                   9309:           package has to:</p>
                   9310: 
                   9311:           <div class="orderedlist">
                   9312:             <ol type="1">
                   9313:               <li>
1.45      wiz      9314:                 <p>Store the script inside <code xmlns=
                   9315:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9316:                 "filename">${FILESDIR}</code>, with the
                   9317:                 <code class="literal">.sh</code> suffix appended.
                   9318:                 Considering the <a xmlns=
                   9319:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   9320:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      9321:                 target="_top"><code xmlns="" class=
                   9322:                 "filename">print/cups</code></a> package as an
                   9323:                 example, it has a <code xmlns=
                   9324:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9325:                 "filename">cupsd.sh</code> in its files
                   9326:                 directory.</p>
                   9327:               </li>
                   9328: 
                   9329:               <li>
                   9330:                 <p>Tell pkginstall to handle it, appending the name
                   9331:                 of the script, without its extension, to the
                   9332:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   9333:                 Continuing the previous example:</p>
                   9334:                 <pre class="programlisting">
                   9335: RCD_SCRIPTS+= cupsd
                   9336: </pre>
                   9337:               </li>
                   9338:             </ol>
                   9339:           </div>
                   9340: 
                   9341:           <p>Once this is done, pkginstall will do the following
                   9342:           steps for each script in an automated fashion:</p>
                   9343: 
                   9344:           <div class="orderedlist">
                   9345:             <ol type="1">
                   9346:               <li>
                   9347:                 <p>Process the file found in the files directory
                   9348:                 applying all the substitutions described in the
1.45      wiz      9349:                 <code xmlns=
                   9350:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9351:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     9352:               </li>
                   9353: 
                   9354:               <li>
                   9355:                 <p>Copy the script from the files directory to the
1.45      wiz      9356:                 examples hierarchy, <code xmlns=
                   9357:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9358:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      9359:                 Note that this master file must be explicitly
1.45      wiz      9360:                 registered in the <code xmlns=
                   9361:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9362:                 "filename">PLIST</code>.</p>
                   9363:               </li>
                   9364: 
                   9365:               <li>
                   9366:                 <p>Add code to the installation scripts to copy the
                   9367:                 startup script from the examples hierarchy into the
                   9368:                 system-wide startup scripts directory.</p>
                   9369:               </li>
                   9370:             </ol>
                   9371:           </div>
                   9372: 
                   9373:           <div class="sect2" lang="en" xml:lang="en">
                   9374:             <div class="titlepage">
                   9375:               <div>
                   9376:                 <div>
                   9377:                   <h3 class="title"><a name="rcd-scripts-disable"
1.38      dillo    9378:                   id="rcd-scripts-disable"></a>12.3.1. Disabling
1.35      jmmv     9379:                   handling of system startup scripts</h3>
                   9380:                 </div>
                   9381:               </div>
                   9382:             </div>
                   9383: 
                   9384:             <p>The automatic copying of config files can be toggled
                   9385:             by setting the environment variable <code class=
                   9386:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   9387:             installation. Note that the scripts will be always
1.45      wiz      9388:             copied inside the examples hierarchy, <code xmlns=
                   9389:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9390:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   9391:             matter what the value of this variable is.</p>
                   9392:           </div>
                   9393:         </div>
                   9394: 
                   9395:         <div class="sect1" lang="en" xml:lang="en">
                   9396:           <div class="titlepage">
                   9397:             <div>
                   9398:               <div>
                   9399:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9400:                 "users-and-groups" id="users-and-groups"></a>12.4.
1.35      jmmv     9401:                 System users and groups</h2>
                   9402:               </div>
                   9403:             </div>
                   9404:           </div>
                   9405: 
                   9406:           <p>If a package needs to create special users and/or
                   9407:           groups during installation, it can do so by using the
                   9408:           pkginstall framework.</p>
                   9409: 
                   9410:           <p>Users can be created by adding entries to the
                   9411:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      9412:           entry has the following syntax, which mimics <code xmlns=
                   9413:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9414:           "filename">/etc/passwd</code>:</p>
                   9415:           <pre class="programlisting">
                   9416: user:group[:[userid][:[descr][:[home][:shell]]]]
                   9417: </pre>
                   9418: 
                   9419:           <p>Only the user and group are required; everything else
                   9420:           is optional, but the colons must be in the right places
                   9421:           when specifying optional bits. By default, a new user
1.45      wiz      9422:           will have home directory <code xmlns=
                   9423:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9424:           "filename">/nonexistent</code>, and login shell
1.45      wiz      9425:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9426:           class="filename">/sbin/nologin</code> unless they are
                   9427:           specified as part of the user element. Note that if the
                   9428:           description contains spaces, then spaces should be double
                   9429:           backslash-escaped, as in:</p>
1.35      jmmv     9430:           <pre class="programlisting">
                   9431: foo:foogrp::The\\ Foomister
                   9432: </pre>
                   9433: 
                   9434:           <p>Similarly, groups can be created using the
                   9435:           <code class="varname">PKG_GROUPS</code> variable, whose
                   9436:           syntax is:</p>
                   9437:           <pre class="programlisting">
                   9438: group[:groupid]
                   9439: </pre>
                   9440: 
                   9441:           <p>As before, only the group name is required; the
                   9442:           numeric identifier is optional.</p>
                   9443:         </div>
                   9444: 
                   9445:         <div class="sect1" lang="en" xml:lang="en">
                   9446:           <div class="titlepage">
                   9447:             <div>
                   9448:               <div>
                   9449:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9450:                 "shells" id="shells"></a>12.5. System shells</h2>
1.35      jmmv     9451:               </div>
                   9452:             </div>
                   9453:           </div>
                   9454: 
                   9455:           <p>Packages that install system shells should register
1.45      wiz      9456:           them in the shell database, <code xmlns=
                   9457:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9458:           "filename">/etc/shells</code>, to make things easier to
                   9459:           the administrator. This must be done from the
                   9460:           installation scripts to keep binary packages working on
                   9461:           any system. pkginstall provides an easy way to accomplish
                   9462:           this task.</p>
                   9463: 
                   9464:           <p>When a package provides a shell interpreter, it has to
                   9465:           set the <code class="varname">PKG_SHELL</code> variable
                   9466:           to its absolute file name. This will add some hooks to
                   9467:           the installation scripts to handle it. Consider the
                   9468:           following example, taken from <a xmlns=
                   9469:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   9470:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      9471:           target="_top"><code xmlns="" class=
                   9472:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     9473:           <pre class="programlisting">
                   9474: USE_PKGINSTALL= YES
                   9475: PKG_SHELL=      ${PREFIX}/bin/zsh
                   9476: </pre>
                   9477: 
                   9478:           <div class="sect2" lang="en" xml:lang="en">
                   9479:             <div class="titlepage">
                   9480:               <div>
                   9481:                 <div>
                   9482:                   <h3 class="title"><a name="shells-disable" id=
1.38      dillo    9483:                   "shells-disable"></a>12.5.1. Disabling handling
1.35      jmmv     9484:                   of configuration files</h3>
                   9485:                 </div>
                   9486:               </div>
                   9487:             </div>
                   9488: 
                   9489:             <p>The automatic registration of shell interpreters can
                   9490:             be disabled by the administrator by setting the
1.45      wiz      9491:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9492:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   9493:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     9494:           </div>
                   9495:         </div>
                   9496:       </div>
                   9497: 
                   9498:       <div class="chapter" lang="en" xml:lang="en">
                   9499:         <div class="titlepage">
                   9500:           <div>
                   9501:             <div>
                   9502:               <h2 class="title"><a name="options" id=
1.38      dillo    9503:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     9504:               handling</h2>
                   9505:             </div>
                   9506:           </div>
                   9507:         </div>
                   9508: 
                   9509:         <div class="toc">
                   9510:           <p><b>Table of Contents</b></p>
                   9511: 
                   9512:           <dl>
                   9513:             <dt><span class="sect1"><a href=
1.38      dillo    9514:             "#global-default-options">13.1. Global default
1.35      jmmv     9515:             options</a></span></dt>
                   9516: 
                   9517:             <dt><span class="sect1"><a href=
1.38      dillo    9518:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      9519:             use <code xmlns=
                   9520:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9521:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    9522: 
                   9523:             <dt><span class="sect1"><a href="#option-names">13.3.
                   9524:             Option Names</a></span></dt>
1.35      jmmv     9525:           </dl>
                   9526:         </div>
                   9527: 
                   9528:         <p>Many packages have the ability to be built to support
1.45      wiz      9529:         different sets of features. <code xmlns=
                   9530:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9531:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   9532:         that provides generic handling of those options that
                   9533:         determine different ways in which the packages can be
                   9534:         built. It's possible for the user to specify exactly which
                   9535:         sets of options will be built into a package or to allow a
                   9536:         set of global default options apply.</p>
                   9537: 
                   9538:         <div class="sect1" lang="en" xml:lang="en">
                   9539:           <div class="titlepage">
                   9540:             <div>
                   9541:               <div>
                   9542:                 <h2 class="title" style="clear: both"><a name=
                   9543:                 "global-default-options" id=
1.38      dillo    9544:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     9545:                 default options</h2>
                   9546:               </div>
                   9547:             </div>
                   9548:           </div>
                   9549: 
                   9550:           <p>Global default options are listed in <code class=
                   9551:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   9552:           the options that should be built into every package if
                   9553:           that option is supported. This variable should be set in
1.45      wiz      9554:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9555:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     9556:         </div>
                   9557: 
                   9558:         <div class="sect1" lang="en" xml:lang="en">
                   9559:           <div class="titlepage">
                   9560:             <div>
                   9561:               <div>
                   9562:                 <h2 class="title" style="clear: both"><a name=
                   9563:                 "converting-to-options" id=
1.38      dillo    9564:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      9565:                 packages to use <code xmlns=
                   9566:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9567:                 "filename">bsd.options.mk</code></h2>
                   9568:               </div>
                   9569:             </div>
                   9570:           </div>
                   9571: 
1.45      wiz      9572:           <p>The following example shows how <code xmlns=
                   9573:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9574:           "filename">bsd.options.mk</code> should be used by the
                   9575:           hypothetical ``wibble'' package, either in the package
1.45      wiz      9576:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9577:           class="filename">Makefile</code>, or in a file, e.g.
                   9578:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9579:           class="filename">options.mk</code>, that is included by
                   9580:           the main package <code xmlns=
                   9581:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9582:           "filename">Makefile</code>.</p>
                   9583:           <pre class="programlisting">
1.37      dillo    9584: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
                   9585: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
1.47      reed     9586: PKG_OPTIONS_OPTIONAL_GROUPS=    database
                   9587: PKG_OPTIONS_GROUP.database=     mysql pgsql
1.37      dillo    9588: PKG_SUGGESTED_OPTIONS=          wibble-foo
                   9589: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
                   9590: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
                   9591: 
                   9592: .include "../../mk/bsd.prefs.mk"
                   9593: 
                   9594: # this package was previously named wibble2
                   9595: .if defined(PKG_OPTIONS.wibble2)
                   9596: PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
1.40      dillo    9597: PKG_OPTIONS_DEPRECATED_WARNINGS+="Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
1.37      dillo    9598: .endif
1.35      jmmv     9599: 
                   9600: .include "../../mk/bsd.options.mk"
                   9601: 
                   9602: # Package-specific option-handling
                   9603: 
                   9604: ###
1.37      dillo    9605: ### FOO support
                   9606: ###
                   9607: .if !empty(PKG_OPTIONS:Mwibble-foo)
                   9608: CONFIGURE_ARGS+=        --enable-foo
                   9609: .endif
                   9610: 
                   9611: ###
1.35      jmmv     9612: ### LDAP support
                   9613: ###
                   9614: .if !empty(PKG_OPTIONS:Mldap)
                   9615: .  include "../../databases/openldap/buildlink3.mk"
1.37      dillo    9616: CONFIGURE_ARGS+=        --enable-ldap=${BUILDLINK_PREFIX.openldap}
1.35      jmmv     9617: .endif
1.1       grant    9618: 
                   9619: ###
1.37      dillo    9620: ### database support
1.1       grant    9621: ###
1.37      dillo    9622: .if !empty(PKG_OPTIONS:Mmysql)
                   9623: .  include "../../mk/mysql.buildlink3.mk"
                   9624: .endif
                   9625: .if !empty(PKG_OPTIONS:Mpgsql)
                   9626: .  include "../../mk/pgsql.buildlink3.mk"
1.1       grant    9627: .endif
                   9628: </pre>
                   9629: 
1.28      rillig   9630:           <p>The first section contains the information about which
                   9631:           build options are supported by the package, and any
1.1       grant    9632:           default options settings if needed.</p>
                   9633: 
                   9634:           <div class="orderedlist">
                   9635:             <ol type="1">
                   9636:               <li>
1.14      xtraeme  9637:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   9638:                 the name of the <a href=
1.1       grant    9639:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9640:                 <span class="citerefentry"><span class=
1.27      rillig   9641:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    9642:                 that the user can set to override the default
                   9643:                 options. It should be set to &#8220;<span class=
                   9644:                 "quote">PKG_OPTIONS.<em class=
1.38      dillo    9645:                 "replaceable"><code>pkgbase</code></em></span>&#8221;.</p>
1.1       grant    9646:               </li>
                   9647: 
                   9648:               <li>
1.14      xtraeme  9649:                 <p><code class=
                   9650:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    9651:                 build options supported by the package.</p>
                   9652:               </li>
                   9653: 
                   9654:               <li>
                   9655:                 <p><code class=
                   9656:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   9657:                 list of names of groups of mutually exclusive
                   9658:                 options. The options in each group are listed in
                   9659:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   9660:                 "replaceable"><code>groupname</code></em></code>.
                   9661:                 The most specific setting of any option from the
                   9662:                 group takes precedence over all other options in
                   9663:                 the group. Options from the groups will be
                   9664:                 automatically added to <code class=
                   9665:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   9666:               </li>
                   9667: 
                   9668:               <li>
                   9669:                 <p><code class=
                   9670:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   9671:                 like <code class=
                   9672:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   9673:                 building the packages will fail if no option from
                   9674:                 the group is selected.</p>
1.1       grant    9675:               </li>
                   9676: 
                   9677:               <li>
1.27      rillig   9678:                 <p><code class=
1.44      gdt      9679:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   9680:                 list of names of sets of options. At least one
                   9681:                 option from each set must be selected. The options
                   9682:                 in each set are listed in <code class=
                   9683:                 "varname">PKG_OPTIONS_SET.<em class=
                   9684:                 "replaceable"><code>setname</code></em></code>.
                   9685:                 Options from the sets will be automatically added
                   9686:                 to <code class=
                   9687:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   9688:                 the package will fail if no option from the set is
                   9689:                 selected.</p>
                   9690:               </li>
                   9691: 
                   9692:               <li>
                   9693:                 <p><code class=
1.27      rillig   9694:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   9695:                 build options which are enabled by default.</p>
                   9696:               </li>
                   9697: 
                   9698:               <li>
1.37      dillo    9699:                 <p><code class=
                   9700:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   9701:                 of &#8220;<span class="quote"><em class=
                   9702:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable">
                   9703:                 <code>option</code></em></span>&#8221; pairs that
1.45      wiz      9704:                 map legacy <code xmlns=
                   9705:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    9706:                 "filename">/etc/mk.conf</code> variables to their
                   9707:                 option counterparts. Pairs should be added with
                   9708:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9709:                 the listing of global legacy variables. A warning
                   9710:                 will be issued if the user uses a legacy
                   9711:                 variable.</p>
                   9712:               </li>
1.1       grant    9713: 
1.37      dillo    9714:               <li>
                   9715:                 <p><code class=
                   9716:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   9717:                 of &#8220;<span class="quote"><em class=
                   9718:                 "replaceable"><code>old-option</code></em>:<em class="replaceable">
                   9719:                 <code>new-option</code></em></span>&#8221; pairs
                   9720:                 that map options that have been renamed to their
                   9721:                 new counterparts. Pairs should be added with
                   9722:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   9723:                 the listing of global legacy options. A warning
                   9724:                 will be issued if the user uses a legacy
                   9725:                 option.</p>
                   9726:               </li>
1.1       grant    9727: 
1.37      dillo    9728:               <li>
                   9729:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   9730:                 is a list of options implied by deprecated
                   9731:                 variables used. This can be used for cases that
                   9732:                 neither <code class=
                   9733:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   9734:                 <code class=
                   9735:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   9736:                 handle, e. g. when <code class=
                   9737:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    9738:               </li>
                   9739: 
                   9740:               <li>
1.37      dillo    9741:                 <p><code class=
                   9742:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   9743:                 a list of warnings about deprecated variables or
                   9744:                 options used, and what to use instead.</p>
1.1       grant    9745:               </li>
1.28      rillig   9746:             </ol>
1.1       grant    9747:           </div>
                   9748: 
1.37      dillo    9749:           <p>A package should never modify <code class=
                   9750:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   9751:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   9752:           These are strictly user-settable. To suggest a default
                   9753:           set of options, use <code class=
                   9754:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   9755: 
1.42      dillo    9756:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      9757:           defined before including <code xmlns=
                   9758:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    9759:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    9760:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   9761:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   9762:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     9763:           are defined (as can happen with platform-specific options
1.42      dillo    9764:           if none of them is supported on the current platform),
                   9765:           <code class="varname">PKG_OPTIONS</code> is set to the
                   9766:           empty list and the package is otherwise treated as not
                   9767:           using the options framework.</p>
1.37      dillo    9768: 
1.45      wiz      9769:           <p>After the inclusion of <code xmlns=
                   9770:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    9771:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   9772:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    9773:           list of selected build options, properly filtered to
1.28      rillig   9774:           remove unsupported and duplicate options.</p>
                   9775: 
1.1       grant    9776:           <p>The remaining sections contain the logic that is
1.37      dillo    9777:           specific to each option. The correct way to check for an
                   9778:           option is to check whether it is listed in <code class=
                   9779:           "varname">PKG_OPTIONS</code>:</p>
                   9780:           <pre class="programlisting">
                   9781: .if !empty(PKG_OPTIONS:M<em class=
                   9782: "replaceable"><code>option</code></em>)
                   9783: </pre>
1.48      dillo    9784:         </div>
1.37      dillo    9785: 
1.48      dillo    9786:         <div class="sect1" lang="en" xml:lang="en">
                   9787:           <div class="titlepage">
                   9788:             <div>
                   9789:               <div>
                   9790:                 <h2 class="title" style="clear: both"><a name=
                   9791:                 "option-names" id=
                   9792:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   9793:               </div>
                   9794:             </div>
                   9795:           </div>
                   9796: 
                   9797:           <p>Options that enable similar features in different
                   9798:           packages (like optional support for a library) should use
                   9799:           a common name in all packages that support it (like the
                   9800:           name of the library). If another package already has an
                   9801:           option with the same meaning, use the same name.</p>
                   9802: 
                   9803:           <p>Options that enable features specific to one package,
                   9804:           where it's unlikely that another (unrelated) package has
                   9805:           the same (or a similar) optional feature, should use a
                   9806:           name prefixed with <code class="varname"><em class=
                   9807:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   9808: 
                   9809:           <p>If a group of related packages share an optional
                   9810:           feature specific to that group, prefix it with the name
                   9811:           of the &#8220;<span class="quote">main</span>&#8221;
                   9812:           package (e. g. <code class=
                   9813:           "varname">djbware-errno-hack</code>).</p>
                   9814: 
                   9815:           <p>For new options, add a line to <code xmlns=
                   9816:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9817:           "filename">mk/defaults/options.description</code>. Lines
                   9818:           have two fields, separated by tab. The first field is the
                   9819:           option name, the second its description. The description
                   9820:           should be a whole sentence (starting with an uppercase
                   9821:           letter and ending with a period) that describes what
                   9822:           enabling the option does. E. g. &#8220;<span class=
                   9823:           "quote">Enable ispell support.</span>&#8221; The file is
                   9824:           sorted by option names.</p>
1.1       grant    9825:         </div>
                   9826:       </div>
                   9827: 
                   9828:       <div class="chapter" lang="en" xml:lang="en">
                   9829:         <div class="titlepage">
                   9830:           <div>
                   9831:             <div>
                   9832:               <h2 class="title"><a name="build" id=
1.38      dillo    9833:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    9834:               process</h2>
                   9835:             </div>
                   9836:           </div>
                   9837:         </div>
                   9838: 
                   9839:         <div class="toc">
                   9840:           <p><b>Table of Contents</b></p>
                   9841: 
                   9842:           <dl>
1.38      dillo    9843:             <dt><span class="sect1"><a href="#build.prefix">14.1.
1.1       grant    9844:             Program location</a></span></dt>
                   9845: 
1.38      dillo    9846:             <dt><span class="sect1"><a href="#main-targets">14.2.
1.30      wiz      9847:             Main targets</a></span></dt>
1.1       grant    9848: 
                   9849:             <dt><span class="sect1"><a href=
1.38      dillo    9850:             "#build.helpful-targets">14.3. Other helpful
1.1       grant    9851:             targets</a></span></dt>
                   9852:           </dl>
                   9853:         </div>
                   9854: 
                   9855:         <p>The basic steps for building a program are always the
                   9856:         same. First the program's source (<span class=
                   9857:         "emphasis"><em>distfile</em></span>) must be brought to the
                   9858:         local system and then extracted. After any patches to
                   9859:         compile properly on NetBSD are applied, the software can be
                   9860:         configured, then built (usually by compiling), and finally
                   9861:         the generated binaries, etc. can be put into place on the
                   9862:         system. These are exactly the steps performed by the NetBSD
                   9863:         package system, which is implemented as a series of targets
1.45      wiz      9864:         in a central Makefile, <code xmlns=
                   9865:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9866:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    9867: 
                   9868:         <div class="sect1" lang="en" xml:lang="en">
                   9869:           <div class="titlepage">
                   9870:             <div>
                   9871:               <div>
                   9872:                 <h2 class="title" style="clear: both"><a name=
                   9873:                 "build.prefix" id=
1.38      dillo    9874:                 "build.prefix"></a>14.1.&nbsp;Program location</h2>
1.1       grant    9875:               </div>
                   9876:             </div>
                   9877:           </div>
                   9878: 
                   9879:           <p>Before outlining the process performed by the NetBSD
                   9880:           package system in the next section, here's a brief
                   9881:           discussion on where programs are installed, and which
                   9882:           variables influence this.</p>
                   9883: 
1.14      xtraeme  9884:           <p>The automatic variable <code class=
                   9885:           "varname">PREFIX</code> indicates where all files of the
                   9886:           final program shall be installed. It is usually set to
1.45      wiz      9887:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   9888:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9889:           "filename">/usr/pkg</code>), or <code class=
                   9890:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    9891:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  9892:           The value of <code class="varname">PREFIX</code> needs to
                   9893:           be put into the various places in the program's source
                   9894:           where paths to these files are encoded. See <a href=
1.1       grant    9895:           "#components.patches" title=
1.38      dillo    9896:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    9897:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   9898:           title=
1.38      dillo    9899:           "15.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;15.3.1,
1.1       grant    9900:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   9901:           details.</p>
                   9902: 
                   9903:           <p>When choosing which of these variables to use, follow
                   9904:           the following rules:</p>
                   9905: 
                   9906:           <div class="itemizedlist">
                   9907:             <ul type="disc">
                   9908:               <li>
1.14      xtraeme  9909:                 <p><code class="varname">PREFIX</code> always
                   9910:                 points to the location where the current pkg will
                   9911:                 be installed. When referring to a pkg's own
1.1       grant    9912:                 installation path, use &#8220;<span class=
                   9913:                 "quote">${PREFIX}</span>&#8221;.</p>
                   9914:               </li>
                   9915: 
                   9916:               <li>
1.14      xtraeme  9917:                 <p><code class="varname">LOCALBASE</code> is where
                   9918:                 all non-X11 pkgs are installed. If you need to
1.1       grant    9919:                 construct a -I or -L argument to the compiler to
                   9920:                 find includes and libraries installed by another
                   9921:                 non-X11 pkg, use &#8220;<span class=
                   9922:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   9923:               </li>
                   9924: 
                   9925:               <li>
1.14      xtraeme  9926:                 <p><code class="varname">X11BASE</code> is where
                   9927:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    9928:                 installed. When looking for <span class=
                   9929:                 "emphasis"><em>standard</em></span> X11 includes
                   9930:                 (not those installed by a pkg), use
                   9931:                 &#8220;<span class=
                   9932:                 "quote">${X11BASE}</span>&#8221;.</p>
                   9933:               </li>
                   9934: 
                   9935:               <li>
1.47      reed     9936:                 <p>X11-based packages are special in that they may
                   9937:                 be installed in either <code class=
1.14      xtraeme  9938:                 "varname">X11BASE</code> or <code class=
                   9939:                 "varname">LOCALBASE</code>.</p>
1.1       grant    9940: 
                   9941:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  9942:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      9943:                 possible. Note that you will need to include
1.45      wiz      9944:                 <code xmlns=
                   9945:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      9946:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   9947:                 them to request the presence of X11 and to get the
                   9948:                 right compilation flags.</p>
1.1       grant    9949: 
                   9950:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  9951:                 be installed under <code class=
                   9952:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    9953:                 app-defaults files. These packages are special and
1.14      xtraeme  9954:                 they must be placed under <code class=
                   9955:                 "varname">X11BASE</code>. To accomplish this, set
                   9956:                 either <code class="varname">USE_X11BASE</code> or
                   9957:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    9958:                 package.</p>
                   9959: 
1.34      wiz      9960:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  9961:                 libraries installed by a pkg that has <code class=
                   9962:                 "varname">USE_IMAKE</code> or <code class=
                   9963:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      9964:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9965:                 class="filename">Makefile</code>, you need to look
                   9966:                 in <span class="emphasis"><em>both</em></span>
                   9967:                 <code xmlns=
                   9968:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9969:                 "filename">${X11BASE}</code> and <code xmlns=
                   9970:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9971:                 "filename">${LOCALBASE}</code>. To force
                   9972:                 installation of all X11 packages in <code class=
                   9973:                 "varname">LOCALBASE</code>, the <a xmlns=
                   9974:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9975:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      9976:                 target="_top"><code xmlns="" class=
                   9977:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      9978:                 enabled by default.</p>
1.1       grant    9979:               </li>
                   9980: 
                   9981:               <li>
1.14      xtraeme  9982:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    9983:                 used to refer to the installed location of an X11
1.14      xtraeme  9984:                 package. <code class="varname">X11PREFIX</code>
                   9985:                 will be set to <code class="varname">X11BASE</code>
                   9986:                 if xpkgwedge is not installed, and to <code class=
                   9987:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    9988:                 installed.</p>
                   9989:               </li>
                   9990: 
                   9991:               <li>
                   9992:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  9993:                 have some packages installed in <code class=
                   9994:                 "varname">X11BASE</code> and some in <code class=
                   9995:                 "varname">LOCALBASE</code>. To determine the prefix
                   9996:                 of an installed package, the <code class=
                   9997:                 "varname">EVAL_PREFIX</code> definition can be
                   9998:                 used. It takes pairs in the format
                   9999:                 &#8220;<span class=
1.1       grant    10000:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10001:                 the <a href=
                   10002:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10003:                 <span class="citerefentry"><span class=
                   10004:                 "refentrytitle">make</span>(1)</span></a> variable
                   10005:                 <code class="varname">DIRNAME</code> will be set to
                   10006:                 the prefix of the installed package
                   10007:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10008:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10009:                 is not installed.</p>
                   10010: 
                   10011:                 <p>This is best illustrated by example.</p>
                   10012: 
1.45      wiz      10013:                 <p>The following lines are taken from <code xmlns=
                   10014:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10015:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10016:                 <pre class="programlisting">
1.14      xtraeme  10017: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    10018: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   10019:                         --with-gtk-prefix="${GTKDIR}"           \
                   10020:                         --enable-multibyte
                   10021: </pre>
                   10022: 
                   10023:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10024:                 packages evaluated using <code class=
                   10025:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10026:                 of the form:</p>
                   10027:                 <pre class="programlisting">
                   10028: GTKDIR_DEFAULT= ${LOCALBASE}
                   10029: </pre>
                   10030: 
1.14      xtraeme  10031:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10032:                 corresponds to the first definition in the
1.14      xtraeme  10033:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10034:               </li>
                   10035: 
                   10036:               <li>
1.45      wiz      10037:                 <p>Within <code xmlns=
                   10038:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10039:                 "filename">${PREFIX}</code>, packages should
                   10040:                 install files according to <a href=
1.24      wiz      10041:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10042:                 <span class="citerefentry"><span class=
                   10043:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10044:                 exception that manual pages go into <code xmlns=
                   10045:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10046:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10047:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10048:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10049:               </li>
                   10050:             </ul>
                   10051:           </div>
                   10052:         </div>
                   10053: 
                   10054:         <div class="sect1" lang="en" xml:lang="en">
                   10055:           <div class="titlepage">
                   10056:             <div>
                   10057:               <div>
                   10058:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      10059:                 "main-targets" id=
1.38      dillo    10060:                 "main-targets"></a>14.2.&nbsp;Main targets</h2>
1.1       grant    10061:               </div>
                   10062:             </div>
                   10063:           </div>
                   10064: 
                   10065:           <p>The main targets used during the build process defined
1.45      wiz      10066:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10067:           class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    10068: 
                   10069:           <div class="variablelist">
                   10070:             <dl>
                   10071:               <dt><span class="term">fetch</span></dt>
                   10072: 
                   10073:               <dd>
                   10074:                 <p>This will check if the file(s) given in the
1.14      xtraeme  10075:                 variables <code class="varname">DISTFILES</code>
                   10076:                 and <code class="varname">PATCHFILES</code> (as
                   10077:                 defined in the package's Makefile) are present on
1.45      wiz      10078:                 the local system in <code xmlns=
                   10079:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10080:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   10081:                 are not present, an attempt will be made to fetch
                   10082:                 them using commands of the form:</p>
1.1       grant    10083:                 <pre class="programlisting">
                   10084: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   10085: </pre>
                   10086: 
                   10087:                 <p>where ${site} varies through several
1.14      xtraeme  10088:                 possibilities in turn: first, <code class=
                   10089:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   10090:                 then the sites specified in either <code class=
                   10091:                 "varname">SITES_file</code> if defined, else
                   10092:                 <code class="varname">MASTER_SITES</code> or
                   10093:                 <code class="varname">PATCH_SITES</code>, as
                   10094:                 applies, then finally the value of <code class=
                   10095:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   10096:                 all except the first can be optionally sorted by
                   10097:                 the user, via setting either <code class=
                   10098:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   10099:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    10100:               </dd>
                   10101: 
                   10102:               <dt><span class="term">checksum</span></dt>
                   10103: 
                   10104:               <dd>
                   10105:                 <p>After the distfile(s) are fetched, their
                   10106:                 checksum is generated and compared with the
                   10107:                 checksums stored in the distinfo file. If the
                   10108:                 checksums don't match, the build is aborted. This
                   10109:                 is to ensure the same distfile is used for
                   10110:                 building, and that the distfile wasn't changed,
                   10111:                 e.g. by some malign force, deliberately changed
                   10112:                 distfiles on the master distribution site or
                   10113:                 network lossage.</p>
                   10114:               </dd>
                   10115: 
                   10116:               <dt><span class="term">extract</span></dt>
                   10117: 
                   10118:               <dd>
                   10119:                 <p>When the distfiles are present on the local
                   10120:                 system, they need to be extracted, as they are
                   10121:                 usually in the form of some compressed archive
1.45      wiz      10122:                 format, most commonly <code xmlns=
                   10123:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10124:                 "filename">.tar.gz</code>.</p>
1.1       grant    10125: 
                   10126:                 <p>If only some of the distfiles need to be
                   10127:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  10128:                 be put into <code class=
                   10129:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    10130: 
1.45      wiz      10131:                 <p>If the distfiles are not in <code xmlns=
                   10132:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10133:                 "filename">.tar.gz</code> format, they can be
                   10134:                 extracted by setting either <code class=
                   10135:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   10136:                 "varname">EXTRACT_CMD</code>, <code class=
                   10137:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   10138:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   10139:                 the former case, pkgsrc knows how to extract a
1.45      wiz      10140:                 number of suffixes (<code xmlns=
                   10141:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10142:                 "filename">.tar.gz</code>, <code xmlns=
                   10143:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10144:                 "filename">.tgz</code>, <code xmlns=
                   10145:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10146:                 "filename">.tar.gz2</code>, <code xmlns=
                   10147:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10148:                 "filename">.tbz</code>, <code xmlns=
                   10149:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10150:                 "filename">.tar.Z</code>, <code xmlns=
                   10151:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10152:                 "filename">.tar</code>, <code xmlns=
                   10153:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10154:                 "filename">.shar.gz</code>, <code xmlns=
                   10155:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10156:                 "filename">.shar.bz2</code>, <code xmlns=
                   10157:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10158:                 "filename">.shar.Z</code>, <code xmlns=
                   10159:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10160:                 "filename">.shar</code>, <code xmlns=
                   10161:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10162:                 "filename">.Z</code>, <code xmlns=
                   10163:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10164:                 "filename">.bz2</code> and <code xmlns=
                   10165:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10166:                 "filename">.gz</code>; see the definition of the
                   10167:                 various <code class="varname">DECOMPRESS_CMD</code>
1.47      reed     10168:                 variables in <code xmlns=
1.45      wiz      10169:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     10170:                 "filename">bsd.pkg.extract.mk</code> for a complete
                   10171:                 list). Here's an example on how to use the other
                   10172:                 variables for a program that comes with a
                   10173:                 compressed shell archive whose name ends in
                   10174:                 <code xmlns=
1.45      wiz      10175:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10176:                 "filename">.msg.gz</code>:</p>
1.1       grant    10177:                 <pre class="programlisting">
                   10178:      EXTRACT_SUFX=   .msg.gz
                   10179:      EXTRACT_CMD=            zcat
                   10180:      EXTRACT_BEFORE_ARGS=
                   10181:      EXTRACT_AFTER_ARGS=     |sh
                   10182: </pre>
                   10183:               </dd>
                   10184: 
                   10185:               <dt><span class="term">patch</span></dt>
                   10186: 
                   10187:               <dd>
                   10188:                 <p>After extraction, all the patches named by the
1.14      xtraeme  10189:                 <code class="varname">PATCHFILES</code>, those
                   10190:                 present in the patches subdirectory of the package
                   10191:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
1.45      wiz      10192:                 <code xmlns=
                   10193:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10194:                 "filename">/usr/local/patches/graphics/png</code>)
1.45      wiz      10195:                 are applied. Patchfiles ending in <code xmlns=
                   10196:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10197:                 "filename">.Z</code> or <code xmlns=
                   10198:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10199:                 "filename">.gz</code> are uncompressed before they
1.45      wiz      10200:                 are applied, files ending in <code xmlns=
                   10201:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10202:                 "filename">.orig</code> or <code xmlns=
                   10203:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10204:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      10205:                 options to <a href=
                   10206:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10207:                 <span class="citerefentry"><span class=
                   10208:                 "refentrytitle">patch</span>(1)</span></a> can be
                   10209:                 handed in <code class=
1.14      xtraeme  10210:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   10211:                 "#components.patches" title=
1.38      dillo    10212:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10213:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   10214: 
1.24      wiz      10215:                 <p>By default <a href=
                   10216:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   10217:                 <span class="citerefentry"><span class=
                   10218:                 "refentrytitle">patch</span>(1)</span></a> is given
                   10219:                 special args to make it fail if the patches apply
                   10220:                 with some lines of fuzz. Please fix (regen) the
                   10221:                 patches so that they apply cleanly. The rationale
                   10222:                 behind this is that patches that don't apply
                   10223:                 cleanly may end up being applied in the wrong
                   10224:                 place, and cause severe harm there.</p>
1.1       grant    10225:               </dd>
                   10226: 
                   10227:               <dt><span class="term">configure</span></dt>
                   10228: 
                   10229:               <dd>
                   10230:                 <p>Most pieces of software need information on the
                   10231:                 header files, system calls, and library routines
                   10232:                 which are available in NetBSD. This is the process
                   10233:                 known as configuration, and is usually automated.
                   10234:                 In most cases, a script is supplied with the
                   10235:                 source, and its invocation results in generation of
                   10236:                 header files, Makefiles, etc.</p>
                   10237: 
                   10238:                 <p>If the program's distfile contains its own
                   10239:                 configure script, this can be invoked by setting
1.14      xtraeme  10240:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    10241:                 configure script is a GNU autoconf script,
1.14      xtraeme  10242:                 <code class="varname">GNU_CONFIGURE</code> should
                   10243:                 be specified instead. In either case, any arguments
                   10244:                 to the configure script can be specified in the
                   10245:                 <code class="varname">CONFIGURE_ARGS</code>
                   10246:                 variable, and the configure script's name can be
                   10247:                 set in <code class=
                   10248:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   10249:                 from the default &#8220;<span class=
1.1       grant    10250:                 "quote">configure</span>&#8221;. Here's an example
                   10251:                 from the <a xmlns=
                   10252:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10253:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.45      wiz      10254:                 target="_top"><code xmlns="" class=
                   10255:                 "filename">sysutils/top</code></a> package:</p>
1.1       grant    10256:                 <pre class="programlisting">
                   10257: HAS_CONFIGURE=          yes
                   10258: CONFIGURE_SCRIPT=       Configure
                   10259: CONFIGURE_ARGS+=        netbsd13
                   10260: </pre>
                   10261: 
                   10262:                 <p>If the program uses an Imakefile for
                   10263:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  10264:                 by setting <code class="varname">USE_IMAKE</code>
                   10265:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   10266:                 (If you only want the package installed in
                   10267:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   10268:                 not being run, set <code class=
                   10269:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    10270:               </dd>
                   10271: 
                   10272:               <dt><span class="term">build</span></dt>
                   10273: 
                   10274:               <dd>
                   10275:                 <p>Once configuration has taken place, the software
1.14      xtraeme  10276:                 will be built by invoking <code class=
                   10277:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   10278:                 "varname">$MAKEFILE</code> with <code class=
                   10279:                 "varname">$BUILD_TARGET</code> as the target to
                   10280:                 build. The default <code class=
                   10281:                 "varname">MAKE_PROGRAM</code> is
                   10282:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   10283:                 <code class="varname">USE_TOOLS</code> contains
                   10284:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    10285:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  10286:                 otherwise. <code class="varname">MAKEFILE</code> is
                   10287:                 set to &#8220;<span class=
1.1       grant    10288:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  10289:                 <code class="varname">BUILD_TARGET</code> defaults
                   10290:                 to &#8220;<span class="quote">all</span>&#8221;.
                   10291:                 Any of these variables can be set in the package's
1.1       grant    10292:                 Makefile to change the default build process.</p>
                   10293:               </dd>
                   10294: 
                   10295:               <dt><span class="term">install</span></dt>
                   10296: 
                   10297:               <dd>
                   10298:                 <p>Once the build stage has completed, the final
                   10299:                 step is to install the software in public
                   10300:                 directories, so users can access the programs and
1.14      xtraeme  10301:                 files. As in the build-target, <code class=
                   10302:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   10303:                 <code class="varname">$MAKEFILE</code> here, but
                   10304:                 with the <code class=
                   10305:                 "varname">$INSTALL_TARGET</code> instead, the
                   10306:                 latter defaulting to &#8220;<span class=
                   10307:                 "quote">install</span>&#8221; (plus
                   10308:                 &#8220;<span class=
                   10309:                 "quote">install.man</span>&#8221;, if <code class=
                   10310:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    10311:               </dd>
                   10312:             </dl>
                   10313:           </div>
                   10314: 
                   10315:           <p>If no target is specified, the default is
                   10316:           &#8220;<span class="quote">build</span>&#8221;. If a
                   10317:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  10318:           e.g. <span><strong class="command">make
                   10319:           build</strong></span> will also perform the equivalent
                   10320:           of:</p>
1.1       grant    10321:           <pre class="programlisting">
                   10322: make fetch
                   10323: make checksum
                   10324: make extract
                   10325: make patch
                   10326: make configure
                   10327: make build
                   10328: </pre>
                   10329:         </div>
                   10330: 
                   10331:         <div class="sect1" lang="en" xml:lang="en">
                   10332:           <div class="titlepage">
                   10333:             <div>
                   10334:               <div>
                   10335:                 <h2 class="title" style="clear: both"><a name=
                   10336:                 "build.helpful-targets" id=
1.38      dillo    10337:                 "build.helpful-targets"></a>14.3.&nbsp;Other
1.1       grant    10338:                 helpful targets</h2>
                   10339:               </div>
                   10340:             </div>
                   10341:           </div>
                   10342: 
                   10343:           <div class="variablelist">
                   10344:             <dl>
                   10345:               <dt><span class="term">pre/post-*</span></dt>
                   10346: 
                   10347:               <dd>
                   10348:                 <p>For any of the main targets described in the
                   10349:                 previous section, two auxiliary targets exist with
                   10350:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   10351:                 &#8220;<span class="quote">post-</span>&#8221; used
                   10352:                 as a prefix for the main target's name. These
                   10353:                 targets are invoked before and after the main
                   10354:                 target is called, allowing extra configuration or
                   10355:                 installation steps be performed from a package's
                   10356:                 Makefile, for example, which a program's configure
                   10357:                 script or install target omitted.</p>
                   10358:               </dd>
                   10359: 
                   10360:               <dt><span class="term">do-*</span></dt>
                   10361: 
                   10362:               <dd>
                   10363:                 <p>Should one of the main targets do the wrong
                   10364:                 thing, and should there be no variable to fix this,
                   10365:                 you can redefine it with the do-* target. (Note
                   10366:                 that redefining the target itself instead of the
                   10367:                 do-* target is a bad idea, as the pre-* and post-*
                   10368:                 targets won't be called anymore, etc.) You will not
                   10369:                 usually need to do this.</p>
                   10370:               </dd>
                   10371: 
                   10372:               <dt><span class="term">reinstall</span></dt>
                   10373: 
                   10374:               <dd>
1.14      xtraeme  10375:                 <p>If you did a <span><strong class="command">make
                   10376:                 install</strong></span> and you noticed some file
                   10377:                 was not installed properly, you can repeat the
1.1       grant    10378:                 installation with this target, which will ignore
                   10379:                 the &#8220;<span class="quote">already
                   10380:                 installed</span>&#8221; flag.</p>
                   10381:               </dd>
                   10382: 
                   10383:               <dt><span class="term">deinstall</span></dt>
                   10384: 
                   10385:               <dd>
1.24      wiz      10386:                 <p>This target does a <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> in
                   10390:                 the current directory, effectively de-installing
                   10391:                 the package. The following variables can be used to
                   10392:                 tune the behaviour:</p>
1.1       grant    10393: 
                   10394:                 <div class="variablelist">
                   10395:                   <dl>
1.14      xtraeme  10396:                     <dt><span class="term"><code class=
                   10397:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    10398: 
                   10399:                     <dd>
                   10400:                       <p>Add a "-v" to the <a href=
                   10401:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10402:                       <span class="citerefentry"><span class=
                   10403:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10404:                       command.</p>
                   10405:                     </dd>
                   10406: 
1.14      xtraeme  10407:                     <dt><span class="term"><code class=
                   10408:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    10409: 
                   10410:                     <dd>
                   10411:                       <p>Remove all packages that require (depend
                   10412:                       on) the given package. This can be used to
                   10413:                       remove any packages that may have been pulled
                   10414:                       in by a given package, e.g. if
1.14      xtraeme  10415:                       <span><strong class="command">make deinstall
                   10416:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      10417:                       <code xmlns=
                   10418:                       "http://www.w3.org/TR/xhtml1/transitional"
                   10419:                       class="filename">pkgsrc/x11/kde</code>, this
                   10420:                       is likely to remove whole KDE. Works by
1.1       grant    10421:                       adding &#8220;<span class=
                   10422:                       "quote">-R</span>&#8221; to the <a href=
                   10423:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   10424:                       <span class="citerefentry"><span class=
                   10425:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   10426:                       command line.</p>
                   10427:                     </dd>
                   10428:                   </dl>
                   10429:                 </div>
                   10430:               </dd>
                   10431: 
                   10432:               <dt><span class="term">update</span></dt>
                   10433: 
                   10434:               <dd>
                   10435:                 <p>This target causes the current package to be
                   10436:                 updated to the latest version. The package and all
                   10437:                 depending packages first get de-installed, then
                   10438:                 current versions of the corresponding packages get
                   10439:                 compiled and installed. This is similar to manually
                   10440:                 noting which packages are currently installed, then
1.14      xtraeme  10441:                 performing a series of <span><strong class=
                   10442:                 "command">make deinstall</strong></span> and
                   10443:                 <span><strong class="command">make
                   10444:                 install</strong></span> (or whatever <code class=
                   10445:                 "varname">UPDATE_TARGET</code> is set to) for these
                   10446:                 packages.</p>
1.1       grant    10447: 
                   10448:                 <p>You can use the &#8220;<span class=
                   10449:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  10450:                 package updating in case a previous
                   10451:                 <span><strong class="command">make
                   10452:                 update</strong></span> was interrupted for some
                   10453:                 reason. However, in this case, make sure you don't
                   10454:                 call <span><strong class="command">make
                   10455:                 clean</strong></span> or otherwise remove the list
                   10456:                 of dependent packages in <code class=
1.47      reed     10457:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    10458:                 ability to automatically update the current package
                   10459:                 along with the dependent packages you have
                   10460:                 installed.</p>
                   10461: 
1.14      xtraeme  10462:                 <p>Resuming an interrupted <span><strong class=
                   10463:                 "command">make update</strong></span> will only
                   10464:                 work as long as the package tree remains unchanged.
                   10465:                 If the source code for one of the packages to be
                   10466:                 updated has been changed, resuming
                   10467:                 <span><strong class="command">make
                   10468:                 update</strong></span> will most certainly
                   10469:                 fail!</p>
1.1       grant    10470: 
                   10471:                 <p>The following variables can be used either on
1.45      wiz      10472:                 the command line or in <code xmlns=
                   10473:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10474:                 "filename">/etc/mk.conf</code> to alter the
                   10475:                 behaviour of <span><strong class="command">make
                   10476:                 update</strong></span>:</p>
1.1       grant    10477: 
                   10478:                 <div class="variablelist">
                   10479:                   <dl>
1.14      xtraeme  10480:                     <dt><span class="term"><code class=
                   10481:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    10482: 
                   10483:                     <dd>
                   10484:                       <p>Install target to recursively use for the
                   10485:                       updated package and the dependent packages.
1.14      xtraeme  10486:                       Defaults to <code class=
                   10487:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    10488:                       &#8220;<span class=
                   10489:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  10490:                       <span><strong class="command">make
                   10491:                       update</strong></span>. e.g.
                   10492:                       <span><strong class="command">make update
                   10493:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    10494:                     </dd>
                   10495: 
1.14      xtraeme  10496:                     <dt><span class="term"><code class=
                   10497:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    10498: 
                   10499:                     <dd>
                   10500:                       <p>Don't clean up after updating. Useful if
                   10501:                       you want to leave the work sources of the
                   10502:                       updated packages around for inspection or
                   10503:                       other purposes. Be sure you eventually clean
                   10504:                       up the source tree (see the
                   10505:                       &#8220;<span class=
                   10506:                       "quote">clean-update</span>&#8221; target
                   10507:                       below) or you may run into troubles with old
                   10508:                       source code still lying around on your next
1.14      xtraeme  10509:                       <span><strong class=
                   10510:                       "command">make</strong></span> or
                   10511:                       <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">REINSTALL</code></span></dt>
1.1       grant    10517: 
                   10518:                     <dd>
                   10519:                       <p>Deinstall each package before installing
1.14      xtraeme  10520:                       (making <code class=
                   10521:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    10522:                       necessary if the &#8220;<span class=
                   10523:                       "quote">clean-update</span>&#8221; target
                   10524:                       (see below) was called after interrupting a
1.14      xtraeme  10525:                       running <span><strong class="command">make
                   10526:                       update</strong></span>.</p>
1.1       grant    10527:                     </dd>
                   10528: 
1.14      xtraeme  10529:                     <dt><span class="term"><code class=
                   10530:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    10531: 
                   10532:                     <dd>
                   10533:                       <p>Allows you to disable recursion and
                   10534:                       hardcode the target for packages. The default
                   10535:                       is &#8220;<span class=
                   10536:                       "quote">update</span>&#8221; for the update
                   10537:                       target, facilitating a recursive update of
1.14      xtraeme  10538:                       prerequisite packages. Only set <code class=
                   10539:                       "varname">DEPENDS_TARGET</code> if you want
                   10540:                       to disable recursive updates. Use
                   10541:                       <code class="varname">UPDATE_TARGET</code>
                   10542:                       instead to just set a specific target for
                   10543:                       each package to be installed during
                   10544:                       <span><strong class="command">make
                   10545:                       update</strong></span> (see above).</p>
1.1       grant    10546:                     </dd>
                   10547:                   </dl>
                   10548:                 </div>
                   10549:               </dd>
                   10550: 
                   10551:               <dt><span class="term">clean-update</span></dt>
                   10552: 
                   10553:               <dd>
                   10554:                 <p>Clean the source tree for all packages that
1.14      xtraeme  10555:                 would get updated if <span><strong class=
                   10556:                 "command">make update</strong></span> was called
                   10557:                 from the current directory. This target should not
                   10558:                 be used if the current package (or any of its
                   10559:                 depending packages) have already been de-installed
                   10560:                 (e.g., after calling <span><strong class=
                   10561:                 "command">make update</strong></span>) or you may
                   10562:                 lose some packages you intended to update. As a
                   10563:                 rule of thumb: only use this target <span class=
                   10564:                 "emphasis"><em>before</em></span> the first time
                   10565:                 you run <span><strong class="command">make
                   10566:                 update</strong></span> and only if you have a dirty
                   10567:                 package tree (e.g., if you used <code class=
                   10568:                 "varname">NOCLEAN</code>).</p>
1.1       grant    10569: 
1.47      reed     10570:                 <p>If you are unsure about whether your tree is
                   10571:                 clean, you can either perform a
1.14      xtraeme  10572:                 <span><strong class="command">make
1.47      reed     10573:                 clean</strong></span> at the top of the tree, or
                   10574:                 use the following sequence of commands from the
                   10575:                 directory of the package you want to update
                   10576:                 (<span class="emphasis"><em>before</em></span>
                   10577:                 running <span><strong class="command">make
1.14      xtraeme  10578:                 update</strong></span> for the first time,
                   10579:                 otherwise you lose all the packages you wanted to
                   10580:                 update!):</p>
1.1       grant    10581:                 <pre class="screen">
1.14      xtraeme  10582: <code class="prompt">#</code> <strong class=
                   10583: "userinput"><code>make clean-update</code></strong>
                   10584: <code class="prompt">#</code> <strong class=
                   10585: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   10586: <code class="prompt">#</code> <strong class=
                   10587: "userinput"><code>make update</code></strong>
1.1       grant    10588: </pre>
                   10589: 
                   10590:                 <p>The following variables can be used either on
1.45      wiz      10591:                 the command line or in <code xmlns=
                   10592:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10593:                 "filename">/etc/mk.conf</code> to alter the
                   10594:                 behaviour of <span><strong class="command">make
                   10595:                 clean-update</strong></span>:</p>
1.1       grant    10596: 
                   10597:                 <div class="variablelist">
                   10598:                   <dl>
1.14      xtraeme  10599:                     <dt><span class="term"><code class=
                   10600:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    10601: 
                   10602:                     <dd>
1.14      xtraeme  10603:                       <p>After <span><strong class="command">make
                   10604:                       clean</strong></span>, do not reconstruct the
                   10605:                       list of directories to update for this
                   10606:                       package. Only use this if
                   10607:                       <span><strong class="command">make
                   10608:                       update</strong></span> successfully installed
                   10609:                       all packages you wanted to update. Normally,
                   10610:                       this is done automatically on
                   10611:                       <span><strong class="command">make
                   10612:                       update</strong></span>, but may have been
                   10613:                       suppressed by the <code class=
                   10614:                       "varname">NOCLEAN</code> variable (see
1.1       grant    10615:                       above).</p>
                   10616:                     </dd>
                   10617:                   </dl>
                   10618:                 </div>
                   10619:               </dd>
                   10620: 
                   10621:               <dt><span class="term">info</span></dt>
                   10622: 
                   10623:               <dd>
                   10624:                 <p>This target invokes <a href=
                   10625:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   10626:                 <span class="citerefentry"><span class=
                   10627:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   10628:                 the current package. You can use this to check
                   10629:                 which version of a package is installed.</p>
                   10630:               </dd>
                   10631: 
                   10632:               <dt><span class="term">readme</span></dt>
                   10633: 
                   10634:               <dd>
1.45      wiz      10635:                 <p>This target generates a <code xmlns=
                   10636:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10637:                 "filename">README.html</code> file, which can be
1.1       grant    10638:                 viewed using a browser such as <a xmlns=
                   10639:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10640:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      10641:                 target="_top"><code xmlns="" class=
                   10642:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      10643:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10644:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      10645:                 target="_top"><code xmlns="" class=
                   10646:                 "filename">www/links</code></a>. The generated
                   10647:                 files contain references to any packages which are
                   10648:                 in the <code class="varname">PACKAGES</code>
                   10649:                 directory on the local host. The generated files
                   10650:                 can be made to refer to URLs based on <code class=
1.20      ben      10651:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   10652:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      10653:                 wanted to generate <code xmlns=
                   10654:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      10655:                 "filename">README.html</code> files which pointed
                   10656:                 to binary packages on the local machine, in the
1.45      wiz      10657:                 directory <code xmlns=
                   10658:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      10659:                 "filename">/usr/packages</code>, set <code class=
                   10660:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   10661:                 and <code class=
                   10662:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   10663:                 <code class="varname">${PACKAGES}</code> directory
                   10664:                 and its subdirectories will be searched for all the
                   10665:                 binary packages.</p>
1.1       grant    10666:               </dd>
                   10667: 
                   10668:               <dt><span class="term">readme-all</span></dt>
                   10669: 
                   10670:               <dd>
1.45      wiz      10671:                 <p>Use this target to create a file <code xmlns=
                   10672:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10673:                 "filename">README-all.html</code> which contains a
1.1       grant    10674:                 list of all packages currently available in the
                   10675:                 NetBSD Packages Collection, together with the
                   10676:                 category they belong to and a short description.
1.45      wiz      10677:                 This file is compiled from the <code xmlns=
                   10678:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10679:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    10680:                 sure to run this <span class=
1.14      xtraeme  10681:                 "emphasis"><em>after</em></span> a
                   10682:                 <span><strong class="command">make
                   10683:                 readme</strong></span>.</p>
1.1       grant    10684:               </dd>
                   10685: 
                   10686:               <dt><span class="term">cdrom-readme</span></dt>
                   10687: 
                   10688:               <dd>
                   10689:                 <p>This is very much the same as the
                   10690:                 &#8220;<span class="quote">readme</span>&#8221;
                   10691:                 target (see above), but is to be used when
                   10692:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      10693:                 This target also produces <code xmlns=
                   10694:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10695:                 "filename">README.html</code> files, and can be
                   10696:                 made to refer to URLs based on <code class=
                   10697:                 "varname">CDROM_PKG_URL_HOST</code> and
                   10698:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    10699:               </dd>
                   10700: 
                   10701:               <dt><span class="term">show-distfiles</span></dt>
                   10702: 
                   10703:               <dd>
                   10704:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  10705:                 are needed to build the package. (<code class=
                   10706:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      10707:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   10708:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10709:                 "filename">patches/*</code>)</p>
1.1       grant    10710:               </dd>
                   10711: 
                   10712:               <dt><span class="term">show-downlevel</span></dt>
                   10713: 
                   10714:               <dd>
                   10715:                 <p>This target shows nothing if the package is not
                   10716:                 installed. If a version of this package is
                   10717:                 installed, but is not the version provided in this
                   10718:                 version of pkgsrc, then a warning message is
                   10719:                 displayed. This target can be used to show which of
                   10720:                 your installed packages are downlevel, and so the
                   10721:                 old versions can be deleted, and the current ones
                   10722:                 added.</p>
                   10723:               </dd>
                   10724: 
                   10725:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   10726: 
                   10727:               <dd>
                   10728:                 <p>This target shows the directory in the pkgsrc
                   10729:                 hierarchy from which the package can be built and
                   10730:                 installed. This may not be the same directory as
                   10731:                 the one from which the package was installed. This
                   10732:                 target is intended to be used by people who may
                   10733:                 wish to upgrade many packages on a single host, and
                   10734:                 can be invoked from the top-level pkgsrc Makefile
                   10735:                 by using the &#8220;<span class=
                   10736:                 "quote">show-host-specific-pkgs</span>&#8221;
                   10737:                 target.</p>
                   10738:               </dd>
                   10739: 
                   10740:               <dt><span class=
                   10741:               "term">show-installed-depends</span></dt>
                   10742: 
                   10743:               <dd>
                   10744:                 <p>This target shows which installed packages match
1.14      xtraeme  10745:                 the current package's <code class=
                   10746:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    10747:                 dependencies are causing build problems.</p>
                   10748:               </dd>
                   10749: 
                   10750:               <dt><span class="term">check-shlibs</span></dt>
                   10751: 
                   10752:               <dd>
                   10753:                 <p>After a package is installed, check all its
                   10754:                 binaries and (on ELF platforms) shared libraries to
                   10755:                 see if they find the shared libs they need. Run by
1.14      xtraeme  10756:                 default if <code class=
                   10757:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      10758:                 <code xmlns=
                   10759:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10760:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    10761:               </dd>
                   10762: 
                   10763:               <dt><span class="term">print-PLIST</span></dt>
                   10764: 
                   10765:               <dd>
                   10766:                 <p>After a &#8220;<span class="quote">make
                   10767:                 install</span>&#8221; from a new or upgraded pkg,
                   10768:                 this prints out an attempt to generate a new
1.45      wiz      10769:                 <code xmlns=
                   10770:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10771:                 "filename">PLIST</code> from a <span><strong class=
                   10772:                 "command">find -newer
1.14      xtraeme  10773:                 work/.extract_done</strong></span>. An attempt is
                   10774:                 made to care for shared libs etc., but it is
1.1       grant    10775:                 <span class="emphasis"><em>strongly</em></span>
                   10776:                 recommended to review the result before putting it
1.45      wiz      10777:                 into <code xmlns=
                   10778:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10779:                 "filename">PLIST</code>. On upgrades, it's useful
                   10780:                 to diff the output of this command against an
                   10781:                 already existing <code xmlns=
                   10782:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10783:                 "filename">PLIST</code> file.</p>
1.1       grant    10784: 
1.24      wiz      10785:                 <p>If the package installs files via <a href=
                   10786:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   10787:                 <span class="citerefentry"><span class=
                   10788:                 "refentrytitle">tar</span>(1)</span></a> or other
                   10789:                 methods that don't update file access times, be
                   10790:                 sure to add these files manually to your
1.45      wiz      10791:                 <code xmlns=
                   10792:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10793:                 "filename">PLIST</code>, as the &#8220;<span class=
                   10794:                 "quote">find -newer</span>&#8221; command used by
                   10795:                 this target won't catch them!</p>
1.1       grant    10796: 
                   10797:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    10798:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  10799:                 &#8220;Tweaking output of <span><strong class=
                   10800:                 "command">make
                   10801:                 print-PLIST</strong></span>&#8221;</a> for more
                   10802:                 information on this target.</p>
1.1       grant    10803:               </dd>
                   10804: 
                   10805:               <dt><span class="term">bulk-package</span></dt>
                   10806: 
                   10807:               <dd>
                   10808:                 <p>Used to do bulk builds. If an appropriate binary
                   10809:                 package already exists, no action is taken. If not,
                   10810:                 this target will compile, install and package it
1.47      reed     10811:                 (and its depends, if <code class=
1.14      xtraeme  10812:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    10813:                 <a href="#binary.configuration" title=
1.38      dillo    10814:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     10815:                 &#8220;Configuration&#8221;</a>). After creating
                   10816:                 the binary package, the sources, the just-installed
                   10817:                 package and its required packages are removed,
1.1       grant    10818:                 preserving free disk space.</p>
                   10819: 
                   10820:                 <p><span class="emphasis"><em>Beware that this
                   10821:                 target may deinstall all packages installed on a
                   10822:                 system!</em></span></p>
                   10823:               </dd>
                   10824: 
                   10825:               <dt><span class="term">bulk-install</span></dt>
                   10826: 
                   10827:               <dd>
                   10828:                 <p>Used during bulk-installs to install required
1.47      reed     10829:                 packages. If an up-to-date binary package is
1.1       grant    10830:                 available, it will be installed via <a href=
                   10831:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   10832:                 <span class="citerefentry"><span class=
                   10833:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  10834:                 not, <span><strong class="command">make
                   10835:                 bulk-package</strong></span> will be executed, but
1.47      reed     10836:                 the installed binary won't be removed.</p>
1.1       grant    10837: 
                   10838:                 <p>A binary package is considered
1.47      reed     10839:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    10840:                 to be installed via <a href=
                   10841:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   10842:                 <span class="citerefentry"><span class=
                   10843:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   10844:                 if:</p>
                   10845: 
                   10846:                 <div class="itemizedlist">
                   10847:                   <ul type="disc">
                   10848:                     <li>
1.45      wiz      10849:                       <p>None of the package's files (<code xmlns=
                   10850:                       "http://www.w3.org/TR/xhtml1/transitional"
                   10851:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  10852:                       modified since it was built.</p>
1.1       grant    10853:                     </li>
                   10854: 
                   10855:                     <li>
                   10856:                       <p>None of the package's required (binary)
                   10857:                       packages were modified since it was
                   10858:                       built.</p>
                   10859:                     </li>
                   10860:                   </ul>
                   10861:                 </div>
                   10862: 
                   10863:                 <p><span class="emphasis"><em>Beware that this
                   10864:                 target may deinstall all packages installed on a
                   10865:                 system!</em></span></p>
                   10866:               </dd>
                   10867:             </dl>
                   10868:           </div>
                   10869:         </div>
                   10870:       </div>
                   10871: 
                   10872:       <div class="chapter" lang="en" xml:lang="en">
                   10873:         <div class="titlepage">
                   10874:           <div>
                   10875:             <div>
                   10876:               <h2 class="title"><a name="fixes" id=
1.38      dillo    10877:               "fixes"></a>Chapter&nbsp;15.&nbsp;Notes on fixes for
1.1       grant    10878:               packages</h2>
                   10879:             </div>
                   10880:           </div>
                   10881:         </div>
                   10882: 
                   10883:         <div class="toc">
                   10884:           <p><b>Table of Contents</b></p>
                   10885: 
                   10886:           <dl>
1.30      wiz      10887:             <dt><span class="sect1"><a href=
1.38      dillo    10888:             "#general-operation">15.1. General
1.30      wiz      10889:             operation</a></span></dt>
1.1       grant    10890: 
                   10891:             <dd>
                   10892:               <dl>
                   10893:                 <dt><span class="sect2"><a href=
1.38      dillo    10894:                 "#pulling-vars-from-etc-mk.conf">15.1.1. How to
1.30      wiz      10895:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    10896: 
                   10897:                 <dt><span class="sect2"><a href=
1.38      dillo    10898:                 "#where-to-install-documentation">15.1.2. Where to
1.31      wiz      10899:                 install documentation</a></span></dt>
                   10900: 
                   10901:                 <dt><span class="sect2"><a href=
1.38      dillo    10902:                 "#restricted-packages">15.1.3. Restricted
1.1       grant    10903:                 packages</a></span></dt>
                   10904: 
                   10905:                 <dt><span class="sect2"><a href=
1.38      dillo    10906:                 "#dependencies">15.1.4. Handling
1.1       grant    10907:                 dependencies</a></span></dt>
                   10908: 
                   10909:                 <dt><span class="sect2"><a href=
1.38      dillo    10910:                 "#conflicts">15.1.5. Handling conflicts with other
1.1       grant    10911:                 packages</a></span></dt>
                   10912: 
                   10913:                 <dt><span class="sect2"><a href=
1.38      dillo    10914:                 "#not-building-packages">15.1.6. Packages that
1.30      wiz      10915:                 cannot or should not be built</a></span></dt>
1.1       grant    10916: 
                   10917:                 <dt><span class="sect2"><a href=
1.38      dillo    10918:                 "#undeletable-packages">15.1.7. Packages which
1.30      wiz      10919:                 should not be deleted, once
                   10920:                 installed</a></span></dt>
1.1       grant    10921: 
                   10922:                 <dt><span class="sect2"><a href=
1.38      dillo    10923:                 "#security-handling">15.1.8. Handling packages with
1.1       grant    10924:                 security problems</a></span></dt>
                   10925: 
                   10926:                 <dt><span class="sect2"><a href=
1.38      dillo    10927:                 "#compiler-bugs">15.1.9. How to handle compiler
1.1       grant    10928:                 bugs</a></span></dt>
                   10929: 
                   10930:                 <dt><span class="sect2"><a href=
1.38      dillo    10931:                 "#bumping-pkgrevision">15.1.10. How to handle
1.30      wiz      10932:                 incrementing versions when fixing an existing
1.1       grant    10933:                 package</a></span></dt>
                   10934: 
                   10935:                 <dt><span class="sect2"><a href=
1.38      dillo    10936:                 "#portability-of-packages">15.1.11. Portability of
1.1       grant    10937:                 packages</a></span></dt>
                   10938:               </dl>
                   10939:             </dd>
                   10940: 
1.30      wiz      10941:             <dt><span class="sect1"><a href=
1.38      dillo    10942:             "#downloading-issues">15.2. Possible downloading
1.30      wiz      10943:             issues</a></span></dt>
1.1       grant    10944: 
                   10945:             <dd>
                   10946:               <dl>
                   10947:                 <dt><span class="sect2"><a href=
1.38      dillo    10948:                 "#no-plain-download">15.2.1. Packages whose
1.30      wiz      10949:                 distfiles aren't available for plain
1.1       grant    10950:                 downloading</a></span></dt>
                   10951: 
                   10952:                 <dt><span class="sect2"><a href=
1.38      dillo    10953:                 "#modified-distfiles-same-name">15.2.2. How to
1.30      wiz      10954:                 handle modified distfiles with the 'old'
                   10955:                 name</a></span></dt>
1.1       grant    10956:               </dl>
                   10957:             </dd>
                   10958: 
1.30      wiz      10959:             <dt><span class="sect1"><a href=
1.38      dillo    10960:             "#configuration-gotchas">15.3. Configuration
1.30      wiz      10961:             gotchas</a></span></dt>
1.1       grant    10962: 
                   10963:             <dd>
                   10964:               <dl>
                   10965:                 <dt><span class="sect2"><a href=
1.38      dillo    10966:                 "#fixes.libtool">15.3.1. Shared libraries -
1.1       grant    10967:                 libtool</a></span></dt>
                   10968: 
                   10969:                 <dt><span class="sect2"><a href=
1.38      dillo    10970:                 "#using-libtool">15.3.2. Using libtool on GNU
1.30      wiz      10971:                 packages that already support
                   10972:                 libtool</a></span></dt>
1.1       grant    10973: 
                   10974:                 <dt><span class="sect2"><a href=
1.38      dillo    10975:                 "#autoconf-automake">15.3.3. GNU
1.1       grant    10976:                 Autoconf/Automake</a></span></dt>
                   10977:               </dl>
                   10978:             </dd>
                   10979: 
1.30      wiz      10980:             <dt><span class="sect1"><a href=
1.38      dillo    10981:             "#building-considerations">15.4. Building
1.30      wiz      10982:             considerations</a></span></dt>
1.1       grant    10983: 
                   10984:             <dd>
                   10985:               <dl>
                   10986:                 <dt><span class="sect2"><a href=
1.38      dillo    10987:                 "#cpp-defines">15.4.1. CPP defines</a></span></dt>
1.1       grant    10988:               </dl>
                   10989:             </dd>
                   10990: 
1.30      wiz      10991:             <dt><span class="sect1"><a href=
1.38      dillo    10992:             "#package-specific-actions">15.5. Package specific
1.30      wiz      10993:             actions</a></span></dt>
1.1       grant    10994: 
                   10995:             <dd>
                   10996:               <dl>
                   10997:                 <dt><span class="sect2"><a href=
1.38      dillo    10998:                 "#user-interaction">15.5.1. User
1.2       hubertf  10999:                 interaction</a></span></dt>
1.1       grant    11000: 
                   11001:                 <dt><span class="sect2"><a href=
1.38      dillo    11002:                 "#handling-licenses">15.5.2. Handling
1.1       grant    11003:                 licenses</a></span></dt>
                   11004: 
                   11005:                 <dt><span class="sect2"><a href=
1.38      dillo    11006:                 "#installing-score-files">15.5.3. Installing score
1.1       grant    11007:                 files</a></span></dt>
                   11008: 
                   11009:                 <dt><span class="sect2"><a href=
1.38      dillo    11010:                 "#perl-scripts">15.5.4. Packages containing perl
1.1       grant    11011:                 scripts</a></span></dt>
                   11012: 
                   11013:                 <dt><span class="sect2"><a href=
1.38      dillo    11014:                 "#hardcoded-paths">15.5.5. Packages with hardcoded
1.30      wiz      11015:                 paths to other interpreters</a></span></dt>
1.1       grant    11016: 
                   11017:                 <dt><span class="sect2"><a href=
1.38      dillo    11018:                 "#perl-modules">15.5.6. Packages installing perl
1.1       grant    11019:                 modules</a></span></dt>
                   11020: 
                   11021:                 <dt><span class="sect2"><a href=
1.38      dillo    11022:                 "#faq.info-files">15.5.7. Packages installing info
1.1       grant    11023:                 files</a></span></dt>
                   11024: 
                   11025:                 <dt><span class="sect2"><a href=
1.38      dillo    11026:                 "#gconf2-data-files">15.5.8. Packages installing
1.30      wiz      11027:                 GConf2 data files</a></span></dt>
1.1       grant    11028: 
                   11029:                 <dt><span class="sect2"><a href=
1.38      dillo    11030:                 "#scrollkeeper-data-files">15.5.9. Packages
1.30      wiz      11031:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    11032: 
                   11033:                 <dt><span class="sect2"><a href=
1.38      dillo    11034:                 "#x11-fonts">15.5.10. Packages installing X11
1.1       grant    11035:                 fonts</a></span></dt>
                   11036: 
                   11037:                 <dt><span class="sect2"><a href=
1.38      dillo    11038:                 "#gtk2-modules">15.5.11. Packages installing GTK2
1.1       grant    11039:                 modules</a></span></dt>
                   11040: 
                   11041:                 <dt><span class="sect2"><a href=
1.38      dillo    11042:                 "#sgml-xml-data">15.5.12. Packages installing SGML
1.30      wiz      11043:                 or XML data</a></span></dt>
1.1       grant    11044: 
                   11045:                 <dt><span class="sect2"><a href=
1.38      dillo    11046:                 "#mime-database">15.5.13. Packages installing
1.1       grant    11047:                 extensions to the MIME database</a></span></dt>
                   11048: 
                   11049:                 <dt><span class="sect2"><a href=
1.38      dillo    11050:                 "#intltool">15.5.14. Packages using
1.1       grant    11051:                 intltool</a></span></dt>
1.18      xtraeme  11052: 
                   11053:                 <dt><span class="sect2"><a href=
1.38      dillo    11054:                 "#startup-scripts">15.5.15. Packages installing
1.30      wiz      11055:                 startup scripts</a></span></dt>
1.1       grant    11056:               </dl>
                   11057:             </dd>
                   11058: 
1.30      wiz      11059:             <dt><span class="sect1"><a href=
1.38      dillo    11060:             "#feedback-to-author">15.6. Feedback to the
1.30      wiz      11061:             author</a></span></dt>
1.1       grant    11062:           </dl>
                   11063:         </div>
                   11064: 
                   11065:         <div class="sect1" lang="en" xml:lang="en">
                   11066:           <div class="titlepage">
                   11067:             <div>
                   11068:               <div>
                   11069:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11070:                 "general-operation" id=
1.38      dillo    11071:                 "general-operation"></a>15.1.&nbsp;General
1.1       grant    11072:                 operation</h2>
                   11073:               </div>
                   11074:             </div>
                   11075:           </div>
                   11076: 
                   11077:           <div class="sect2" lang="en" xml:lang="en">
                   11078:             <div class="titlepage">
                   11079:               <div>
                   11080:                 <div>
1.30      wiz      11081:                   <h3 class="title"><a name=
                   11082:                   "pulling-vars-from-etc-mk.conf" id=
1.38      dillo    11083:                   "pulling-vars-from-etc-mk.conf"></a>15.1.1.&nbsp;How
1.30      wiz      11084:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    11085:                 </div>
                   11086:               </div>
                   11087:             </div>
                   11088: 
                   11089:             <p>The problem with package-defined variables that can
1.14      xtraeme  11090:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      11091:             or <code xmlns=
                   11092:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11093:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    11094:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   11095:             <span class="citerefentry"><span class=
                   11096:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     11097:             variable as it is used, but evaluates preprocessor-like
1.1       grant    11098:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  11099:             So, to use any variable (which may be set in
1.45      wiz      11100:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11101:             class="filename">/etc/mk.conf</code>) in one of the
                   11102:             .if* statements, the file <code xmlns=
                   11103:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11104:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    11105:             that .if* statement.</p>
                   11106: 
1.47      reed     11107:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      11108:             including <code xmlns=
                   11109:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11110:             "filename">/etc/mk.conf</code>, should it exist, or
                   11111:             <code class="varname">MAKECONF</code>, should it exist,
                   11112:             include the <code xmlns=
                   11113:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   11114:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   11115:             package Makefile before any preprocessor-like .if,
                   11116:             .ifdef, or .ifndef statements:</p>
1.1       grant    11117:             <pre class="programlisting">
                   11118: .include "../../mk/bsd.prefs.mk"
                   11119:     
                   11120:     .if defined(USE_MENUS)
                   11121:       ...
                   11122:     .endif
                   11123: </pre>
                   11124: 
1.14      xtraeme  11125:             <p>If you wish to set the <code class=
1.45      wiz      11126:             "varname">CFLAGS</code> variable in <code xmlns=
                   11127:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     11128:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    11129:             use:</p>
                   11130:             <pre class="programlisting">
                   11131: CFLAGS+=  -your -flags
                   11132: </pre>
                   11133: 
1.14      xtraeme  11134:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   11135:             without the &#8220;<span class="quote">+</span>&#8221;)
                   11136:             may lead to problems with packages that need to add
                   11137:             their own flags. Also, you may want to take a look at
                   11138:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    11139:             href=
                   11140:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      11141:             target="_top"><code xmlns="" class=
                   11142:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      11143:             interested in optimization for the current CPU.</p>
1.1       grant    11144:           </div>
                   11145: 
                   11146:           <div class="sect2" lang="en" xml:lang="en">
                   11147:             <div class="titlepage">
                   11148:               <div>
                   11149:                 <div>
1.31      wiz      11150:                   <h3 class="title"><a name=
                   11151:                   "where-to-install-documentation" id=
1.38      dillo    11152:                   "where-to-install-documentation"></a>15.1.2.&nbsp;Where
1.31      wiz      11153:                   to install documentation</h3>
                   11154:                 </div>
                   11155:               </div>
                   11156:             </div>
                   11157: 
1.45      wiz      11158:             <p>Documentation should be installed into <code xmlns=
                   11159:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      11160:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      11161:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11162:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   11163:             (the latter includes the version number of the
                   11164:             package).</p>
1.31      wiz      11165:           </div>
                   11166: 
                   11167:           <div class="sect2" lang="en" xml:lang="en">
                   11168:             <div class="titlepage">
                   11169:               <div>
                   11170:                 <div>
1.30      wiz      11171:                   <h3 class="title"><a name="restricted-packages"
                   11172:                   id=
1.38      dillo    11173:                   "restricted-packages"></a>15.1.3.&nbsp;Restricted
1.1       grant    11174:                   packages</h3>
                   11175:                 </div>
                   11176:               </div>
                   11177:             </div>
                   11178: 
                   11179:             <p>Some licenses restrict how software may be
                   11180:             re-distributed. In order to satisfy these restrictions,
                   11181:             the package system defines five make variables that can
                   11182:             be set to note these restrictions:</p>
                   11183: 
                   11184:             <div class="itemizedlist">
                   11185:               <ul type="disc">
                   11186:                 <li>
1.14      xtraeme  11187:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    11188: 
                   11189:                   <p>This variable should be set whenever a
                   11190:                   restriction exists (regardless of its kind). Set
                   11191:                   this variable to a string containing the reason
                   11192:                   for the restriction.</p>
                   11193:                 </li>
                   11194: 
                   11195:                 <li>
1.14      xtraeme  11196:                   <p><code class=
                   11197:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    11198: 
                   11199:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  11200:                   variable to <code class=
                   11201:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11202:                   package may not be included on a CD-ROM.</p>
                   11203:                 </li>
                   11204: 
                   11205:                 <li>
1.14      xtraeme  11206:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    11207: 
                   11208:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  11209:                   Set this variable to <code class=
                   11210:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    11211:                   package may not not be made available on the
                   11212:                   Internet.</p>
                   11213:                 </li>
                   11214: 
                   11215:                 <li>
1.14      xtraeme  11216:                   <p><code class=
                   11217:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    11218: 
                   11219:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  11220:                   this variable to <code class=
                   11221:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11222:                   of the source code or other distfile(s) is not
                   11223:                   allowed on CD-ROMs.</p>
                   11224:                 </li>
                   11225: 
                   11226:                 <li>
1.14      xtraeme  11227:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    11228: 
                   11229:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  11230:                   variable to <code class=
                   11231:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    11232:                   of the source code or other distfile(s) via the
                   11233:                   Internet is not allowed.</p>
                   11234:                 </li>
                   11235:               </ul>
                   11236:             </div>
                   11237: 
1.14      xtraeme  11238:             <p>Please note that the use of <code class=
                   11239:             "varname">NO_PACKAGE</code>, <code class=
                   11240:             "varname">IGNORE</code>, <code class=
                   11241:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    11242:             variables to denote restrictions is deprecated, because
                   11243:             they unconditionally prevent users from generating
                   11244:             binary packages!</p>
                   11245:           </div>
                   11246: 
                   11247:           <div class="sect2" lang="en" xml:lang="en">
                   11248:             <div class="titlepage">
                   11249:               <div>
                   11250:                 <div>
                   11251:                   <h3 class="title"><a name="dependencies" id=
1.38      dillo    11252:                   "dependencies"></a>15.1.4.&nbsp;Handling
1.1       grant    11253:                   dependencies</h3>
                   11254:                 </div>
                   11255:               </div>
                   11256:             </div>
                   11257: 
                   11258:             <p>Your package may depend on some other package being
                   11259:             present - and there are various ways of expressing this
1.14      xtraeme  11260:             dependency. pkgsrc supports the <code class=
                   11261:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     11262:             "varname">DEPENDS</code> definitions, the <code class=
                   11263:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      11264:             dependencies via <code xmlns=
                   11265:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11266:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    11267:             way to handle dependencies, and which uses the
                   11268:             variables named above. See <a href="#buildlink" title=
1.38      dillo    11269:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    11270:             <i>Buildlink methodology</i></a> for more
                   11271:             information.</p>
                   11272: 
                   11273:             <p>The basic difference between the two variables is as
1.14      xtraeme  11274:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    11275:             definition registers that pre-requisite in the binary
                   11276:             package so it will be pulled in when the binary package
1.14      xtraeme  11277:             is later installed, whilst the <code class=
                   11278:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    11279:             marking a dependency that is only needed for building
                   11280:             the package.</p>
                   11281: 
                   11282:             <p>This means that if you only need a package present
                   11283:             whilst you are building, it should be noted as a
1.14      xtraeme  11284:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    11285: 
1.14      xtraeme  11286:             <p>The format for a <code class=
                   11287:             "varname">BUILD_DEPENDS</code> and a <code class=
                   11288:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    11289:             <pre class="programlisting">
                   11290: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   11291: </pre>
                   11292: 
                   11293:             <p>Please note that the &#8220;<span class=
                   11294:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  11295:             any of the wildcard version numbers recognized by
1.1       grant    11296:             <a href=
                   11297:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11298:             <span class="citerefentry"><span class=
                   11299:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   11300: 
                   11301:             <div class="orderedlist">
                   11302:               <ol type="1">
                   11303:                 <li>
                   11304:                   <p>If your package needs another package's
                   11305:                   binaries or libraries to build or run, and if
1.45      wiz      11306:                   that package has a <code xmlns=
                   11307:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11308:                   "filename">buildlink3.mk</code> file available,
                   11309:                   use it:</p>
1.1       grant    11310:                   <pre class="programlisting">
                   11311:     .include "../../graphics/jpeg/buildlink3.mk"
                   11312:     
                   11313: </pre>
                   11314:                 </li>
                   11315: 
                   11316:                 <li>
                   11317:                   <p>If your package needs to use another package
1.45      wiz      11318:                   to build itself and there is no <code xmlns=
                   11319:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11320:                   "filename">buildlink3.mk</code> file available,
                   11321:                   use the <code class=
                   11322:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    11323:                   <pre class="programlisting">
                   11324: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   11325: </pre>
                   11326:                 </li>
                   11327: 
                   11328:                 <li>
                   11329:                   <p>If your package needs a library with which to
1.45      wiz      11330:                   link and again there is no <code xmlns=
                   11331:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11332:                   "filename">buildlink3.mk</code> file available,
                   11333:                   this is specified using the <code class=
                   11334:                   "varname">DEPENDS</code> definition. An example
                   11335:                   of this is the <a xmlns=
1.1       grant    11336:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11337:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11338:                   target="_top"><code xmlns="" class=
                   11339:                   "filename">print/lyx</code></a> package, which
                   11340:                   uses the xpm library, version 3.4j to build:</p>
1.1       grant    11341:                   <pre class="programlisting">
                   11342: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   11343: </pre>
                   11344: 
                   11345:                   <p>You can also use wildcards in package
                   11346:                   dependences:</p>
                   11347:                   <pre class="programlisting">
                   11348: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   11349: </pre>
                   11350: 
                   11351:                   <p>Note that such wildcard dependencies are
                   11352:                   retained when creating binary packages. The
                   11353:                   dependency is checked when installing the binary
                   11354:                   package and any package which matches the pattern
                   11355:                   will be used. Wildcard dependencies should be
                   11356:                   used with care.</p>
                   11357: 
                   11358:                   <p>The &#8220;<span class=
                   11359:                   "quote">-[0-9]*</span>&#8221; should be used
                   11360:                   instead of &#8220;<span class=
                   11361:                   "quote">-*</span>&#8221; to avoid potentially
                   11362:                   ambiguous matches such as &#8220;<span class=
                   11363:                   "quote">tk-postgresql</span>&#8221; matching a
                   11364:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  11365:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    11366: 
                   11367:                   <p>Wildcards can also be used to specify that a
                   11368:                   package will only build against a certain minimum
                   11369:                   version of a pre-requisite:</p>
                   11370:                   <pre class="programlisting">
                   11371: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   11372: </pre>
                   11373: 
                   11374:                   <p>This means that the package will build against
                   11375:                   version 3.5.4 of the tiff library or newer. Such
                   11376:                   a dependency may be warranted if, for example,
                   11377:                   the API of the library has changed with version
                   11378:                   3.5.4 and a package would not compile against an
                   11379:                   earlier version of tiff.</p>
                   11380: 
                   11381:                   <p>Please note that such dependencies should only
                   11382:                   be updated if a package requires a newer
                   11383:                   pre-requisite, but not to denote recommendations
                   11384:                   such as security updates or ABI changes that do
                   11385:                   not prevent a package from building correctly.
                   11386:                   Such recommendations can be expressed using
1.14      xtraeme  11387:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    11388:                   <pre class="programlisting">
                   11389: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   11390: </pre>
                   11391: 
1.14      xtraeme  11392:                   <p>In addition to the above <code class=
                   11393:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    11394:                   while a package will build against
                   11395:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  11396:                   recommended. <code class=
                   11397:                   "varname">RECOMMENDED</code> entries will be
                   11398:                   turned into dependencies unless explicitly
                   11399:                   ignored (in which case a warning will be
1.36      wiz      11400:                   printed).</p>
                   11401: 
                   11402:                   <p>To ignore these dependency recommendations and
                   11403:                   just use the required <code class=
                   11404:                   "varname">DEPENDS</code>, set <code class=
                   11405:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   11406:                   make it easier and faster to update packages
                   11407:                   built using pkgsrc, since older compatible
                   11408:                   dependencies can continue to be used. This is
                   11409:                   useful for people who watch their rebuilds very
                   11410:                   carefully; it is not very good as a
                   11411:                   general-purpose hammer. If you use it, you need
                   11412:                   to be mindful of possible ABI changes, including
                   11413:                   those from the underlying OS.</p>
                   11414: 
                   11415:                   <p>Packages that are built with recommendations
                   11416:                   ignored may not be uploaded to ftp.NetBSD.org by
                   11417:                   developers and should not be used across
                   11418:                   different systems that may have different
                   11419:                   versions of binary packages installed.</p>
1.1       grant    11420: 
                   11421:                   <p>For security fixes, please update the package
                   11422:                   vulnerabilities file as well as setting
1.14      xtraeme  11423:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    11424:                   <a href="#security-handling" title=
1.38      dillo    11425:                   "15.1.8.&nbsp;Handling packages with security problems">
                   11426:                   Section 15.1.8, &#8220;Handling packages with
1.1       grant    11427:                   security problems&#8221;</a> for more
                   11428:                   information.</p>
                   11429:                 </li>
                   11430: 
                   11431:                 <li>
                   11432:                   <p>If your package needs some executable to be
1.17      sketch   11433:                   able to run correctly and if there's no
1.45      wiz      11434:                   <code xmlns=
                   11435:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   11436:                   "filename">buildlink3.mk</code> file, this is
                   11437:                   specified using the <code class=
1.14      xtraeme  11438:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    11439:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   11440:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      11441:                   target="_top"><code xmlns="" class=
                   11442:                   "filename">print/lyx</code></a> package needs to
                   11443:                   be able to execute the latex binary from the
                   11444:                   teTeX package when it runs, and that is
                   11445:                   specified:</p>
1.1       grant    11446:                   <pre class="programlisting">
                   11447: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   11448: </pre>
                   11449: 
                   11450:                   <p>The comment about wildcard dependencies from
                   11451:                   previous paragraph applies here, too.</p>
                   11452:                 </li>
                   11453:               </ol>
                   11454:             </div>
                   11455: 
                   11456:             <p>If your package needs files from another package to
                   11457:             build, see the first part of the &#8220;<span class=
                   11458:             "quote">do-configure</span>&#8221; target <a xmlns=
                   11459:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11460:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.45      wiz      11461:             target="_top"><code xmlns="" class=
                   11462:             "filename">print/ghostscript5</code></a> package (it
1.20      ben      11463:             relies on the jpeg sources being present in source form
                   11464:             during the build):</p>
1.1       grant    11465:             <pre class="programlisting">
                   11466: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   11467:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   11468:     fi
                   11469: </pre>
                   11470: 
                   11471:             <p>If you build any other packages that way, please
                   11472:             make sure the working files are deleted too when this
                   11473:             package's working files are cleaned up. The easiest way
                   11474:             to do so is by adding a pre-clean target:</p>
                   11475:             <pre class="programlisting">
                   11476: pre-clean:
                   11477:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   11478: </pre>
                   11479: 
1.14      xtraeme  11480:             <p>Please also note the <code class=
                   11481:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   11482:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   11483:             which are provided as convenience definitions. The
1.24      wiz      11484:             former works out whether <a href=
                   11485:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   11486:             <span class="citerefentry"><span class=
                   11487:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   11488:             the base system, and, if it isn't, installs the
                   11489:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11490:             href=
1.1       grant    11491:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      11492:             target="_top"><code xmlns="" class=
                   11493:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      11494:             adds a build dependency on either an installed version
                   11495:             of an older gettext package, or if it isn't, installs
                   11496:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11497:             href=
                   11498:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      11499:             target="_top"><code xmlns="" class=
                   11500:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    11501:           </div>
                   11502: 
                   11503:           <div class="sect2" lang="en" xml:lang="en">
                   11504:             <div class="titlepage">
                   11505:               <div>
                   11506:                 <div>
1.30      wiz      11507:                   <h3 class="title"><a name="conflicts" id=
1.38      dillo    11508:                   "conflicts"></a>15.1.5.&nbsp;Handling conflicts
1.1       grant    11509:                   with other packages</h3>
                   11510:                 </div>
                   11511:               </div>
                   11512:             </div>
                   11513: 
                   11514:             <p>Your package may conflict with other packages a user
                   11515:             might already have installed on his system, e.g. if
                   11516:             your package installs the same set of files like
                   11517:             another package in our pkgsrc tree.</p>
                   11518: 
1.14      xtraeme  11519:             <p>In this case you can set <code class=
1.47      reed     11520:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    11521:             packages (including version string) your package
                   11522:             conflicts with.</p>
                   11523: 
1.47      reed     11524:             <p>For example, <a xmlns=
1.1       grant    11525:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11526:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      11527:             target="_top"><code xmlns="" class=
                   11528:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      11529:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11530:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      11531:             target="_top"><code xmlns="" class=
1.47      reed     11532:             "filename">x11/Xaw-Xpm</code></a> install the same
                   11533:             shared library, thus you set in <code xmlns=
1.45      wiz      11534:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11535:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    11536:             <pre class="programlisting">
                   11537: CONFLICTS=      Xaw-Xpm-[0-9]*
                   11538: </pre>
                   11539: 
1.45      wiz      11540:             <p>and in <code xmlns=
                   11541:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11542:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    11543:             <pre class="programlisting">
                   11544: CONFLICTS=      Xaw3d-[0-9]*
                   11545: </pre>
                   11546: 
                   11547:             <p>Packages will automatically conflict with other
                   11548:             packages with the name prefix and a different version
                   11549:             string. &#8220;<span class=
                   11550:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   11551:             conflict with the older version &#8220;<span class=
                   11552:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   11553:           </div>
                   11554: 
                   11555:           <div class="sect2" lang="en" xml:lang="en">
                   11556:             <div class="titlepage">
                   11557:               <div>
                   11558:                 <div>
1.30      wiz      11559:                   <h3 class="title"><a name="not-building-packages"
                   11560:                   id=
1.38      dillo    11561:                   "not-building-packages"></a>15.1.6.&nbsp;Packages
1.30      wiz      11562:                   that cannot or should not be built</h3>
1.1       grant    11563:                 </div>
                   11564:               </div>
                   11565:             </div>
                   11566: 
                   11567:             <p>There are several reasons why a package might be
                   11568:             instructed to not build under certain circumstances. If
                   11569:             the package builds and runs on most platforms, the
1.14      xtraeme  11570:             exceptions should be noted with <code class=
                   11571:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   11572:             builds and runs on a small handful of platforms, set
                   11573:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      11574:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   11575:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   11576:             triples (OS-version-platform) that can use glob-style
                   11577:             wildcards.</p>
                   11578: 
                   11579:             <p>If the package should be skipped (for example,
                   11580:             because it provides functionality already provided by
                   11581:             the system), set <code class=
1.14      xtraeme  11582:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   11583:             message. If the package should fail because some
                   11584:             preconditions are not met, set <code class=
                   11585:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    11586:             message.</p>
                   11587:           </div>
                   11588: 
                   11589:           <div class="sect2" lang="en" xml:lang="en">
                   11590:             <div class="titlepage">
                   11591:               <div>
                   11592:                 <div>
1.30      wiz      11593:                   <h3 class="title"><a name="undeletable-packages"
                   11594:                   id=
1.38      dillo    11595:                   "undeletable-packages"></a>15.1.7.&nbsp;Packages
1.30      wiz      11596:                   which should not be deleted, once installed</h3>
1.1       grant    11597:                 </div>
                   11598:               </div>
                   11599:             </div>
                   11600: 
                   11601:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  11602:             has been installed, the <code class=
                   11603:             "varname">PKG_PRESERVE</code> definition should be set
                   11604:             in the package Makefile. This will be carried into any
1.1       grant    11605:             binary package that is made from this pkgsrc entry. A
                   11606:             &#8220;<span class="quote">preserved</span>&#8221;
                   11607:             package will not be deleted using <a href=
                   11608:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11609:             <span class="citerefentry"><span class=
                   11610:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   11611:             the &#8220;<span class="quote">-f</span>&#8221; option
                   11612:             is used.</p>
                   11613:           </div>
                   11614: 
                   11615:           <div class="sect2" lang="en" xml:lang="en">
                   11616:             <div class="titlepage">
                   11617:               <div>
                   11618:                 <div>
                   11619:                   <h3 class="title"><a name="security-handling" id=
1.38      dillo    11620:                   "security-handling"></a>15.1.8.&nbsp;Handling
1.1       grant    11621:                   packages with security problems</h3>
                   11622:                 </div>
                   11623:               </div>
                   11624:             </div>
                   11625: 
                   11626:             <p>When a vulnerability is found, this should be noted
1.45      wiz      11627:             in <code xmlns=
                   11628:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11629:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      11630:             and after committing that file, use
                   11631:             <span><strong class="command">make
                   11632:             upload</strong></span> in the same directory to update
                   11633:             the file on ftp.NetBSD.org.</p>
                   11634: 
                   11635:             <p>After fixing the vulnerability by a patch, its
                   11636:             <code class="varname">PKGREVISION</code> should be
                   11637:             increased (this is of course not necessary if the
                   11638:             problem is fixed by using a newer release of the
1.45      wiz      11639:             software). In addition, if a <code xmlns=
                   11640:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11641:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      11642:             affected package, a corresponding <code class=
1.14      xtraeme  11643:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   11644:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      11645:             be added or updated in it.</p>
1.1       grant    11646: 
                   11647:             <p>Also, if the fix should be applied to the stable
                   11648:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      11649: 
                   11650:             <p>Binary packages already on ftp.NetBSD.org will be
                   11651:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    11652:           </div>
                   11653: 
                   11654:           <div class="sect2" lang="en" xml:lang="en">
                   11655:             <div class="titlepage">
                   11656:               <div>
                   11657:                 <div>
1.30      wiz      11658:                   <h3 class="title"><a name="compiler-bugs" id=
1.38      dillo    11659:                   "compiler-bugs"></a>15.1.9.&nbsp;How to handle
1.1       grant    11660:                   compiler bugs</h3>
                   11661:                 </div>
                   11662:               </div>
                   11663:             </div>
                   11664: 
                   11665:             <p>Some source files trigger bugs in the compiler,
                   11666:             based on combinations of compiler version and
                   11667:             architecture and almost always relation to optimisation
                   11668:             being enabled. Common symptoms are gcc internal errors
                   11669:             or never finishing compiling a file.</p>
                   11670: 
1.47      reed     11671:             <p>Typically, a workaround involves testing the
1.14      xtraeme  11672:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    11673:             version, disabling optimisation for that
1.14      xtraeme  11674:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      11675:             combination, and documenting it in <code xmlns=
                   11676:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11677:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    11678:             number of examples!</p>
                   11679:           </div>
                   11680: 
                   11681:           <div class="sect2" lang="en" xml:lang="en">
                   11682:             <div class="titlepage">
                   11683:               <div>
                   11684:                 <div>
1.30      wiz      11685:                   <h3 class="title"><a name="bumping-pkgrevision"
1.38      dillo    11686:                   id="bumping-pkgrevision"></a>15.1.10.&nbsp;How to
1.30      wiz      11687:                   handle incrementing versions when fixing an
                   11688:                   existing package</h3>
1.1       grant    11689:                 </div>
                   11690:               </div>
                   11691:             </div>
                   11692: 
                   11693:             <p>When making fixes to an existing package it can be
1.14      xtraeme  11694:             useful to change the version number in <code class=
                   11695:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    11696:             future versions by the original author, a
                   11697:             &#8220;<span class="quote">nb1</span>&#8221;,
                   11698:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   11699:             suffix can be used on package versions by setting
1.14      xtraeme  11700:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   11701:             The &#8220;<span class="quote">nb</span>&#8221; is
                   11702:             treated like a &#8220;<span class=
                   11703:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    11704:             <pre class="programlisting">
                   11705:   DISTNAME= foo-17.42
                   11706:     PKGREVISION=  9
                   11707: </pre>
                   11708: 
1.14      xtraeme  11709:             <p>will result in a <code class=
                   11710:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    11711:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   11712: 
                   11713:             <p>When a new release of the package is released, the
1.14      xtraeme  11714:             <code class="varname">PKGREVISION</code> should be
1.47      reed     11715:             removed, e.g. on a new minor release of the above
1.14      xtraeme  11716:             package, things should be like:</p>
1.1       grant    11717:             <pre class="programlisting">
                   11718: DISTNAME=   foo-17.43
                   11719: </pre>
                   11720:           </div>
                   11721: 
                   11722:           <div class="sect2" lang="en" xml:lang="en">
                   11723:             <div class="titlepage">
                   11724:               <div>
                   11725:                 <div>
1.30      wiz      11726:                   <h3 class="title"><a name=
                   11727:                   "portability-of-packages" id=
1.38      dillo    11728:                   "portability-of-packages"></a>15.1.11.&nbsp;Portability
1.30      wiz      11729:                   of packages</h3>
1.1       grant    11730:                 </div>
                   11731:               </div>
                   11732:             </div>
                   11733: 
                   11734:             <p>One appealing feature of pkgsrc is that it runs on
                   11735:             many different platforms. As a result, it is important
                   11736:             to ensure, where possible, that packages in pkgsrc are
                   11737:             portable. There are some particular details you should
                   11738:             pay attention to while working on pkgsrc.</p>
                   11739: 
                   11740:             <div class="sect3" lang="en" xml:lang="en">
                   11741:               <div class="titlepage">
                   11742:                 <div>
                   11743:                   <div>
1.30      wiz      11744:                     <h4 class="title"><a name="install-scripts" id=
1.38      dillo    11745:                     "install-scripts"></a>15.1.11.1.&nbsp;${INSTALL},
1.1       grant    11746:                     ${INSTALL_DATA_DIR}, ...</h4>
                   11747:                   </div>
                   11748:                 </div>
                   11749:               </div>
                   11750: 
1.14      xtraeme  11751:               <p>The BSD-compatible <span><strong class=
                   11752:               "command">install</strong></span> supplied with some
1.1       grant    11753:               operating systems will not perform more than one
                   11754:               operation at a time. As such, you should call
                   11755:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   11756:               etc. like this:</p>
                   11757:               <pre class="programlisting">
                   11758: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   11759: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   11760: </pre>
                   11761:             </div>
                   11762:           </div>
                   11763:         </div>
                   11764: 
                   11765:         <div class="sect1" lang="en" xml:lang="en">
                   11766:           <div class="titlepage">
                   11767:             <div>
                   11768:               <div>
                   11769:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11770:                 "downloading-issues" id=
1.38      dillo    11771:                 "downloading-issues"></a>15.2.&nbsp;Possible
1.1       grant    11772:                 downloading issues</h2>
                   11773:               </div>
                   11774:             </div>
                   11775:           </div>
                   11776: 
                   11777:           <div class="sect2" lang="en" xml:lang="en">
                   11778:             <div class="titlepage">
                   11779:               <div>
                   11780:                 <div>
1.30      wiz      11781:                   <h3 class="title"><a name="no-plain-download" id=
1.38      dillo    11782:                   "no-plain-download"></a>15.2.1.&nbsp;Packages
1.30      wiz      11783:                   whose distfiles aren't available for plain
1.1       grant    11784:                   downloading</h3>
                   11785:                 </div>
                   11786:               </div>
                   11787:             </div>
                   11788: 
                   11789:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  11790:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   11791:             and a <span><strong class="command">make
1.45      wiz      11792:             fetch</strong></span> will call <code xmlns=
                   11793:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11794:             "filename">files/getsite.sh</code> with the name of
                   11795:             each file to download as an argument, expecting it to
                   11796:             output the URL of the directory from which to download
                   11797:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11798:             href=
1.1       grant    11799:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      11800:             target="_top"><code xmlns="" class=
                   11801:             "filename">graphics/ns-cult3d</code></a> is an example
                   11802:             of this usage.</p>
1.1       grant    11803: 
                   11804:             <p>If the download can't be automated, because the user
                   11805:             must submit personal information to apply for a
                   11806:             password, or must pay for the source, or whatever, you
1.14      xtraeme  11807:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   11808:             a macro which displays a message explaining the
                   11809:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   11810:             must be executable shell commands, not just a message.
                   11811:             (Generally, it executes <code class=
                   11812:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    11813:             following packages use this: <a xmlns=
                   11814:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      11815:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
1.45      wiz      11816:             target="_top"><code xmlns="" class=
                   11817:             "filename">cad/simian</code></a>, <a xmlns=
1.20      ben      11818:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11819:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
1.45      wiz      11820:             target="_top"><code xmlns="" class=
                   11821:             "filename">devel/ipv6socket</code></a>, <a xmlns=
1.20      ben      11822:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11823:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
1.45      wiz      11824:             target="_top"><code xmlns="" class=
                   11825:             "filename">emulators/vmware-module</code></a>,
                   11826:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11827:             href=
1.20      ben      11828:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      11829:             target="_top"><code xmlns="" class=
                   11830:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      11831:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.43      wiz      11832:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/multimedia/realplayer/README.html"
1.45      wiz      11833:             target="_top"><code xmlns="" class=
                   11834:             "filename">multimedia/realplayer</code></a>, <a xmlns=
1.43      wiz      11835:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.20      ben      11836:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      11837:             target="_top"><code xmlns="" class=
                   11838:             "filename">sysutils/storage-manager</code></a>,
                   11839:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11840:             href=
1.20      ben      11841:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
1.45      wiz      11842:             target="_top"><code xmlns="" class=
                   11843:             "filename">www/ap-aolserver</code></a>, <a xmlns=
1.20      ben      11844:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11845:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
1.45      wiz      11846:             target="_top"><code xmlns="" class=
                   11847:             "filename">www/openacs</code></a>. Try to be consistent
1.20      ben      11848:             with them.</p>
1.1       grant    11849:           </div>
                   11850: 
                   11851:           <div class="sect2" lang="en" xml:lang="en">
                   11852:             <div class="titlepage">
                   11853:               <div>
                   11854:                 <div>
1.30      wiz      11855:                   <h3 class="title"><a name=
                   11856:                   "modified-distfiles-same-name" id=
1.38      dillo    11857:                   "modified-distfiles-same-name"></a>15.2.2.&nbsp;How
1.30      wiz      11858:                   to handle modified distfiles with the 'old'
                   11859:                   name</h3>
1.1       grant    11860:                 </div>
                   11861:               </div>
                   11862:             </div>
                   11863: 
                   11864:             <p>Sometimes authors of a software package make some
                   11865:             modifications after the software was released, and they
                   11866:             put up a new distfile without changing the package's
                   11867:             version number. If a package is already in pkgsrc at
1.32      wiz      11868:             that time, the checksum will no longer match. The
                   11869:             contents of the new distfile should be compared against
                   11870:             the old one before changing anything, to make sure the
                   11871:             distfile was really updated on purpose, and that no
                   11872:             trojan horse or so crept in. Then, the correct way to
                   11873:             work around this is to set <code class=
                   11874:             "varname">DIST_SUBDIR</code> to a unique directory
                   11875:             name, usually based on <code class=
                   11876:             "varname">PKGNAME_NOREV</code>. In case this happens
                   11877:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      11878:             used (thus including the <code xmlns=
                   11879:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      11880:             "filename">nbX</code> suffix) or a date stamp can be
                   11881:             appended, like <code class=
                   11882:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      11883:             forget regenerating the <code xmlns=
                   11884:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      11885:             "filename">distinfo</code> file after that, since it
                   11886:             contains the <code class="varname">DIST_SUBDIR</code>
                   11887:             path in the filenames. Furthermore, a mail to the
                   11888:             package's authors seems appropriate telling them that
                   11889:             changing distfiles after releases without changing the
                   11890:             file names is not good practice.</p>
1.1       grant    11891:           </div>
                   11892:         </div>
                   11893: 
                   11894:         <div class="sect1" lang="en" xml:lang="en">
                   11895:           <div class="titlepage">
                   11896:             <div>
                   11897:               <div>
                   11898:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      11899:                 "configuration-gotchas" id=
1.38      dillo    11900:                 "configuration-gotchas"></a>15.3.&nbsp;Configuration
1.1       grant    11901:                 gotchas</h2>
                   11902:               </div>
                   11903:             </div>
                   11904:           </div>
                   11905: 
                   11906:           <div class="sect2" lang="en" xml:lang="en">
                   11907:             <div class="titlepage">
                   11908:               <div>
                   11909:                 <div>
                   11910:                   <h3 class="title"><a name="fixes.libtool" id=
1.38      dillo    11911:                   "fixes.libtool"></a>15.3.1.&nbsp;Shared libraries
1.1       grant    11912:                   - libtool</h3>
                   11913:                 </div>
                   11914:               </div>
                   11915:             </div>
                   11916: 
                   11917:             <p>pkgsrc supports many different machines, with
                   11918:             different object formats like a.out and ELF, and
                   11919:             varying abilities to do shared library and dynamic
                   11920:             loading at all. To accompany this, varying commands and
                   11921:             options have to be passed to the compiler, linker, etc.
                   11922:             to get the Right Thing, which can be pretty annoying
                   11923:             especially if you don't have all the machines at your
                   11924:             hand to test things. The <a xmlns=
                   11925:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   11926:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      11927:             target="_top"><code xmlns="" class=
                   11928:             "filename">devel/libtool</code></a> pkg can help here,
                   11929:             as it just &#8220;<span class=
                   11930:             "quote">knows</span>&#8221; how to build both static
                   11931:             and dynamic libraries from a set of source files, thus
1.47      reed     11932:             being platform-independent.</p>
1.1       grant    11933: 
                   11934:             <p>Here's how to use libtool in a pkg in seven simple
                   11935:             steps:</p>
                   11936: 
                   11937:             <div class="orderedlist">
                   11938:               <ol type="1">
                   11939:                 <li>
1.14      xtraeme  11940:                   <p>Add <code class=
                   11941:                   "varname">USE_LIBTOOL=yes</code> to the package
                   11942:                   Makefile.</p>
1.1       grant    11943:                 </li>
                   11944: 
                   11945:                 <li>
                   11946:                   <p>For library objects, use &#8220;<span class=
                   11947:                   "quote">${LIBTOOL} --mode=compile
                   11948:                   ${CC}</span>&#8221; in place of
                   11949:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   11950:                   You could even add it to the definition of
1.14      xtraeme  11951:                   <code class="varname">CC</code>, if only
                   11952:                   libraries are being built in a given Makefile.
                   11953:                   This one command will build both PIC and non-PIC
                   11954:                   library objects, so you need not have separate
                   11955:                   shared and non-shared library rules.</p>
1.1       grant    11956:                 </li>
                   11957: 
                   11958:                 <li>
                   11959:                   <p>For the linking of the library, remove any
                   11960:                   &#8220;<span class="quote">ar</span>&#8221;,
                   11961:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   11962:                   and &#8220;<span class="quote">ld
                   11963:                   -Bshareable</span>&#8221; commands, and instead
                   11964:                   use:</p>
                   11965:                   <pre class="programlisting">
                   11966: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   11967: </pre>
                   11968: 
                   11969:                   <p>Note that the library is changed to have a
1.45      wiz      11970:                   <code xmlns=
                   11971:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   11972:                   "filename">.la</code> extension, and the objects
                   11973:                   are changed to have a <code xmlns=
                   11974:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11975:                   "filename">.lo</code> extension. Change
                   11976:                   <code class="varname">OBJS</code> as necessary.
                   11977:                   This automatically creates all of the
1.45      wiz      11978:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   11979:                   class="filename">.a</code>, <code xmlns=
                   11980:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11981:                   "filename">.so.major.minor</code>, and ELF
                   11982:                   symlinks (if necessary) in the build directory.
                   11983:                   Be sure to include &#8220;<span class=
1.1       grant    11984:                   "quote">-version-info</span>&#8221;, especially
                   11985:                   when major and minor are zero, as libtool will
                   11986:                   otherwise strip off the shared library
                   11987:                   version.</p>
                   11988: 
                   11989:                   <p>From the libtool manual:</p>
                   11990:                   <pre class="programlisting">
                   11991:      So, libtool library versions are described by three integers:
                   11992: 
                   11993: CURRENT
                   11994:        The most recent interface number that this library implements.
                   11995: 
                   11996: REVISION
                   11997:        The implementation number of the CURRENT interface.
                   11998: 
                   11999: AGE
                   12000:        The difference between the newest and oldest interfaces that this
                   12001:        library implements.  In other words, the library implements all the
                   12002:        interface numbers in the range from number `CURRENT - AGE' to
                   12003:        `CURRENT'.
                   12004:        
                   12005:      If two libraries have identical CURRENT and AGE numbers, then the
                   12006: dynamic linker chooses the library with the greater REVISION number. 
                   12007: </pre>
                   12008: 
                   12009:                   <p>The &#8220;<span class=
                   12010:                   "quote">-release</span>&#8221; option will
                   12011:                   produce different results for a.out and ELF
                   12012:                   (excluding symlinks) in only one case. An ELF
                   12013:                   library of the form &#8220;<span class=
                   12014:                   "quote">libfoo-release.so.<span class=
                   12015:                   "emphasis"><em>x</em></span>.<span class=
                   12016:                   "emphasis"><em>y</em></span></span>&#8221; will
                   12017:                   have a symlink of &#8220;<span class=
                   12018:                   "quote">libfoo.so.<span class=
                   12019:                   "emphasis"><em>x</em></span>.<span class=
                   12020:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   12021:                   a.out platform. This is handled
                   12022:                   automatically.</p>
                   12023: 
                   12024:                   <p>The &#8220;<span class="quote">-rpath
                   12025:                   argument</span>&#8221; is the install directory
                   12026:                   of the library being built.</p>
                   12027: 
1.45      wiz      12028:                   <p>In the <code xmlns=
                   12029:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12030:                   "filename">PLIST</code>, include only the
                   12031:                   <code xmlns=
                   12032:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  12033:                   "filename">.la</code> file, the other files will
                   12034:                   be added automatically.</p>
1.1       grant    12035:                 </li>
                   12036: 
                   12037:                 <li>
1.45      wiz      12038:                   <p>When linking shared object (<code xmlns=
                   12039:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12040:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      12041:                   loaded via <a href=
                   12042:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   12043:                   <span class="citerefentry"><span class=
                   12044:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   12045:                   shared libraries, use &#8220;<span class=
                   12046:                   "quote">-module -avoid-version</span>&#8221; to
                   12047:                   prevent them getting version tacked on.</p>
1.1       grant    12048: 
1.45      wiz      12049:                   <p>The <code xmlns=
                   12050:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12051:                   "filename">PLIST</code> file gets the
                   12052:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12053:                   class="filename">foo.so</code> entry.</p>
1.1       grant    12054:                 </li>
                   12055: 
                   12056:                 <li>
                   12057:                   <p>When linking programs that depend on these
                   12058:                   libraries <span class=
                   12059:                   "emphasis"><em>before</em></span> they are
                   12060:                   installed, preface the <a href=
                   12061:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   12062:                   <span class="citerefentry"><span class=
                   12063:                   "refentrytitle">cc</span>(1)</span></a> or
                   12064:                   <a href=
                   12065:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   12066:                   <span class="citerefentry"><span class=
                   12067:                   "refentrytitle">ld</span>(1)</span></a> line with
                   12068:                   &#8220;<span class="quote">${LIBTOOL}
                   12069:                   --mode=link</span>&#8221;, and it will find the
                   12070:                   correct libraries (static or shared), but please
                   12071:                   be aware that libtool will not allow you to
                   12072:                   specify a relative path in -L (such as
                   12073:                   &#8220;<span class=
                   12074:                   "quote">-L../somelib</span>&#8221;), because it
                   12075:                   expects you to change that argument to be the
1.45      wiz      12076:                   <code xmlns=
                   12077:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12078:                   "filename">.la</code> file. e.g.</p>
1.1       grant    12079:                   <pre class="programlisting">
                   12080: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   12081: </pre>
                   12082: 
                   12083:                   <p>should be changed to:</p>
                   12084:                   <pre class="programlisting">
1.14      xtraeme  12085: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   12086: "replaceable"><code>someprog</code></em> <em class=
                   12087: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    12088: </pre>
                   12089: 
                   12090:                   <p>and it will do the right thing with the
                   12091:                   libraries.</p>
                   12092:                 </li>
                   12093: 
                   12094:                 <li>
                   12095:                   <p>When installing libraries, preface the
                   12096:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   12097:                   <span class="citerefentry"><span class=
                   12098:                   "refentrytitle">install</span>(1)</span></a> or
                   12099:                   <a href=
                   12100:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   12101:                   <span class="citerefentry"><span class=
                   12102:                   "refentrytitle">cp</span>(1)</span></a> command
                   12103:                   with &#8220;<span class="quote">${LIBTOOL}
                   12104:                   --mode=install</span>&#8221;, and change the
1.45      wiz      12105:                   library name to <code xmlns=
                   12106:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12107:                   "filename">.la</code>. e.g.</p>
1.1       grant    12108:                   <pre class="programlisting">
                   12109: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   12110: </pre>
                   12111: 
1.45      wiz      12112:                   <p>This will install the static <code xmlns=
                   12113:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12114:                   "filename">.a</code>, shared library, any needed
1.1       grant    12115:                   symlinks, and run <a href=
                   12116:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   12117:                   <span class="citerefentry"><span class=
                   12118:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   12119:                 </li>
                   12120: 
                   12121:                 <li>
1.45      wiz      12122:                   <p>In your <code xmlns=
                   12123:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12124:                   "filename">PLIST</code>, include only the
                   12125:                   <code xmlns=
                   12126:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      12127:                   "filename">.la</code> file (this is a change from
                   12128:                   previous behaviour).</p>
1.1       grant    12129:                 </li>
                   12130:               </ol>
                   12131:             </div>
                   12132:           </div>
                   12133: 
                   12134:           <div class="sect2" lang="en" xml:lang="en">
                   12135:             <div class="titlepage">
                   12136:               <div>
                   12137:                 <div>
1.30      wiz      12138:                   <h3 class="title"><a name="using-libtool" id=
1.38      dillo    12139:                   "using-libtool"></a>15.3.2.&nbsp;Using libtool on
1.30      wiz      12140:                   GNU packages that already support libtool</h3>
1.1       grant    12141:                 </div>
                   12142:               </div>
                   12143:             </div>
                   12144: 
1.14      xtraeme  12145:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   12146:             the package Makefile. This will override the package's
                   12147:             own libtool in most cases. For older libtool using
1.1       grant    12148:             packages, libtool is made by ltconfig script during the
                   12149:             do-configure step; you can check the libtool script
1.14      xtraeme  12150:             location by doing <span><strong class="command">make
                   12151:             configure; find work*/ -name
                   12152:             libtool</strong></span>.</p>
                   12153: 
                   12154:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   12155:             specifies which libtool scripts, relative to
                   12156:             <code class="varname">WRKSRC</code>, to override. By
                   12157:             default, it is set to &#8220;<span class=
                   12158:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   12159:             this does not match the location of the package's
                   12160:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  12161: 
1.45      wiz      12162:             <p>If you do not need <code xmlns=
                   12163:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12164:             "filename">*.a</code> static libraries built and
                   12165:             installed, then use <code class=
                   12166:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    12167: 
1.47      reed     12168:             <p>If your package makes use of the
                   12169:             platform-independent library for loading dynamic shared
                   12170:             objects, that comes with libtool (libltdl), you should
                   12171:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    12172: 
                   12173:             <p>Some packages use libtool incorrectly so that the
                   12174:             package may not work or build in some circumstances.
                   12175:             Some of the more common errors are:</p>
                   12176: 
                   12177:             <div class="itemizedlist">
                   12178:               <ul type="disc">
                   12179:                 <li>
                   12180:                   <p>The inclusion of a shared object (-module) as
                   12181:                   a dependent library in an executable or library.
                   12182:                   This in itself isn't a problem if one of two
                   12183:                   things has been done:</p>
                   12184: 
                   12185:                   <div class="orderedlist">
                   12186:                     <ol type="1">
                   12187:                       <li>
                   12188:                         <p>The shared object is named correctly,
1.45      wiz      12189:                         i.e. <code xmlns=
                   12190:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12191:                         class="filename">libfoo.la</code>, not
                   12192:                         <code xmlns=
                   12193:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12194:                         class="filename">foo.la</code></p>
1.1       grant    12195:                       </li>
                   12196: 
                   12197:                       <li>
                   12198:                         <p>The -dlopen option is used when linking
                   12199:                         an executable.</p>
                   12200:                       </li>
                   12201:                     </ol>
                   12202:                   </div>
                   12203:                 </li>
                   12204: 
                   12205:                 <li>
                   12206:                   <p>The use of libltdl without the correct calls
                   12207:                   to initialisation routines. The function
                   12208:                   lt_dlinit() should be called and the macro
1.14      xtraeme  12209:                   <code class=
                   12210:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    12211:                   included in executables.</p>
                   12212:                 </li>
                   12213:               </ul>
                   12214:             </div>
                   12215:           </div>
                   12216: 
                   12217:           <div class="sect2" lang="en" xml:lang="en">
                   12218:             <div class="titlepage">
                   12219:               <div>
                   12220:                 <div>
1.30      wiz      12221:                   <h3 class="title"><a name="autoconf-automake" id=
1.38      dillo    12222:                   "autoconf-automake"></a>15.3.3.&nbsp;GNU
1.1       grant    12223:                   Autoconf/Automake</h3>
                   12224:                 </div>
                   12225:               </div>
                   12226:             </div>
                   12227: 
                   12228:             <p>If a package needs GNU autoconf or automake to be
                   12229:             executed to regenerate the configure script and
                   12230:             Makefile.in makefile templates, then they should be
1.35      jmmv     12231:             executed in a pre-configure target.</p>
1.1       grant    12232: 
                   12233:             <p>For packages that need only autoconf:</p>
                   12234:             <pre class="programlisting">
1.35      jmmv     12235: AUTOCONF_REQD=    2.50     # if default version is not good enough
                   12236: USE_TOOLS+=     autoconf   # use "autoconf213" for autoconf-2.13
1.1       grant    12237: ...
                   12238: 
                   12239: pre-configure:
1.35      jmmv     12240:           cd ${WRKSRC}; autoconf
1.1       grant    12241: 
                   12242: ...
                   12243: </pre>
                   12244: 
                   12245:             <p>and for packages that need automake and
                   12246:             autoconf:</p>
                   12247:             <pre class="programlisting">
1.35      jmmv     12248: AUTOMAKE_REQD=  1.7.1      # if default version is not good enough
1.36      wiz      12249: USE_TOOLS+=     automake   # use "automake14" for automake-1.4
1.1       grant    12250: ...
                   12251: 
                   12252: pre-configure:
                   12253:           cd ${WRKSRC};                                           \
1.35      jmmv     12254:           aclocal; autoheader;                                    \
                   12255:           automake -a --foreign -i; autoconf
1.1       grant    12256: 
                   12257: ...
                   12258: </pre>
                   12259: 
                   12260:             <p>Packages which use GNU Automake will almost
1.35      jmmv     12261:             certainly require GNU Make.</p>
1.1       grant    12262: 
                   12263:             <p>There are times when the configure process makes
                   12264:             additional changes to the generated files, which then
                   12265:             causes the build process to try to re-execute the
                   12266:             automake sequence. This is prevented by touching
                   12267:             various files in the configure stage. If this causes
1.14      xtraeme  12268:             problems with your package you can set <code class=
                   12269:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    12270:             Makefile.</p>
                   12271:           </div>
                   12272:         </div>
                   12273: 
                   12274:         <div class="sect1" lang="en" xml:lang="en">
                   12275:           <div class="titlepage">
                   12276:             <div>
                   12277:               <div>
                   12278:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12279:                 "building-considerations" id=
1.38      dillo    12280:                 "building-considerations"></a>15.4.&nbsp;Building
1.1       grant    12281:                 considerations</h2>
                   12282:               </div>
                   12283:             </div>
                   12284:           </div>
                   12285: 
                   12286:           <div class="sect2" lang="en" xml:lang="en">
                   12287:             <div class="titlepage">
                   12288:               <div>
                   12289:                 <div>
1.30      wiz      12290:                   <h3 class="title"><a name="cpp-defines" id=
1.38      dillo    12291:                   "cpp-defines"></a>15.4.1.&nbsp;CPP defines</h3>
1.1       grant    12292:                 </div>
                   12293:               </div>
                   12294:             </div>
                   12295: 
                   12296:             <p>To port an application to NetBSD, it's usually
                   12297:             necessary for the compiler to be able to judge the
                   12298:             system on which it's compiling, and we use definitions
                   12299:             so that the C pre-processor can do this.</p>
                   12300: 
                   12301:             <p>To test whether you are working on a 4.4 BSD-derived
                   12302:             system, you should use the BSD definition, which is
1.45      wiz      12303:             defined in <code xmlns=
                   12304:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12305:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    12306:             systems.</p>
                   12307:             <pre class="programlisting">
                   12308: #include &lt;sys/param.h&gt;
                   12309: </pre>
                   12310: 
                   12311:             <p>and then you can surround the BSD-specific parts of
                   12312:             your package's C/C++ code using this conditional:</p>
                   12313:             <pre class="programlisting">
                   12314: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   12315:     ...
                   12316: #endif
                   12317: </pre>
                   12318: 
                   12319:             <p>Please use the &#8220;<span class=
                   12320:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   12321:             it should only apply to features of NetBSD that are not
1.47      reed     12322:             present in other 4.4-lite-derived BSDs.</p>
1.1       grant    12323:           </div>
                   12324:         </div>
                   12325: 
                   12326:         <div class="sect1" lang="en" xml:lang="en">
                   12327:           <div class="titlepage">
                   12328:             <div>
                   12329:               <div>
                   12330:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      12331:                 "package-specific-actions" id=
1.38      dillo    12332:                 "package-specific-actions"></a>15.5.&nbsp;Package
1.1       grant    12333:                 specific actions</h2>
                   12334:               </div>
                   12335:             </div>
                   12336:           </div>
                   12337: 
                   12338:           <div class="sect2" lang="en" xml:lang="en">
                   12339:             <div class="titlepage">
                   12340:               <div>
                   12341:                 <div>
1.30      wiz      12342:                   <h3 class="title"><a name="user-interaction" id=
1.38      dillo    12343:                   "user-interaction"></a>15.5.1.&nbsp;User
1.2       hubertf  12344:                   interaction</h3>
1.1       grant    12345:                 </div>
                   12346:               </div>
                   12347:             </div>
                   12348: 
                   12349:             <p>Occasionally, packages require interaction from the
                   12350:             user, and this can be in a number of ways:</p>
                   12351: 
                   12352:             <div class="itemizedlist">
                   12353:               <ul type="disc">
                   12354:                 <li>
                   12355:                   <p>help in fetching the distfiles</p>
                   12356:                 </li>
                   12357: 
                   12358:                 <li>
                   12359:                   <p>help to configure the package before it is
                   12360:                   built</p>
                   12361:                 </li>
                   12362: 
                   12363:                 <li>
                   12364:                   <p>help during the build process</p>
                   12365:                 </li>
                   12366: 
                   12367:                 <li>
                   12368:                   <p>help during the installation of a package</p>
                   12369:                 </li>
                   12370:               </ul>
                   12371:             </div>
                   12372: 
1.14      xtraeme  12373:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    12374:             definition is provided to notify the pkgsrc mechanism
                   12375:             of an interactive stage which will be needed, and this
1.45      wiz      12376:             should be set in the package's <code xmlns=
                   12377:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12378:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    12379:             <pre class="programlisting">
                   12380: INTERACTIVE_STAGE= build
                   12381: </pre>
                   12382: 
                   12383:             <p>Multiple interactive stages can be specified:</p>
                   12384:             <pre class="programlisting">
                   12385: INTERACTIVE_STAGE= configure install
                   12386: </pre>
                   12387:           </div>
                   12388: 
                   12389:           <div class="sect2" lang="en" xml:lang="en">
                   12390:             <div class="titlepage">
                   12391:               <div>
                   12392:                 <div>
1.30      wiz      12393:                   <h3 class="title"><a name="handling-licenses" id=
1.38      dillo    12394:                   "handling-licenses"></a>15.5.2.&nbsp;Handling
1.1       grant    12395:                   licenses</h3>
                   12396:                 </div>
                   12397:               </div>
                   12398:             </div>
                   12399: 
1.44      gdt      12400:             <p>A package may be covered by a license which the user
                   12401:             has or has not agreed to accept. For these cases,
                   12402:             pkgsrc contains a mechanism to note that a package is
                   12403:             covered by a particular license, and the package cannot
                   12404:             be built unless the user has accepted the license.
                   12405:             (Installation of binary packages are not currently
                   12406:             subject to this mechanism.) Packages with licenses that
                   12407:             are either Open Source according to the Open Source
                   12408:             Initiative or Free according to the Free Software
                   12409:             Foundation will not be marked with a license tag.
                   12410:             Packages with licenses that have not been determined to
                   12411:             meet either definition will be marked with a license
                   12412:             tag referring to the license. This will prevent
                   12413:             building unless pkgsrc is informed that the license is
                   12414:             acceptable, and enables displaying the license.</p>
                   12415: 
                   12416:             <p>The license tag mechanism is intended to address
                   12417:             copyright-related issues surrounding building,
                   12418:             installing and using a package, and not to address
                   12419:             redistribution issues (see <code class=
                   12420:             "varname">RESTRICTED</code> and <code class=
                   12421:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   12422:             above definition of licenses for which tags are not
                   12423:             needed implies that packages with redistribution
                   12424:             restrictions should have tags.</p>
                   12425: 
                   12426:             <p>Denoting that a package is covered by a particular
1.45      wiz      12427:             license is done by placing the license in <code xmlns=
                   12428:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      12429:             "filename">pkgsrc/licenses</code> and setting the
                   12430:             <code class="varname">LICENSE</code> variable to a
                   12431:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  12432:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      12433:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      12434:             target="_top"><code xmlns="" class=
                   12435:             "filename">graphics/xv</code></a>:</p>
1.1       grant    12436:             <pre class="programlisting">
1.44      gdt      12437: LICENSE=        xv-license
1.1       grant    12438: </pre>
                   12439: 
                   12440:             <p>When trying to build, the user will get a notice
1.44      gdt      12441:             that the package is covered by a license which has not
                   12442:             been accepted:</p>
1.1       grant    12443:             <pre class="programlisting">
1.14      xtraeme  12444: <code class="prompt">%</code> <strong class=
                   12445: "userinput"><code>make</code></strong>
1.44      gdt      12446: ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
1.1       grant    12447: ===&gt;     To view the license, enter "/usr/bin/make show-license".
1.44      gdt      12448: ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   12449: ===&gt;     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    12450: *** Error code 1
                   12451: </pre>
                   12452: 
1.14      xtraeme  12453:             <p>The license can be viewed with <span><strong class=
                   12454:             "command">make show-license</strong></span>, and if it
                   12455:             is considered appropriate, the line printed above can
1.45      wiz      12456:             be added to <code xmlns=
                   12457:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12458:             "filename">/etc/mk.conf</code> to indicate acceptance
                   12459:             of the particular license:</p>
1.1       grant    12460:             <pre class="programlisting">
1.44      gdt      12461: ACCEPTABLE_LICENSES+=xv-license
1.1       grant    12462: </pre>
                   12463: 
                   12464:             <p>When adding a package with a new license, the
1.45      wiz      12465:             license text should be added to <code xmlns=
                   12466:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12467:             "filename">pkgsrc/licenses</code> for displaying. A
                   12468:             list of known licenses can be seen in this directory as
                   12469:             well as by looking at the list of (commented out)
                   12470:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      12471:             variable settings in <code xmlns=
                   12472:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12473:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    12474: 
1.44      gdt      12475:             <p>The use of <code class=
                   12476:             "varname">LICENSE=shareware</code>, <code class=
                   12477:             "varname">LICENSE=no-commercial-use</code>, and similar
                   12478:             language is deprecated because it does not crisply
                   12479:             refer to a particular license text. Another problem
                   12480:             with such usage is that it does not enable a user to
                   12481:             denote acceptance of the license for a single package
                   12482:             without accepting the same license text for another
                   12483:             package. In particular, this can be inappropriate when
                   12484:             e.g. one accepts a particular license to indicate to
                   12485:             pkgsrc that a fee has been paid.</p>
1.1       grant    12486:           </div>
                   12487: 
                   12488:           <div class="sect2" lang="en" xml:lang="en">
                   12489:             <div class="titlepage">
                   12490:               <div>
                   12491:                 <div>
1.30      wiz      12492:                   <h3 class="title"><a name=
                   12493:                   "installing-score-files" id=
1.38      dillo    12494:                   "installing-score-files"></a>15.5.3.&nbsp;Installing
1.30      wiz      12495:                   score files</h3>
1.1       grant    12496:                 </div>
                   12497:               </div>
                   12498:             </div>
                   12499: 
                   12500:             <p>Certain packages, most of them in the games
                   12501:             category, install a score file that allows all users on
                   12502:             the system to record their highscores. In order for
                   12503:             this to work, the binaries need to be installed setgid
                   12504:             and the score files owned by the appropriate group
                   12505:             and/or owner (traditionally the "games" user/group).
                   12506:             The following variables, documented in more detail in
1.45      wiz      12507:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12508:             class="filename">mk/defaults/mk.conf</code>, control
                   12509:             this behaviour: <code class=
1.14      xtraeme  12510:             "varname">SETGIDGAME</code>, <code class=
                   12511:             "varname">GAMEDATAMODE</code>, <code class=
                   12512:             "varname">GAMEGRP</code>, <code class=
                   12513:             "varname">GAMEMODE</code>, <code class=
                   12514:             "varname">GAMEOWN</code>.</p>
1.1       grant    12515: 
                   12516:             <p>Note that per default, setgid installation of games
1.14      xtraeme  12517:             is disabled; setting <code class=
                   12518:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    12519:             variables accordingly.</p>
                   12520: 
                   12521:             <p>A package should therefor never hard code file
1.14      xtraeme  12522:             ownership or access permissions but rely on
                   12523:             <code class="varname">INSTALL_GAME</code> and
                   12524:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   12525:             these correctly.</p>
1.1       grant    12526:           </div>
                   12527: 
                   12528:           <div class="sect2" lang="en" xml:lang="en">
                   12529:             <div class="titlepage">
                   12530:               <div>
                   12531:                 <div>
1.30      wiz      12532:                   <h3 class="title"><a name="perl-scripts" id=
1.38      dillo    12533:                   "perl-scripts"></a>15.5.4.&nbsp;Packages
1.30      wiz      12534:                   containing perl scripts</h3>
1.1       grant    12535:                 </div>
                   12536:               </div>
                   12537:             </div>
                   12538: 
                   12539:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  12540:             set <code class="varname">REPLACE_PERL</code> to ensure
                   12541:             that the proper interpreter path is set. <code class=
                   12542:             "varname">REPLACE_PERL</code> should contain a list of
                   12543:             scripts, relative to <code class=
                   12544:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    12545:           </div>
                   12546: 
                   12547:           <div class="sect2" lang="en" xml:lang="en">
                   12548:             <div class="titlepage">
                   12549:               <div>
                   12550:                 <div>
1.30      wiz      12551:                   <h3 class="title"><a name="hardcoded-paths" id=
1.38      dillo    12552:                   "hardcoded-paths"></a>15.5.5.&nbsp;Packages with
1.1       grant    12553:                   hardcoded paths to other interpreters</h3>
                   12554:                 </div>
                   12555:               </div>
                   12556:             </div>
                   12557: 
                   12558:             <p>Your package may also contain scripts with hardcoded
                   12559:             paths to other interpreters besides (or as well as)
                   12560:             perl. To correct the full pathname to the script
                   12561:             interpreter, you need to set the following definitions
1.45      wiz      12562:             in your <code xmlns=
                   12563:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12564:             "filename">Makefile</code> (we shall use
                   12565:             <span><strong class="command">tclsh</strong></span> in
                   12566:             this example):</p>
1.1       grant    12567:             <pre class="programlisting">
                   12568:   REPLACE_INTERPRETER+=     tcl
                   12569:     _REPLACE.tcl.old=     .*/bin/tclsh
                   12570:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   12571:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   12572:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   12573: </pre>
                   12574:           </div>
                   12575: 
                   12576:           <div class="sect2" lang="en" xml:lang="en">
                   12577:             <div class="titlepage">
                   12578:               <div>
                   12579:                 <div>
1.30      wiz      12580:                   <h3 class="title"><a name="perl-modules" id=
1.38      dillo    12581:                   "perl-modules"></a>15.5.6.&nbsp;Packages
1.30      wiz      12582:                   installing perl modules</h3>
1.1       grant    12583:                 </div>
                   12584:               </div>
                   12585:             </div>
                   12586: 
                   12587:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      12588:             include the Makefile fragment <code xmlns=
                   12589:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12590:             "filename">../../lang/perl5/module.mk</code>. It
                   12591:             provides a <span><strong class=
                   12592:             "command">do-configure</strong></span> target for the
                   12593:             standard perl configuration for such modules as well as
                   12594:             various hooks to tune this configuration. See comments
                   12595:             in this file for details.</p>
1.1       grant    12596: 
                   12597:             <p>Perl5 modules will install into different places
                   12598:             depending on the version of perl used during the build
                   12599:             process. To address this, pkgsrc will append lines to
1.45      wiz      12600:             the <code xmlns=
                   12601:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12602:             "filename">PLIST</code> corresponding to the files
                   12603:             listed in the installed <code xmlns=
                   12604:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12605:             "filename">.packlist</code> file generated by most
                   12606:             perl5 modules. This is invoked by defining <code class=
                   12607:             "varname">PERL5_PACKLIST</code> to a space-separated
                   12608:             list of paths to packlist files, e.g.:</p>
1.1       grant    12609:             <pre class="programlisting">
                   12610: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   12611: </pre>
                   12612: 
1.14      xtraeme  12613:             <p>The variables <code class=
                   12614:             "varname">PERL5_SITELIB</code>, <code class=
                   12615:             "varname">PERL5_SITEARCH</code>, and <code class=
                   12616:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    12617:             locations in which perl5 modules may be installed, and
                   12618:             may be used by perl5 packages that don't have a
                   12619:             packlist. These three variables are also substituted
1.45      wiz      12620:             for in the <code xmlns=
                   12621:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12622:             "filename">PLIST</code>.</p>
1.1       grant    12623:           </div>
                   12624: 
                   12625:           <div class="sect2" lang="en" xml:lang="en">
                   12626:             <div class="titlepage">
                   12627:               <div>
                   12628:                 <div>
                   12629:                   <h3 class="title"><a name="faq.info-files" id=
1.38      dillo    12630:                   "faq.info-files"></a>15.5.7.&nbsp;Packages
1.1       grant    12631:                   installing info files</h3>
                   12632:                 </div>
                   12633:               </div>
                   12634:             </div>
                   12635: 
                   12636:             <p>Some packages install info files or use the
                   12637:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   12638:             &#8220;<span class="quote">install-info</span>&#8221;
                   12639:             commands. Each of the info files:</p>
                   12640: 
                   12641:             <div class="itemizedlist">
                   12642:               <ul type="disc">
                   12643:                 <li>
                   12644:                   <p>is considered to be installed in the directory
1.45      wiz      12645:                   <code xmlns=
                   12646:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12647:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    12648:                 </li>
                   12649: 
                   12650:                 <li>
                   12651:                   <p>is registered in the Info directory file
1.45      wiz      12652:                   <code xmlns=
                   12653:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12654:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    12655:                 </li>
                   12656: 
                   12657:                 <li>
                   12658:                   <p>and must be listed as a filename in the
1.14      xtraeme  12659:                   <code class="varname">INFO_FILES</code> variable
                   12660:                   in the package Makefile.</p>
1.1       grant    12661:                 </li>
                   12662:               </ul>
                   12663:             </div>
                   12664: 
1.14      xtraeme  12665:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    12666:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      12667:             be overridden in the package Makefile. <code xmlns=
                   12668:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12669:             "filename">INSTALL</code> and <code xmlns=
                   12670:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12671:             "filename">DEINSTALL</code> scripts will be generated
                   12672:             to handle registration of the info files in the Info
1.1       grant    12673:             directory file. The &#8220;<span class=
                   12674:             "quote">install-info</span>&#8221; command used for the
                   12675:             info files registration is either provided by the
                   12676:             system, or by a special purpose package automatically
                   12677:             added as dependency if needed.</p>
                   12678: 
                   12679:             <p>A package which needs the &#8220;<span class=
                   12680:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  12681:             must define the variable <code class=
                   12682:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    12683:             minimum version of the &#8220;<span class=
                   12684:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  12685:             should be noted with the <code class=
                   12686:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      12687:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12688:             class="filename">Makefile</code>. By default, a minimum
                   12689:             version of 3.12 is required. If the system does not
                   12690:             provide a <span><strong class=
1.14      xtraeme  12691:             "command">makeinfo</strong></span> command or if it
                   12692:             does not match the required minimum, a build dependency
                   12693:             on the <a xmlns=
                   12694:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    12695:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      12696:             target="_top"><code xmlns="" class=
                   12697:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      12698:             added automatically.</p>
1.1       grant    12699: 
                   12700:             <p>The build and installation process of the software
                   12701:             provided by the package should not use the
1.14      xtraeme  12702:             <span><strong class=
                   12703:             "command">install-info</strong></span> command as the
                   12704:             registration of info files is the task of the package
1.45      wiz      12705:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12706:             class="filename">INSTALL</code> script, and it must use
                   12707:             the appropriate <span><strong class=
1.14      xtraeme  12708:             "command">makeinfo</strong></span> command.</p>
1.1       grant    12709: 
1.47      reed     12710:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  12711:             creates overriding scripts for the <span><strong class=
                   12712:             "command">install-info</strong></span> and
                   12713:             <span><strong class="command">makeinfo</strong></span>
                   12714:             commands in a directory listed early in <code class=
                   12715:             "varname">PATH</code>.</p>
1.1       grant    12716: 
1.14      xtraeme  12717:             <p>The script overriding <span><strong class=
                   12718:             "command">install-info</strong></span> has no effect
                   12719:             except the logging of a message. The script overriding
                   12720:             <span><strong class="command">makeinfo</strong></span>
                   12721:             logs a message and according to the value of
                   12722:             <code class="varname">USE_MAKEINFO</code> and
                   12723:             <code class="varname">TEXINFO_REQD</code> either run
                   12724:             the appropriate <span><strong class=
                   12725:             "command">makeinfo</strong></span> command or exit on
                   12726:             error.</p>
1.1       grant    12727:           </div>
                   12728: 
                   12729:           <div class="sect2" lang="en" xml:lang="en">
                   12730:             <div class="titlepage">
                   12731:               <div>
                   12732:                 <div>
1.30      wiz      12733:                   <h3 class="title"><a name="gconf2-data-files" id=
1.38      dillo    12734:                   "gconf2-data-files"></a>15.5.8.&nbsp;Packages
1.30      wiz      12735:                   installing GConf2 data files</h3>
1.1       grant    12736:                 </div>
                   12737:               </div>
                   12738:             </div>
                   12739: 
1.45      wiz      12740:             <p>If a package installs <code xmlns=
                   12741:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12742:             "filename">.schemas</code> or <code xmlns=
                   12743:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12744:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    12745:             need to take some extra steps to make sure they get
                   12746:             registered in the database:</p>
                   12747: 
                   12748:             <div class="orderedlist">
                   12749:               <ol type="1">
                   12750:                 <li>
1.45      wiz      12751:                   <p>Include <code xmlns=
                   12752:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12753:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      12754:                   instead of its <code xmlns=
                   12755:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12756:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    12757:                   care of rebuilding the GConf2 database at
                   12758:                   installation and deinstallation time, and tells
                   12759:                   the package where to install GConf2 data files
                   12760:                   using some standard configure arguments. It also
                   12761:                   disallows any access to the database directly
                   12762:                   from the package.</p>
                   12763:                 </li>
                   12764: 
                   12765:                 <li>
                   12766:                   <p>Ensure that the package installs its
1.45      wiz      12767:                   <code xmlns=
                   12768:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12769:                   "filename">.schemas</code> files under
                   12770:                   <code xmlns=
                   12771:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12772:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      12773:                   If they get installed under <code xmlns=
                   12774:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12775:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    12776:                   manually patch the package.</p>
                   12777:                 </li>
                   12778: 
                   12779:                 <li>
                   12780:                   <p>Check the PLIST and remove any entries under
                   12781:                   the etc/gconf directory, as they will be handled
                   12782:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    12783:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   12784:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     12785:                   location of configuration files?&#8221;</a> for
                   12786:                   more information.</p>
1.1       grant    12787:                 </li>
                   12788: 
                   12789:                 <li>
1.14      xtraeme  12790:                   <p>Define the <code class=
                   12791:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      12792:                   <code xmlns=
                   12793:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12794:                   "filename">Makefile</code> with a list of all
                   12795:                   <code xmlns=
                   12796:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12797:                   "filename">.schemas</code> files installed by the
                   12798:                   package, if any. Names must not contain any
                   12799:                   directories in them.</p>
1.1       grant    12800:                 </li>
                   12801: 
                   12802:                 <li>
1.14      xtraeme  12803:                   <p>Define the <code class=
                   12804:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      12805:                   <code xmlns=
                   12806:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12807:                   "filename">Makefile</code> with a list of all
                   12808:                   <code xmlns=
                   12809:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12810:                   "filename">.entries</code> files installed by the
                   12811:                   package, if any. Names must not contain any
                   12812:                   directories in them.</p>
1.1       grant    12813:                 </li>
                   12814:               </ol>
                   12815:             </div>
                   12816:           </div>
                   12817: 
                   12818:           <div class="sect2" lang="en" xml:lang="en">
                   12819:             <div class="titlepage">
                   12820:               <div>
                   12821:                 <div>
1.30      wiz      12822:                   <h3 class="title"><a name=
                   12823:                   "scrollkeeper-data-files" id=
1.38      dillo    12824:                   "scrollkeeper-data-files"></a>15.5.9.&nbsp;Packages
1.30      wiz      12825:                   installing scrollkeeper data files</h3>
1.1       grant    12826:                 </div>
                   12827:               </div>
                   12828:             </div>
                   12829: 
1.45      wiz      12830:             <p>If a package installs <code xmlns=
                   12831:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12832:             "filename">.omf</code> files, used by scrollkeeper, you
                   12833:             need to take some extra steps to make sure they get
                   12834:             registered in the database:</p>
1.1       grant    12835: 
                   12836:             <div class="orderedlist">
                   12837:               <ol type="1">
                   12838:                 <li>
1.45      wiz      12839:                   <p>Include <code xmlns=
                   12840:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12841:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      12842:                   instead of its <code xmlns=
                   12843:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12844:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    12845:                   care of rebuilding the scrollkeeper database at
                   12846:                   installation and deinstallation time, and
                   12847:                   disallows any access to it directly from the
                   12848:                   package.</p>
                   12849:                 </li>
                   12850: 
                   12851:                 <li>
                   12852:                   <p>Check the PLIST and remove any entries under
1.45      wiz      12853:                   the <code xmlns=
                   12854:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12855:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    12856:                   as they will be handled automatically.</p>
                   12857:                 </li>
                   12858: 
                   12859:                 <li>
1.45      wiz      12860:                   <p>Remove the <code xmlns=
                   12861:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12862:                   "filename">share/omf</code> directory from the
                   12863:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    12864:                 </li>
                   12865:               </ol>
                   12866:             </div>
                   12867:           </div>
                   12868: 
                   12869:           <div class="sect2" lang="en" xml:lang="en">
                   12870:             <div class="titlepage">
                   12871:               <div>
                   12872:                 <div>
1.30      wiz      12873:                   <h3 class="title"><a name="x11-fonts" id=
1.38      dillo    12874:                   "x11-fonts"></a>15.5.10.&nbsp;Packages installing
1.1       grant    12875:                   X11 fonts</h3>
                   12876:                 </div>
                   12877:               </div>
                   12878:             </div>
                   12879: 
                   12880:             <p>If a package installs font files, you will need to
                   12881:             rebuild the fonts database in the directory where they
                   12882:             get installed at installation and deinstallation time.
1.45      wiz      12883:             This can be automatically done by using <code xmlns=
                   12884:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12885:             "filename">mk/fonts.mk</code>, which you need to
1.45      wiz      12886:             include in your <code xmlns=
                   12887:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12888:             "filename">Makefile</code>.</p>
1.1       grant    12889: 
                   12890:             <p>When the file is included, you can list the
1.14      xtraeme  12891:             directories where fonts are installed in the
                   12892:             <code class="varname">FONTS_<em class=
                   12893:             "replaceable"><code>type</code></em>_DIRS</code>
                   12894:             variables, where <em class=
                   12895:             "replaceable"><code>type</code></em> can be one of
                   12896:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    12897:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   12898:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.45      wiz      12899:             sure that the database file <code xmlns=
                   12900:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12901:             "filename">fonts.dir</code> is not listed in the
1.1       grant    12902:             PLIST.</p>
                   12903: 
                   12904:             <p>Note that you should not create new directories for
                   12905:             fonts; instead use the standard ones to avoid that the
                   12906:             user needs to manually configure his X server to find
                   12907:             them.</p>
                   12908:           </div>
                   12909: 
                   12910:           <div class="sect2" lang="en" xml:lang="en">
                   12911:             <div class="titlepage">
                   12912:               <div>
                   12913:                 <div>
1.30      wiz      12914:                   <h3 class="title"><a name="gtk2-modules" id=
1.38      dillo    12915:                   "gtk2-modules"></a>15.5.11.&nbsp;Packages
1.30      wiz      12916:                   installing GTK2 modules</h3>
1.1       grant    12917:                 </div>
                   12918:               </div>
                   12919:             </div>
                   12920: 
1.47      reed     12921:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    12922:             need to take some extra steps to get them registered in
                   12923:             the GTK2 database properly:</p>
                   12924: 
                   12925:             <div class="orderedlist">
                   12926:               <ol type="1">
                   12927:                 <li>
1.45      wiz      12928:                   <p>Include <code xmlns=
                   12929:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12930:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      12931:                   instead of its <code xmlns=
                   12932:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12933:                   "filename">buildlink3.mk</code> file. This takes
                   12934:                   care of rebuilding the database at installation
                   12935:                   and deinstallation time.</p>
1.1       grant    12936:                 </li>
                   12937: 
                   12938:                 <li>
1.14      xtraeme  12939:                   <p>Set <code class=
                   12940:                   "varname">GTK2_IMMODULES=YES</code> if your
                   12941:                   package installs GTK2 immodules.</p>
1.1       grant    12942:                 </li>
                   12943: 
                   12944:                 <li>
1.14      xtraeme  12945:                   <p>Set <code class=
                   12946:                   "varname">GTK2_LOADERS=YES</code> if your package
                   12947:                   installs GTK2 loaders.</p>
1.1       grant    12948:                 </li>
                   12949: 
                   12950:                 <li>
1.47      reed     12951:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    12952:                   databases directly. These are:</p>
                   12953: 
                   12954:                   <div class="itemizedlist">
                   12955:                     <ul type="disc">
                   12956:                       <li>
1.45      wiz      12957:                         <p><code xmlns=
                   12958:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12959:                         class=
1.14      xtraeme  12960:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    12961:                       </li>
                   12962: 
                   12963:                       <li>
1.45      wiz      12964:                         <p><code xmlns=
                   12965:                         "http://www.w3.org/TR/xhtml1/transitional"
                   12966:                         class=
1.14      xtraeme  12967:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    12968:                       </li>
                   12969:                     </ul>
                   12970:                   </div>
                   12971:                 </li>
                   12972: 
                   12973:                 <li>
                   12974:                   <p>Check the PLIST and remove any entries under
1.45      wiz      12975:                   the <code xmlns=
                   12976:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12977:                   "filename">libdata/gtk-2.0</code> directory, as
                   12978:                   they will be handled automatically.</p>
1.1       grant    12979:                 </li>
                   12980:               </ol>
                   12981:             </div>
                   12982:           </div>
                   12983: 
                   12984:           <div class="sect2" lang="en" xml:lang="en">
                   12985:             <div class="titlepage">
                   12986:               <div>
                   12987:                 <div>
1.30      wiz      12988:                   <h3 class="title"><a name="sgml-xml-data" id=
1.38      dillo    12989:                   "sgml-xml-data"></a>15.5.12.&nbsp;Packages
1.30      wiz      12990:                   installing SGML or XML data</h3>
1.1       grant    12991:                 </div>
                   12992:               </div>
                   12993:             </div>
                   12994: 
                   12995:             <p>If a package installs SGML or XML data files that
                   12996:             need to be registered in system-wide catalogs (like
                   12997:             DTDs, sub-catalogs, etc.), you need to take some extra
                   12998:             steps:</p>
                   12999: 
                   13000:             <div class="orderedlist">
                   13001:               <ol type="1">
                   13002:                 <li>
1.45      wiz      13003:                   <p>Include <code xmlns=
                   13004:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13005:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      13006:                   in your <code xmlns=
                   13007:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13008:                   "filename">Makefile</code>, which takes care of
                   13009:                   registering those files in system-wide catalogs
                   13010:                   at installation and deinstallation time.</p>
1.1       grant    13011:                 </li>
                   13012: 
                   13013:                 <li>
1.14      xtraeme  13014:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   13015:                   to the full path of any SGML catalogs installed
                   13016:                   by the package.</p>
1.1       grant    13017:                 </li>
                   13018: 
                   13019:                 <li>
1.14      xtraeme  13020:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   13021:                   to the full path of any XML catalogs installed by
1.1       grant    13022:                   the package.</p>
                   13023:                 </li>
                   13024: 
                   13025:                 <li>
1.14      xtraeme  13026:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   13027:                   to individual entries to be added to the SGML
1.1       grant    13028:                   catalog. These come in groups of three strings;
                   13029:                   see xmlcatmgr(1) for more information
                   13030:                   (specifically, arguments recognized by the 'add'
                   13031:                   action). Note that you will normally not use this
                   13032:                   variable.</p>
                   13033:                 </li>
                   13034: 
                   13035:                 <li>
1.14      xtraeme  13036:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   13037:                   to individual entries to be added to the XML
1.1       grant    13038:                   catalog. These come in groups of three strings;
                   13039:                   see xmlcatmgr(1) for more information
                   13040:                   (specifically, arguments recognized by the 'add'
                   13041:                   action). Note that you will normally not use this
                   13042:                   variable.</p>
                   13043:                 </li>
                   13044:               </ol>
                   13045:             </div>
                   13046:           </div>
                   13047: 
                   13048:           <div class="sect2" lang="en" xml:lang="en">
                   13049:             <div class="titlepage">
                   13050:               <div>
                   13051:                 <div>
1.30      wiz      13052:                   <h3 class="title"><a name="mime-database" id=
1.38      dillo    13053:                   "mime-database"></a>15.5.13.&nbsp;Packages
1.30      wiz      13054:                   installing extensions to the MIME database</h3>
1.1       grant    13055:                 </div>
                   13056:               </div>
                   13057:             </div>
                   13058: 
                   13059:             <p>If a package provides extensions to the MIME
1.45      wiz      13060:             database by installing <code xmlns=
                   13061:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13062:             "filename">.xml</code> files inside <code xmlns=
                   13063:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13064:             "filename">${PREFIX}/share/mime/packages</code>, you
                   13065:             need to take some extra steps to ensure that the
                   13066:             database is kept consistent with respect to these new
                   13067:             files:</p>
1.1       grant    13068: 
                   13069:             <div class="orderedlist">
                   13070:               <ol type="1">
                   13071:                 <li>
1.45      wiz      13072:                   <p>Include <code xmlns=
                   13073:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13074:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      13075:                   (avoid using the <code xmlns=
                   13076:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13077:                   "filename">buildlink3.mk</code> file from this
                   13078:                   same directory, which is reserved for inclusion
1.45      wiz      13079:                   from other <code xmlns=
                   13080:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13081:                   "filename">buildlink3.mk</code> files). It takes
                   13082:                   care of rebuilding the MIME database at
                   13083:                   installation and deinstallation time, and
                   13084:                   disallows any access to it directly from the
1.1       grant    13085:                   package.</p>
                   13086:                 </li>
                   13087: 
                   13088:                 <li>
                   13089:                   <p>Check the PLIST and remove any entries under
1.45      wiz      13090:                   the <code xmlns=
                   13091:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13092:                   "filename">share/mime</code> directory,
                   13093:                   <span class="emphasis"><em>except</em></span> for
                   13094:                   files saved under <code xmlns=
                   13095:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13096:                   "filename">share/mime/packages</code>. The former
1.1       grant    13097:                   are handled automatically by the
1.47      reed     13098:                   update-mime-database program, but the latter are
1.1       grant    13099:                   package-dependent and must be removed by the
                   13100:                   package that installed them in the first
                   13101:                   place.</p>
                   13102:                 </li>
                   13103: 
                   13104:                 <li>
1.45      wiz      13105:                   <p>Remove any <code xmlns=
                   13106:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13107:                   "filename">share/mime/*</code> directories from
                   13108:                   the PLIST. They will be handled by the
1.1       grant    13109:                   shared-mime-info package.</p>
                   13110:                 </li>
                   13111:               </ol>
                   13112:             </div>
                   13113:           </div>
                   13114: 
                   13115:           <div class="sect2" lang="en" xml:lang="en">
                   13116:             <div class="titlepage">
                   13117:               <div>
                   13118:                 <div>
1.30      wiz      13119:                   <h3 class="title"><a name="intltool" id=
1.38      dillo    13120:                   "intltool"></a>15.5.14.&nbsp;Packages using
1.1       grant    13121:                   intltool</h3>
                   13122:                 </div>
                   13123:               </div>
                   13124:             </div>
                   13125: 
                   13126:             <p>If a package uses intltool during its build, include
1.45      wiz      13127:             the <code xmlns=
                   13128:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13129:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    13130:             file, which forces it to use the intltool package
                   13131:             provided by pkgsrc, instead of the one bundled with the
                   13132:             distribution file.</p>
                   13133: 
                   13134:             <p>This tracks intltool's build-time dependencies and
                   13135:             uses the latest available version; this way, the
                   13136:             package benefits of any bug fixes that may have
                   13137:             appeared since it was released.</p>
                   13138:           </div>
1.18      xtraeme  13139: 
                   13140:           <div class="sect2" lang="en" xml:lang="en">
                   13141:             <div class="titlepage">
                   13142:               <div>
                   13143:                 <div>
1.30      wiz      13144:                   <h3 class="title"><a name="startup-scripts" id=
1.38      dillo    13145:                   "startup-scripts"></a>15.5.15.&nbsp;Packages
1.30      wiz      13146:                   installing startup scripts</h3>
1.18      xtraeme  13147:                 </div>
                   13148:               </div>
                   13149:             </div>
                   13150: 
                   13151:             <p>If a package contains a rc.d script, it won't be
                   13152:             copied into the startup directory by default, but you
                   13153:             can enable it, by adding the option <code class=
1.45      wiz      13154:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   13155:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13156:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      13157:             the scripts into <code xmlns=
                   13158:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  13159:             "filename">/etc/rc.d</code> when a package is
                   13160:             installed, and it will automatically remove the scripts
                   13161:             when the package is deinstalled.</p>
                   13162:           </div>
1.1       grant    13163:         </div>
                   13164: 
                   13165:         <div class="sect1" lang="en" xml:lang="en">
                   13166:           <div class="titlepage">
                   13167:             <div>
                   13168:               <div>
                   13169:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13170:                 "feedback-to-author" id=
1.38      dillo    13171:                 "feedback-to-author"></a>15.6.&nbsp;Feedback to the
1.30      wiz      13172:                 author</h2>
1.1       grant    13173:               </div>
                   13174:             </div>
                   13175:           </div>
                   13176: 
                   13177:           <p>If you have found any bugs in the package you make
                   13178:           available, if you had to do special steps to make it run
                   13179:           under NetBSD or if you enhanced the software in various
                   13180:           other ways, be sure to report these changes back to the
                   13181:           original author of the program! With that kind of
                   13182:           support, the next release of the program can incorporate
                   13183:           these fixes, and people not using the NetBSD packages
                   13184:           system can win from your efforts.</p>
                   13185: 
                   13186:           <p>Support the idea of free software!</p>
                   13187:         </div>
                   13188:       </div>
                   13189: 
                   13190:       <div class="chapter" lang="en" xml:lang="en">
                   13191:         <div class="titlepage">
                   13192:           <div>
                   13193:             <div>
                   13194:               <h2 class="title"><a name="debug" id=
1.38      dillo    13195:               "debug"></a>Chapter&nbsp;16.&nbsp;Debugging</h2>
1.1       grant    13196:             </div>
                   13197:           </div>
                   13198:         </div>
                   13199: 
                   13200:         <p>To check out all the gotchas when building a package,
                   13201:         here are the steps that I do in order to get a package
                   13202:         working. Please note this is basically the same as what was
                   13203:         explained in the previous sections, only with some
                   13204:         debugging aids.</p>
                   13205: 
                   13206:         <div class="itemizedlist">
                   13207:           <ul type="disc">
                   13208:             <li>
1.14      xtraeme  13209:               <p>Be sure to set <code class=
1.45      wiz      13210:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   13211:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13212:               "filename">/etc/mk.conf</code></p>
1.1       grant    13213:             </li>
                   13214: 
                   13215:             <li>
                   13216:               <p>Install <a xmlns=
                   13217:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13218:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      13219:               target="_top"><code xmlns="" class=
                   13220:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      13221:               directory for a new package, change into it, then run
                   13222:               <span><strong class=
                   13223:               "command">url2pkg</strong></span>:</p>
1.1       grant    13224:               <pre class="screen">
1.14      xtraeme  13225: <code class="prompt">%</code> <strong class=
                   13226: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   13227: "replaceable"><code>category</code></em>/<em class=
                   13228: "replaceable"><code>examplepkg</code></em></code></strong>
                   13229: <code class="prompt">%</code> <strong class=
                   13230: "userinput"><code>cd /usr/pkgsrc/<em class=
                   13231: "replaceable"><code>category</code></em>/<em class=
                   13232: "replaceable"><code>examplepkg</code></em></code></strong>
                   13233: <code class="prompt">%</code> <strong class=
                   13234: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    13235: </pre>
                   13236:             </li>
                   13237: 
                   13238:             <li>
1.45      wiz      13239:               <p>Edit the <code xmlns=
                   13240:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13241:               "filename">Makefile</code> as requested.</p>
1.1       grant    13242:             </li>
                   13243: 
                   13244:             <li>
1.45      wiz      13245:               <p>Fill in the <code xmlns=
                   13246:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13247:               "filename">DESCR</code> file</p>
1.1       grant    13248:             </li>
                   13249: 
                   13250:             <li>
1.14      xtraeme  13251:               <p>Run <span><strong class="command">make
                   13252:               configure</strong></span></p>
1.1       grant    13253:             </li>
                   13254: 
                   13255:             <li>
                   13256:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      13257:               and the configure step to the package's <code xmlns=
                   13258:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13259:               "filename">Makefile</code>.</p>
1.1       grant    13260:             </li>
                   13261: 
                   13262:             <li>
                   13263:               <p>Make the package compile, doing multiple rounds
                   13264:               of</p>
                   13265:               <pre class="screen">
1.14      xtraeme  13266: <code class="prompt">%</code> <strong class=
                   13267: "userinput"><code>make</code></strong>
                   13268: <code class="prompt">%</code> <strong class=
                   13269: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   13270: <code class="prompt">%</code> <strong class=
                   13271: "userinput"><code>mkpatches</code></strong>
                   13272: <code class="prompt">%</code> <strong class=
                   13273: "userinput"><code>patchdiff</code></strong>
                   13274: <code class="prompt">%</code> <strong class=
                   13275: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   13276: <code class="prompt">%</code> <strong class=
                   13277: "userinput"><code>make mps</code></strong>
                   13278: <code class="prompt">%</code> <strong class=
                   13279: "userinput"><code>make clean</code></strong>
1.1       grant    13280: </pre>
                   13281: 
                   13282:               <p>Doing as non-root user will ensure that no files
                   13283:               are modified that shouldn't be, especially during the
1.14      xtraeme  13284:               build phase. <span><strong class=
                   13285:               "command">mkpatches</strong></span>,
                   13286:               <span><strong class=
                   13287:               "command">patchdiff</strong></span> and
                   13288:               <span><strong class="command">pkgvi</strong></span>
                   13289:               are from the <a xmlns=
1.1       grant    13290:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13291:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      13292:               target="_top"><code xmlns="" class=
                   13293:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    13294:             </li>
                   13295: 
                   13296:             <li>
1.45      wiz      13297:               <p>Look at the <code xmlns=
                   13298:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13299:               "filename">Makefile</code>, fix if necessary; see
                   13300:               <a href="#components.Makefile" title=
1.38      dillo    13301:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      13302:               &#8220;<code xmlns=
                   13303:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13304:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    13305:             </li>
                   13306: 
                   13307:             <li>
1.45      wiz      13308:               <p>Generate a <code xmlns=
                   13309:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13310:               "filename">PLIST</code>:</p>
1.1       grant    13311:               <pre class="screen">
1.14      xtraeme  13312: <code class="prompt">#</code> <strong class=
                   13313: "userinput"><code>make install</code></strong>
                   13314: <code class="prompt">#</code> <strong class=
                   13315: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   13316: <code class="prompt">#</code> <strong class=
                   13317: "userinput"><code>make deinstall</code></strong>
                   13318: <code class="prompt">#</code> <strong class=
                   13319: "userinput"><code>make install</code></strong>
                   13320: <code class="prompt">#</code> <strong class=
                   13321: "userinput"><code>make deinstall</code></strong>
1.1       grant    13322: </pre>
                   13323: 
1.45      wiz      13324:               <p>You usually need to be <code xmlns=
                   13325:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13326:               "username">root</code> to do this. Look if there are
1.1       grant    13327:               any files left:</p>
                   13328:               <pre class="screen">
1.14      xtraeme  13329: <code class="prompt">#</code> <strong class=
                   13330: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    13331: </pre>
                   13332: 
                   13333:               <p>If this reveals any files that are missing in
1.45      wiz      13334:               <code xmlns=
                   13335:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13336:               "filename">PLIST</code>, add them.</p>
1.1       grant    13337:             </li>
                   13338: 
                   13339:             <li>
1.45      wiz      13340:               <p>Now that the <code xmlns=
                   13341:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   13342:               "filename">PLIST</code> is OK, install the package
                   13343:               again and make a binary package:</p>
1.1       grant    13344:               <pre class="screen">
1.14      xtraeme  13345: <code class="prompt">#</code> <strong class=
                   13346: "userinput"><code>make reinstall</code></strong>
                   13347: <code class="prompt">#</code> <strong class=
                   13348: "userinput"><code>make package</code></strong>
1.1       grant    13349: </pre>
                   13350:             </li>
                   13351: 
                   13352:             <li>
                   13353:               <p>Delete the installed package:</p>
                   13354:               <pre class="screen">
1.14      xtraeme  13355: <code class="prompt">#</code> <strong class=
                   13356: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    13357: </pre>
                   13358:             </li>
                   13359: 
                   13360:             <li>
1.14      xtraeme  13361:               <p>Repeat the above <span><strong class=
                   13362:               "command">make print-PLIST</strong></span> command,
                   13363:               which shouldn't find anything now:</p>
1.1       grant    13364:               <pre class="screen">
1.14      xtraeme  13365: <code class="prompt">#</code> <strong class=
                   13366: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    13367: </pre>
                   13368:             </li>
                   13369: 
                   13370:             <li>
                   13371:               <p>Reinstall the binary package:</p>
                   13372:               <pre class="screen">
1.14      xtraeme  13373: <code class="prompt">#</code> <strong class=
                   13374: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    13375: </pre>
                   13376:             </li>
                   13377: 
                   13378:             <li>
                   13379:               <p>Play with it. Make sure everything works.</p>
                   13380:             </li>
                   13381: 
                   13382:             <li>
1.14      xtraeme  13383:               <p>Run <span><strong class=
                   13384:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    13385:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   13386:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      13387:               target="_top"><code xmlns="" class=
                   13388:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      13389:               problems it reports:</p>
1.1       grant    13390:               <pre class="screen">
1.14      xtraeme  13391: <code class="prompt">#</code> <strong class=
                   13392: "userinput"><code>pkglint</code></strong>
1.1       grant    13393: </pre>
                   13394:             </li>
                   13395: 
                   13396:             <li>
                   13397:               <p>Submit (or commit, if you have cvs access); see
                   13398:               <a href="#submit" title=
1.38      dillo    13399:               "Chapter&nbsp;17.&nbsp;Submitting and Committing">Chapter&nbsp;17,
1.1       grant    13400:               <i>Submitting and Committing</i></a>.</p>
                   13401:             </li>
                   13402:           </ul>
                   13403:         </div>
                   13404:       </div>
                   13405: 
                   13406:       <div class="chapter" lang="en" xml:lang="en">
                   13407:         <div class="titlepage">
                   13408:           <div>
                   13409:             <div>
                   13410:               <h2 class="title"><a name="submit" id=
1.38      dillo    13411:               "submit"></a>Chapter&nbsp;17.&nbsp;Submitting and
1.1       grant    13412:               Committing</h2>
                   13413:             </div>
                   13414:           </div>
                   13415:         </div>
                   13416: 
                   13417:         <div class="toc">
                   13418:           <p><b>Table of Contents</b></p>
                   13419: 
                   13420:           <dl>
1.30      wiz      13421:             <dt><span class="sect1"><a href=
1.38      dillo    13422:             "#submitting-your-package">17.1. Submitting your
1.30      wiz      13423:             packages</a></span></dt>
1.1       grant    13424: 
1.30      wiz      13425:             <dt><span class="sect1"><a href=
1.41      wiz      13426:             "#general-notes-for-changes">17.2. General notes when
                   13427:             adding, updating, or removing packages</a></span></dt>
                   13428: 
                   13429:             <dt><span class="sect1"><a href=
                   13430:             "#committing-importing">17.3. Committing: Importing a
1.30      wiz      13431:             package into CVS</a></span></dt>
1.1       grant    13432: 
1.30      wiz      13433:             <dt><span class="sect1"><a href=
1.41      wiz      13434:             "#updating-package">17.4. Updating a package to a newer
1.30      wiz      13435:             version</a></span></dt>
1.1       grant    13436: 
1.41      wiz      13437:             <dt><span class="sect1"><a href="#moving-package">17.5.
1.2       hubertf  13438:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    13439:           </dl>
                   13440:         </div>
                   13441: 
                   13442:         <div class="sect1" lang="en" xml:lang="en">
                   13443:           <div class="titlepage">
                   13444:             <div>
                   13445:               <div>
                   13446:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13447:                 "submitting-your-package" id=
1.38      dillo    13448:                 "submitting-your-package"></a>17.1.&nbsp;Submitting
1.30      wiz      13449:                 your packages</h2>
1.1       grant    13450:               </div>
                   13451:             </div>
                   13452:           </div>
                   13453: 
                   13454:           <p>You have to separate between binary and
                   13455:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   13456:           packages here:</p>
                   13457: 
                   13458:           <div class="itemizedlist">
                   13459:             <ul type="disc">
                   13460:               <li>
                   13461:                 <p>precompiled binary packages</p>
                   13462: 
                   13463:                 <p>Our policy is that we accept binaries only from
                   13464:                 pkgsrc developers to guarantee that the packages
                   13465:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  13466:                 annoy anyone but rather to protect our users!
1.1       grant    13467:                 You're still free to put up your home-made binary
1.13      hubertf  13468:                 packages and tell the world where to get them.
                   13469:                 NetBSD developers doing bulk builds and wanting to
                   13470:                 upload them please see <a href="#bulk-upload"
1.38      dillo    13471:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   13472:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  13473:                 bulk build&#8221;</a>.</p>
1.1       grant    13474:               </li>
                   13475: 
                   13476:               <li>
                   13477:                 <p>packages</p>
                   13478: 
                   13479:                 <p>First, check that your package is complete,
                   13480:                 compiles and runs well; see <a href="#debug" title=
1.38      dillo    13481:                 "Chapter&nbsp;16.&nbsp;Debugging">Chapter&nbsp;16,
1.1       grant    13482:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      13483:                 Next, generate an uuencoded gzipped <a href=
                   13484:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   13485:                 <span class="citerefentry"><span class=
                   13486:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    13487:                 preferably with all files in a single directory.
1.14      xtraeme  13488:                 Finally, <span><strong class=
                   13489:                 "command">send-pr</strong></span> with category
1.1       grant    13490:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   13491:                 synopsis which includes the package name and
                   13492:                 version number, a short description of your package
                   13493:                 (contents of the COMMENT variable or DESCR file are
                   13494:                 OK) and attach the archive to your PR.</p>
                   13495: 
                   13496:                 <p>If you want to submit several packages, please
                   13497:                 send a separate PR for each one, it's easier for us
                   13498:                 to track things that way.</p>
                   13499: 
                   13500:                 <p>Alternatively, you can also import new packages
                   13501:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   13502:                 work-in-progress</span>&#8221;); see the homepage
                   13503:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   13504:                 target=
                   13505:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   13506:                 details.</p>
                   13507:               </li>
                   13508:             </ul>
                   13509:           </div>
                   13510:         </div>
                   13511: 
                   13512:         <div class="sect1" lang="en" xml:lang="en">
                   13513:           <div class="titlepage">
                   13514:             <div>
                   13515:               <div>
                   13516:                 <h2 class="title" style="clear: both"><a name=
1.41      wiz      13517:                 "general-notes-for-changes" id=
                   13518:                 "general-notes-for-changes"></a>17.2.&nbsp;General
                   13519:                 notes when adding, updating, or removing
                   13520:                 packages</h2>
                   13521:               </div>
                   13522:             </div>
                   13523:           </div>
                   13524: 
                   13525:           <p>Please note all package additions, updates, moves, and
1.45      wiz      13526:           removals in <code xmlns=
                   13527:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13528:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   13529:           to keep this file up to date and conforming to the
                   13530:           existing format, because it will be used by scripts to
                   13531:           automatically update pages on <a href=
                   13532:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      13533:           and other sites. Additionally, check the <code xmlns=
                   13534:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13535:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   13536:           entry for the package you updated or removed, in case it
                   13537:           was mentioned there.</p>
                   13538: 
                   13539:           <p>There is a make target that helps in creating proper
1.45      wiz      13540:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13541:           class="filename">CHANGES</code> entries:
1.41      wiz      13542:           <span><strong class="command">make
                   13543:           changes-entry</strong></span>. It uses the optional
                   13544:           <code class="varname">CTYPE</code> and <code class=
                   13545:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      13546:           usage is to first make sure that your <code xmlns=
                   13547:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13548:           "filename">CHANGES</code> file is up-to-date (to avoid
                   13549:           having to resolve conflicts later-on) and then to
                   13550:           <span><strong class="command">cd</strong></span> to the
                   13551:           package directory. For package updates,
                   13552:           <span><strong class="command">make
                   13553:           changes-entry</strong></span> is enough. For new
                   13554:           packages, or package moves or removals, set the
                   13555:           <code class="varname">CTYPE</code> variable on the
                   13556:           command line to "Added", "Moved", or "Removed". You can
                   13557:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      13558:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13559:           class="filename">/etc/mk.conf</code> if your local login
                   13560:           name is not the same as your NetBSD login name. Don't
                   13561:           forget to commit the changes to <code xmlns=
                   13562:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      13563:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   13564:         </div>
                   13565: 
                   13566:         <div class="sect1" lang="en" xml:lang="en">
                   13567:           <div class="titlepage">
                   13568:             <div>
                   13569:               <div>
                   13570:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13571:                 "committing-importing" id=
1.41      wiz      13572:                 "committing-importing"></a>17.3.&nbsp;Committing:
1.30      wiz      13573:                 Importing a package into CVS</h2>
1.1       grant    13574:               </div>
                   13575:             </div>
                   13576:           </div>
                   13577: 
                   13578:           <p>This section is only of interest for pkgsrc developers
                   13579:           with write access to the pkgsrc repository. Please
                   13580:           remember that cvs imports files relative to the current
                   13581:           working directory, and that the pathname that you give
1.14      xtraeme  13582:           the <span><strong class="command">cvs
                   13583:           import</strong></span> command is so that it knows where
                   13584:           to place the files in the repository. Newly created
                   13585:           packages should be imported with a vendor tag of
                   13586:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   13587:           release tag of &#8220;<span class=
                   13588:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    13589:           <pre class="programlisting">
                   13590:   % cd .../pkgsrc/category/pkgname
                   13591:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   13592: </pre>
                   13593: 
                   13594:           <p>Remember to move the directory from which you imported
                   13595:           out of the way, or cvs will complain the next time you
                   13596:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   13597:           source tree. Also don't forget to add the new package to
1.45      wiz      13598:           the category's <code xmlns=
                   13599:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13600:           "filename">Makefile</code>.</p>
1.1       grant    13601: 
                   13602:           <p>The commit message of the initial import should
1.45      wiz      13603:           include part of the <code xmlns=
                   13604:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   13605:           "filename">DESCR</code> file, so people reading the
                   13606:           mailing lists know what the package is/does.</p>
1.1       grant    13607: 
                   13608:           <p>For new packages, &#8220;<span class="quote">cvs
                   13609:           import</span>&#8221; is preferred to &#8220;<span class=
                   13610:           "quote">cvs add</span>&#8221; because the former gets
                   13611:           everything with a single command, and provides a
                   13612:           consistent tag.</p>
                   13613:         </div>
                   13614: 
                   13615:         <div class="sect1" lang="en" xml:lang="en">
                   13616:           <div class="titlepage">
                   13617:             <div>
                   13618:               <div>
                   13619:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13620:                 "updating-package" id=
1.41      wiz      13621:                 "updating-package"></a>17.4.&nbsp;Updating a
1.30      wiz      13622:                 package to a newer version</h2>
1.1       grant    13623:               </div>
                   13624:             </div>
                   13625:           </div>
                   13626: 
                   13627:           <p>Please always put a concise, appropriate and relevant
                   13628:           summary of the changes between old and new versions into
                   13629:           the commit log when updating a package. There are various
                   13630:           reasons for this:</p>
                   13631: 
                   13632:           <div class="itemizedlist">
                   13633:             <ul type="disc">
                   13634:               <li>
                   13635:                 <p>A URL is volatile, and can change over time. It
                   13636:                 may go away completely or its information may be
                   13637:                 overwritten by newer information.</p>
                   13638:               </li>
                   13639: 
                   13640:               <li>
                   13641:                 <p>Having the change information between old and
                   13642:                 new versions in our CVS repository is very useful
                   13643:                 for people who use either cvs or anoncvs.</p>
                   13644:               </li>
                   13645: 
                   13646:               <li>
                   13647:                 <p>Having the change information between old and
                   13648:                 new versions in our CVS repository is very useful
                   13649:                 for people who read the pkgsrc-changes mailing
                   13650:                 list, so that they can make tactical decisions
                   13651:                 about when to upgrade the package.</p>
                   13652:               </li>
                   13653:             </ul>
                   13654:           </div>
                   13655: 
1.18      xtraeme  13656:           <p>Please also recognize that, just because a new version
1.1       grant    13657:           of a package has been released, it should not
                   13658:           automatically be upgraded in the CVS repository. We
                   13659:           prefer to be conservative in the packages that are
                   13660:           included in pkgsrc - development or beta packages are not
                   13661:           really the best thing for most places in which pkgsrc is
                   13662:           used. Please use your judgement about what should go into
                   13663:           pkgsrc, and bear in mind that stability is to be
                   13664:           preferred above new and possibly untested features.</p>
                   13665:         </div>
                   13666: 
                   13667:         <div class="sect1" lang="en" xml:lang="en">
                   13668:           <div class="titlepage">
                   13669:             <div>
                   13670:               <div>
                   13671:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      13672:                 "moving-package" id=
1.41      wiz      13673:                 "moving-package"></a>17.5.&nbsp;Moving a package in
1.30      wiz      13674:                 pkgsrc</h2>
1.1       grant    13675:               </div>
                   13676:             </div>
                   13677:           </div>
                   13678: 
                   13679:           <div class="orderedlist">
                   13680:             <ol type="1">
                   13681:               <li>
                   13682:                 <p>Make a copy of the directory somewhere else.</p>
                   13683:               </li>
                   13684: 
                   13685:               <li>
                   13686:                 <p>Remove all CVS dirs.</p>
                   13687: 
                   13688:                 <p>Alternatively to the first two steps you can
                   13689:                 also do:</p>
                   13690:                 <pre class="screen">
1.14      xtraeme  13691: <code class="prompt">%</code> <strong class=
                   13692: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    13693: </pre>
                   13694: 
                   13695:                 <p>and use that for further work.</p>
                   13696:               </li>
                   13697: 
                   13698:               <li>
1.14      xtraeme  13699:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   13700:                 any <code class="varname">DEPENDS</code> paths that
                   13701:                 just did &#8220;<span class=
1.1       grant    13702:                 "quote">../package</span>&#8221; instead of
                   13703:                 &#8220;<span class=
                   13704:                 "quote">../../category/package</span>&#8221;.</p>
                   13705:               </li>
                   13706: 
                   13707:               <li>
1.14      xtraeme  13708:                 <p><span><strong class="command">cvs
                   13709:                 import</strong></span> the modified package in the
                   13710:                 new place.</p>
1.1       grant    13711:               </li>
                   13712: 
                   13713:               <li>
                   13714:                 <p>Check if any package depends on it:</p>
                   13715:                 <pre class="screen">
1.14      xtraeme  13716: <code class="prompt">%</code> <strong class=
                   13717: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   13718: <code class="prompt">%</code> <strong class=
                   13719: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    13720: </pre>
                   13721:               </li>
                   13722: 
                   13723:               <li>
                   13724:                 <p>Fix paths in packages from step 5 to point to
                   13725:                 new location.</p>
                   13726:               </li>
                   13727: 
                   13728:               <li>
1.14      xtraeme  13729:                 <p><span><strong class="command">cvs rm
                   13730:                 (-f)</strong></span> the package at the old
                   13731:                 location.</p>
1.1       grant    13732:               </li>
                   13733: 
                   13734:               <li>
1.45      wiz      13735:                 <p>Remove from <code xmlns=
                   13736:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13737:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    13738:               </li>
                   13739: 
                   13740:               <li>
1.45      wiz      13741:                 <p>Add to <code xmlns=
                   13742:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13743:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    13744:               </li>
                   13745: 
                   13746:               <li>
                   13747:                 <p>Commit the changed and removed files:</p>
                   13748:                 <pre class="screen">
1.14      xtraeme  13749: <code class="prompt">%</code> <strong class=
                   13750: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    13751: </pre>
                   13752: 
                   13753:                 <p>(and any packages from step 5, of course).</p>
                   13754:               </li>
                   13755:             </ol>
                   13756:           </div>
                   13757:         </div>
                   13758:       </div>
                   13759:     </div>
                   13760: 
                   13761:     <div class="appendix" lang="en" xml:lang="en">
                   13762:       <div class="titlepage">
                   13763:         <div>
                   13764:           <div>
                   13765:             <h2 class="title"><a name="examples" id=
1.46      gdt      13766:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    13767:             package: bison</h2>
                   13768:           </div>
                   13769:         </div>
                   13770:       </div>
                   13771: 
                   13772:       <div class="toc">
                   13773:         <p><b>Table of Contents</b></p>
                   13774: 
                   13775:         <dl>
1.46      gdt      13776:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    13777:           files</a></span></dt>
                   13778: 
                   13779:           <dd>
                   13780:             <dl>
1.30      wiz      13781:               <dt><span class="sect2"><a href=
1.46      gdt      13782:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    13783: 
1.30      wiz      13784:               <dt><span class="sect2"><a href=
1.46      gdt      13785:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    13786: 
1.30      wiz      13787:               <dt><span class="sect2"><a href=
1.46      gdt      13788:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    13789: 
1.30      wiz      13790:               <dt><span class="sect2"><a href=
1.46      gdt      13791:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      13792:               package with <span><strong class=
1.14      xtraeme  13793:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    13794:             </dl>
                   13795:           </dd>
                   13796: 
1.46      gdt      13797:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      13798:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    13799:         </dl>
                   13800:       </div>
                   13801: 
                   13802:       <p>We checked to find a piece of software that wasn't in the
                   13803:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  13804:       would want to have <span><strong class=
                   13805:       "command">bison</strong></span> when Berkeley
                   13806:       <span><strong class="command">yacc</strong></span> is already
                   13807:       present in the tree is beyond us, but it's useful for the
                   13808:       purposes of this exercise.</p>
1.1       grant    13809: 
                   13810:       <div class="sect1" lang="en" xml:lang="en">
                   13811:         <div class="titlepage">
                   13812:           <div>
                   13813:             <div>
                   13814:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13815:               "example-files" id=
1.46      gdt      13816:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    13817:             </div>
                   13818:           </div>
                   13819:         </div>
                   13820: 
                   13821:         <div class="sect2" lang="en" xml:lang="en">
                   13822:           <div class="titlepage">
                   13823:             <div>
                   13824:               <div>
1.30      wiz      13825:                 <h3 class="title"><a name="example-Makefile" id=
1.46      gdt      13826:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    13827:               </div>
                   13828:             </div>
                   13829:           </div>
                   13830:           <pre class="programlisting">
1.17      sketch   13831: # $NetBSD$
1.1       grant    13832: #
                   13833: 
                   13834: DISTNAME=       bison-1.25
                   13835: CATEGORIES=     devel
                   13836: MASTER_SITES=   ${MASTER_SITE_GNU}
                   13837: 
                   13838: MAINTAINER=     thorpej@NetBSD.org
                   13839: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   13840: COMMENT=        GNU yacc clone
                   13841: 
                   13842: GNU_CONFIGURE=  yes
                   13843: INFO_FILES=     bison.info
                   13844: 
                   13845: .include "../../mk/bsd.pkg.mk"
                   13846: </pre>
                   13847:         </div>
                   13848: 
                   13849:         <div class="sect2" lang="en" xml:lang="en">
                   13850:           <div class="titlepage">
                   13851:             <div>
                   13852:               <div>
1.30      wiz      13853:                 <h3 class="title"><a name="example-descr" id=
1.46      gdt      13854:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    13855:               </div>
                   13856:             </div>
                   13857:           </div>
                   13858:           <pre class="programlisting">
                   13859: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   13860: improvements.  Why you would want this when Berkeley <a href=
                   13861: "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
                   13862: of the NetBSD source tree is beyond me.
                   13863: </pre>
                   13864:         </div>
                   13865: 
                   13866:         <div class="sect2" lang="en" xml:lang="en">
                   13867:           <div class="titlepage">
                   13868:             <div>
                   13869:               <div>
1.30      wiz      13870:                 <h3 class="title"><a name="example-plist" id=
1.46      gdt      13871:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    13872:               </div>
                   13873:             </div>
                   13874:           </div>
                   13875:           <pre class="programlisting">
1.17      sketch   13876: @comment $NetBSD$
1.1       grant    13877: bin/bison
                   13878: man/man1/bison.1.gz
                   13879: share/bison.simple
                   13880: share/bison.hairy
                   13881: </pre>
                   13882:         </div>
                   13883: 
                   13884:         <div class="sect2" lang="en" xml:lang="en">
                   13885:           <div class="titlepage">
                   13886:             <div>
                   13887:               <div>
1.30      wiz      13888:                 <h3 class="title"><a name=
                   13889:                 "checking-package-with-pkglint" id=
1.46      gdt      13890:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      13891:                 a package with <span><strong class=
1.14      xtraeme  13892:                 "command">pkglint</strong></span></h3>
1.1       grant    13893:               </div>
                   13894:             </div>
                   13895:           </div>
                   13896: 
                   13897:           <p>The NetBSD package system comes with <a xmlns=
                   13898:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   13899:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      13900:           target="_top"><code xmlns="" class=
                   13901:           "filename">pkgtools/pkglint</code></a> which helps to
                   13902:           check the contents of these files. After installation it
                   13903:           is quite easy to use, just change to the directory of the
1.20      ben      13904:           package you wish to examine and execute
                   13905:           <span><strong class=
                   13906:           "command">pkglint</strong></span>:</p>
1.1       grant    13907:           <pre class="screen">
1.14      xtraeme  13908: <code class="prompt">$</code> <strong class=
                   13909: "userinput"><code>pkglint</code></strong>
1.1       grant    13910: looks fine.
                   13911: </pre>
                   13912: 
                   13913:           <p>Depending on the supplied command line arguments (see
1.47      reed     13914:           pkglint(1)), more verbose checks will be performed. Use
1.14      xtraeme  13915:           e.g. <span><strong class="command">pkglint
                   13916:           -v</strong></span> for a very verbose check.</p>
1.1       grant    13917:         </div>
                   13918:       </div>
                   13919: 
                   13920:       <div class="sect1" lang="en" xml:lang="en">
                   13921:         <div class="titlepage">
                   13922:           <div>
                   13923:             <div>
                   13924:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      13925:               "steps-for-b-i-p" id=
1.46      gdt      13926:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      13927:               installing, packaging</h2>
1.1       grant    13928:             </div>
                   13929:           </div>
                   13930:         </div>
                   13931: 
                   13932:         <p>Create the directory where the package lives, plus any
                   13933:         auxiliary directories:</p>
                   13934:         <pre class="screen">
1.14      xtraeme  13935: <code class="prompt">#</code> <strong class=
                   13936: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   13937: <code class="prompt">#</code> <strong class=
                   13938: "userinput"><code>mkdir bison</code></strong>
                   13939: <code class="prompt">#</code> <strong class=
                   13940: "userinput"><code>cd bison</code></strong>
                   13941: <code class="prompt">#</code> <strong class=
                   13942: "userinput"><code>mkdir patches</code></strong>
1.1       grant    13943: </pre>
                   13944: 
1.45      wiz      13945:         <p>Create <code xmlns=
                   13946:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   13947:         "filename">Makefile</code>, <code xmlns=
                   13948:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   13949:         "filename">DESCR</code> and <code xmlns=
                   13950:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13951:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    13952:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
                   13953:         Chapter 8, <i>Package components - files, directories and
1.1       grant    13954:         contents</i></a>) then continue with fetching the
                   13955:         distfile:</p>
                   13956:         <pre class="screen">
1.14      xtraeme  13957: <code class="prompt">#</code> <strong class=
                   13958: "userinput"><code>make fetch</code></strong>
1.1       grant    13959: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   13960: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   13961: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13962: ftp: Error retrieving file: 500 Internal error
                   13963: 
                   13964: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   13965: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13966: ftp: Error retrieving file: 500 Internal error
                   13967: 
                   13968: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   13969: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   13970: Successfully retrieved file.
                   13971: </pre>
                   13972: 
1.45      wiz      13973:         <p>Generate the checksum of the distfile into <code xmlns=
                   13974:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13975:         "filename">distinfo</code>:</p>
1.1       grant    13976:         <pre class="screen">
1.14      xtraeme  13977: <code class="prompt">#</code> <strong class=
                   13978: "userinput"><code>make makesum</code></strong>
1.1       grant    13979: </pre>
                   13980: 
                   13981:         <p>Now compile:</p>
                   13982:         <pre class="screen">
1.14      xtraeme  13983: <code class="prompt">#</code> <strong class=
                   13984: "userinput"><code>make</code></strong>
1.1       grant    13985: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   13986: ===&gt;  Extracting for bison-1.25
                   13987: ===&gt;  Patching for bison-1.25
                   13988: ===&gt;   Ignoring empty patch directory
                   13989: ===&gt;  Configuring for bison-1.25
                   13990: creating cache ./config.cache
                   13991: checking for gcc... cc
                   13992: checking whether we are using GNU C... yes
                   13993: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   13994: checking how to run the C preprocessor... cc -E
                   13995: checking for minix/config.h... no
                   13996: checking for POSIXized ISC... no
                   13997: checking whether cross-compiling... no
                   13998: checking for ANSI C header files... yes
                   13999: checking for string.h... yes
                   14000: checking for stdlib.h... yes
                   14001: checking for memory.h... yes
                   14002: checking for working const... yes
                   14003: checking for working alloca.h... no
                   14004: checking for alloca... yes
                   14005: checking for strerror... yes
                   14006: updating cache ./config.cache
                   14007: creating ./config.status
                   14008: creating Makefile
                   14009: ===&gt;  Building for bison-1.25
                   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 LR0.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 allocate.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 closure.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 conflicts.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 derives.c
                   14015: 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 
                   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 getargs.c
                   14017: 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
                   14018: 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
                   14019: 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
                   14020: 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
                   14021: 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
                   14022: 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
                   14023: 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
                   14024: 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
                   14025: 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
                   14026: 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
                   14027: 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
                   14028: 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
                   14029: 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
                   14030: 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
                   14031: 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
                   14032: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   14033: rm -f bison.s1
                   14034: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   14035: </pre>
                   14036: 
                   14037:         <p>Everything seems OK, so install the files:</p>
                   14038:         <pre class="screen">
1.14      xtraeme  14039: <code class="prompt">#</code> <strong class=
                   14040: "userinput"><code>make install</code></strong>
1.1       grant    14041: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14042: ===&gt;  Installing for bison-1.25
                   14043: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   14044: rm -f /usr/pkg/bin/bison
                   14045: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   14046: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   14047: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   14048: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   14049: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   14050: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   14051: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   14052: ===&gt;  Registering installation for bison-1.25
                   14053: </pre>
                   14054: 
                   14055:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  14056:         remove it with <span><strong class="command">pkg_delete
                   14057:         bison</strong></span>. Should you decide that you want a
                   14058:         binary package, do this now:</p>
1.1       grant    14059:         <pre class="screen">
1.14      xtraeme  14060: <code class="prompt">#</code> <strong class=
                   14061: "userinput"><code>make package</code></strong>
1.1       grant    14062: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   14063: ===&gt;  Building package for bison-1.25
                   14064: Creating package bison-1.25.tgz
                   14065: Registering depends:.
                   14066: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   14067: </pre>
                   14068: 
                   14069:         <p>Now that you don't need the source and object files any
                   14070:         more, clean up:</p>
                   14071:         <pre class="screen">
1.14      xtraeme  14072: <code class="prompt">#</code> <strong class=
                   14073: "userinput"><code>make clean</code></strong>
1.1       grant    14074: ===&gt;  Cleaning for bison-1.25
                   14075: </pre>
                   14076:       </div>
                   14077:     </div>
                   14078: 
                   14079:     <div class="appendix" lang="en" xml:lang="en">
                   14080:       <div class="titlepage">
                   14081:         <div>
                   14082:           <div>
                   14083:             <h2 class="title"><a name="logs" id=
1.46      gdt      14084:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    14085:           </div>
                   14086:         </div>
                   14087:       </div>
                   14088: 
                   14089:       <div class="toc">
                   14090:         <p><b>Table of Contents</b></p>
                   14091: 
                   14092:         <dl>
1.46      gdt      14093:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    14094:           Building figlet</a></span></dt>
                   14095: 
1.46      gdt      14096:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    14097:           Packaging figlet</a></span></dt>
                   14098:         </dl>
                   14099:       </div>
                   14100: 
                   14101:       <div class="sect1" lang="en" xml:lang="en">
                   14102:         <div class="titlepage">
                   14103:           <div>
                   14104:             <div>
                   14105:               <h2 class="title" style="clear: both"><a name=
                   14106:               "logs.building" id=
1.46      gdt      14107:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    14108:             </div>
                   14109:           </div>
                   14110:         </div>
                   14111:         <pre class="screen">
1.14      xtraeme  14112: <code class="prompt">#</code> <strong class=
                   14113: "userinput"><code>make</code></strong>
1.1       grant    14114: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14115: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   14116: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   14117: =&gt; [172219 bytes]
                   14118: Connected to ftp.plig.net.
                   14119: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   14120: 331 Guest login ok, send your complete e-mail address as password.
                   14121: 230-You are user #5 of 500 simultaneous users allowed.
                   14122: 230-
                   14123: 230-  ___ _             _ _                   
                   14124: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   14125: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   14126: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   14127: 230-         |_|   |_|     |___|         |___|
                   14128: 230-
                   14129: 230-** Welcome to ftp.plig.org **
                   14130: 230-
                   14131: 230-Please note that all transfers from this FTP site are logged. If you
                   14132: 230-do not like this, please disconnect now.
                   14133: 230-
                   14134: 230-This arhive is available via
                   14135: 230-
                   14136: 230-HTTP:  http://ftp.plig.org/
                   14137: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   14138: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   14139: 230-
                   14140: 230-Please email comments, bug reports and requests for packages to be
                   14141: 230-mirrored to ftp-admin@plig.org.   
                   14142: 230-
                   14143: 230-
                   14144: 230 Logged in anonymously.
                   14145: Remote system type is UNIX.
                   14146: Using binary mode to transfer files.
                   14147: 200 Type okay.
                   14148: 250 "/pub" is new cwd.
                   14149: 250-"/pub/figlet" is new cwd.
                   14150: 250-
                   14151: 250-Welcome to the figlet archive at ftp.figlet.org
                   14152: 250-    
                   14153: 250-    ftp://ftp.figlet.org/pub/figlet/
                   14154: 250-
                   14155: 250-The official FIGlet web page is:
                   14156: 250-    http://www.figlet.org/
                   14157: 250-
                   14158: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   14159: 250-contribute a font or something else, you can email us.
                   14160: 250 
                   14161: 250 "/pub/figlet/program" is new cwd.
                   14162: 250 "/pub/figlet/program/unix" is new cwd.
                   14163: local: figlet221.tar.gz remote: figlet221.tar.gz
                   14164: 502 Unimplemented command.
                   14165: 227 Entering Passive Mode (195,40,6,41,246,104)
                   14166: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   14167: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   14168: 226 Transfer completed.
                   14169: 172219 bytes received in 00:02 (75.99 KB/s)
                   14170: 221 Goodbye.
                   14171: =&gt; Checksum OK for figlet221.tar.gz.
                   14172: ===&gt; Extracting for figlet-2.2.1nb2
                   14173: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   14174: ===&gt; Patching for figlet-2.2.1nb2
                   14175: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   14176: ===&gt; Overriding tools for figlet-2.2.1nb2
                   14177: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   14178: ===&gt; Configuring for figlet-2.2.1nb2
                   14179: ===&gt; Building for figlet-2.2.1nb2
                   14180: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   14181: chmod a+x figlet
                   14182: gcc -O2 -o chkfont chkfont.c
                   14183: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  14184: <code class="prompt">#</code>
                   14185: <code class="prompt">#</code> <strong class=
                   14186: "userinput"><code>make install</code></strong>
1.1       grant    14187: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14188: ===&gt; Installing for figlet-2.2.1nb2
                   14189: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   14190: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   14191: mkdir -p /usr/pkg/share/figlet
                   14192: cp figlet /usr/pkg/bin
                   14193: cp chkfont /usr/pkg/bin
                   14194: chmod 555 figlist showfigfonts
                   14195: cp figlist /usr/pkg/bin
                   14196: cp showfigfonts /usr/pkg/bin
                   14197: cp fonts/*.flf /usr/pkg/share/figlet
                   14198: cp fonts/*.flc /usr/pkg/share/figlet
                   14199: cp figlet.6 /usr/pkg/man/man6
                   14200: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  14201: <code class="prompt">#</code>
1.1       grant    14202: </pre>
                   14203:       </div>
                   14204: 
                   14205:       <div class="sect1" lang="en" xml:lang="en">
                   14206:         <div class="titlepage">
                   14207:           <div>
                   14208:             <div>
                   14209:               <h2 class="title" style="clear: both"><a name=
                   14210:               "logs.package" id=
1.46      gdt      14211:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    14212:             </div>
                   14213:           </div>
                   14214:         </div>
                   14215:         <pre class="screen">
1.14      xtraeme  14216: <code class="prompt">#</code> <strong class=
                   14217: "userinput"><code>make package</code></strong>
1.1       grant    14218: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   14219: ===&gt; Packaging figlet-2.2.1nb2
                   14220: ===&gt; Building binary package for figlet-2.2.1nb2
                   14221: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   14222: Using SrcDir value of /usr/pkg
                   14223: Registering depends:.  
1.14      xtraeme  14224: <code class="prompt">#</code>
1.1       grant    14225: </pre>
                   14226:       </div>
                   14227:     </div>
                   14228: 
                   14229:     <div class="appendix" lang="en" xml:lang="en">
                   14230:       <div class="titlepage">
                   14231:         <div>
                   14232:           <div>
                   14233:             <h2 class="title"><a name="ftp-layout" id=
1.46      gdt      14234:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    14235:             FTP server's package archive</h2>
                   14236:           </div>
                   14237:         </div>
                   14238:       </div>
                   14239: 
                   14240:       <p>Layout for precompiled binary packages on
                   14241:       ftp.NetBSD.org:</p>
                   14242:       <pre class="programlisting">
                   14243: /pub/NetBSD/packages/
                   14244:                 distfiles/
                   14245: 
                   14246:                 # Unpacked pkgsrc trees
                   14247:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   14248:                 pkgsrc-2003Q4 -&gt; N/A
                   14249:                 pkgsrc-2004Q1/pkgsrc
                   14250: 
                   14251:                 # pkgsrc archives
                   14252:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   14253:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   14254:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   14255: 
                   14256:                 # Per pkgsrc-release/OS-release/arch package archives
                   14257:                 pkgsrc-2003Q4/
                   14258:                         NetBSD-1.6.2/
                   14259:                                 i386/
                   14260:                                         All/
                   14261:                                         archivers/
                   14262:                                                 foo -&gt; ../All/foo
                   14263:                                         ...
                   14264:                 pkgsrc-2004Q1/
                   14265:                         NetBSD-1.6.2/
                   14266:                                 i386/
                   14267:                                         All/
                   14268:                                         ...
                   14269:                         NetBSD-2.0/
                   14270:                                 i386/
                   14271:                                         All/
                   14272:                                         ...
                   14273:                         SunOS-5.9/
                   14274:                                 sparc/
                   14275:                                         All/
                   14276:                                         ...
                   14277:                                 x86/
                   14278:                                         All/
                   14279:                                         ...
                   14280: 
                   14281:                 # Per os-release package archive convenience links
                   14282:                 NetBSD-1.6.2 -&gt; 1.6.2
                   14283:                 1.6.2/
                   14284:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   14285:                         m68k/
                   14286:                                 All/
                   14287:                                 archivers/
                   14288:                                         foo -&gt; ../All/foo
                   14289:                                 ...
                   14290:                         amiga -&gt; m68k
                   14291:                         atari -&gt; m68k
                   14292:                         ...
                   14293: 
                   14294:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   14295:                 NetBSD-2.0/
                   14296:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   14297:                 SunOS-5.9/
                   14298:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   14299:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   14300:                         
                   14301: </pre>
                   14302: 
                   14303:       <p>To create:</p>
                   14304: 
                   14305:       <div class="orderedlist">
                   14306:         <ol type="1">
                   14307:           <li>
                   14308:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.38      dillo    14309:             "6.3.&nbsp;Doing a bulk build of all packages">Section
                   14310:             6.3, &#8220;Doing a bulk build of all
1.1       grant    14311:             packages&#8221;</a></p>
                   14312:           </li>
                   14313: 
                   14314:           <li>
                   14315:             <p>Upload /usr/pkgsrc/packages to</p>
                   14316:             <pre class="programlisting">
                   14317:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  14318:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    14319:         `uname -s`-`uname -r`/                  # OS &amp; version
                   14320:         `uname -p`                              # architecture
                   14321:        
                   14322: </pre>
                   14323:           </li>
                   14324: 
                   14325:           <li>
1.14      xtraeme  14326:             <p>If necessary, create a symlink <span><strong class=
                   14327:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   14328:             (amiga -&gt; m68k, ...)</p>
1.1       grant    14329:           </li>
                   14330:         </ol>
                   14331:       </div>
                   14332:     </div>
1.2       hubertf  14333: 
                   14334:     <div class="appendix" lang="en" xml:lang="en">
                   14335:       <div class="titlepage">
                   14336:         <div>
                   14337:           <div>
                   14338:             <h2 class="title"><a name="editing" id=
1.46      gdt      14339:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  14340:             for the pkgsrc guide</h2>
                   14341:           </div>
                   14342:         </div>
                   14343:       </div>
                   14344: 
                   14345:       <div class="toc">
                   14346:         <p><b>Table of Contents</b></p>
                   14347: 
                   14348:         <dl>
1.46      gdt      14349:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  14350:           Targets</a></span></dt>
                   14351: 
1.46      gdt      14352:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  14353:           Procedure</a></span></dt>
                   14354:         </dl>
                   14355:       </div>
                   14356: 
                   14357:       <p>This section contains information on editing the pkgsrc
                   14358:       guide itself.</p>
                   14359: 
                   14360:       <div class="sect1" lang="en" xml:lang="en">
                   14361:         <div class="titlepage">
                   14362:           <div>
                   14363:             <div>
                   14364:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      14365:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  14366:             </div>
                   14367:           </div>
                   14368:         </div>
                   14369: 
1.45      wiz      14370:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   14371:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14372:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  14373:         are created from it:</p>
                   14374: 
                   14375:         <div class="itemizedlist">
                   14376:           <ul type="disc">
                   14377:             <li>
1.45      wiz      14378:               <p><code xmlns=
                   14379:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      14380:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  14381:             </li>
                   14382: 
                   14383:             <li>
1.45      wiz      14384:               <p><code xmlns=
                   14385:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14386:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  14387:             </li>
                   14388: 
                   14389:             <li>
1.45      wiz      14390:               <p><code xmlns=
                   14391:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14392:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  14393:               the documentation on the NetBSD website will be built
                   14394:               from pkgsrc and kept up to date on the web server
                   14395:               itself. This means you <span class=
                   14396:               "emphasis"><em>must</em></span> make sure that your
                   14397:               changes haven't broken the build!</p>
                   14398:             </li>
1.6       hubertf  14399: 
                   14400:             <li>
1.45      wiz      14401:               <p><code xmlns=
                   14402:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14403:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  14404:               PDF version of the pkgsrc guide.</p>
                   14405:             </li>
                   14406: 
                   14407:             <li>
1.45      wiz      14408:               <p><code xmlns=
                   14409:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14410:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  14411:               PostScript version of the pkgsrc guide.</p>
                   14412:             </li>
1.2       hubertf  14413:           </ul>
                   14414:         </div>
                   14415:       </div>
                   14416: 
                   14417:       <div class="sect1" lang="en" xml:lang="en">
                   14418:         <div class="titlepage">
                   14419:           <div>
                   14420:             <div>
                   14421:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      14422:               "procedure" id=
1.46      gdt      14423:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  14424:             </div>
                   14425:           </div>
                   14426:         </div>
                   14427: 
                   14428:         <p>The procedure to edit the pkgsrc guide is:</p>
                   14429: 
                   14430:         <div class="itemizedlist">
                   14431:           <ul type="disc">
                   14432:             <li>
1.6       hubertf  14433:               <p>Make sure you have the packages needed to
                   14434:               re-generate the pkgsrc guide (and other XML-based
                   14435:               NetBSD documentation) installed. These are
1.11      ben      14436:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     14437:               for creating the ASCII and HTML versions, and
1.6       hubertf  14438:               &#8220;<span class=
1.47      reed     14439:               "quote">netbsd-doc-print</span>&#8221; for the
                   14440:               PostScript and PDF versions. You will need both
1.6       hubertf  14441:               packages installed, to make sure documentation is
                   14442:               consistent across all formats. The packages can be
1.45      wiz      14443:               found in <code xmlns=
                   14444:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14445:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      14446:               <code xmlns=
                   14447:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14448:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  14449:             </li>
                   14450: 
                   14451:             <li>
1.45      wiz      14452:               <p>Edit the XML file(s) in <code xmlns=
                   14453:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14454:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  14455:             </li>
                   14456: 
                   14457:             <li>
1.14      xtraeme  14458:               <p>Run <span><strong class="command">make extract
                   14459:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      14460:               <code xmlns=
                   14461:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14462:               "filename">pkgsrc/doc/guide</code> to check the XML
                   14463:               syntax, and fix it if needed.</p>
1.4       hubertf  14464:             </li>
                   14465: 
                   14466:             <li>
1.14      xtraeme  14467:               <p>Run <span><strong class=
1.45      wiz      14468:               "command">make</strong></span> in <code xmlns=
                   14469:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14470:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   14471:               and ASCII version.</p>
1.2       hubertf  14472:             </li>
                   14473: 
                   14474:             <li>
1.14      xtraeme  14475:               <p>If all is well, run <span><strong class=
                   14476:               "command">make install-doc</strong></span> to put the
1.45      wiz      14477:               generated files into <code xmlns=
                   14478:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14479:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  14480:             </li>
                   14481: 
                   14482:             <li>
1.14      xtraeme  14483:               <p><span><strong class="command">cvs commit
                   14484:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  14485:             </li>
                   14486: 
                   14487:             <li>
1.14      xtraeme  14488:               <p><span><strong class="command">cvs commit -m
                   14489:               re-generate
                   14490:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  14491:             </li>
1.4       hubertf  14492: 
                   14493:             <li>
                   14494:               <p>Until the webserver on www.NetBSD.org is really
                   14495:               updated automatically to pick up changes to the
1.14      xtraeme  14496:               pkgsrc guide automatically, also run
1.18      xtraeme  14497:               <span><strong class="command">make install-htdocs
1.14      xtraeme  14498:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   14499:               similar, adjust <code class=
                   14500:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  14501:             </li>
                   14502: 
                   14503:             <li>
1.14      xtraeme  14504:               <p><span><strong class="command">cvs commit
                   14505:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  14506:             </li>
1.2       hubertf  14507:           </ul>
                   14508:         </div>
                   14509:       </div>
                   14510:     </div>
1.1       grant    14511:   </div>
                   14512: </body>
                   14513: </html>

CVSweb <webmaster@jp.NetBSD.org>