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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.67      hubertf     4:   "HTML Tidy for NetBSD (vers 1 September 2005), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
1.67      hubertf    18:   <div class="book" lang="en">
1.1       grant      19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.67      hubertf    22:           <h1 class="title"><a name="the-pkgsrc-guide"></a>The
                     23:           pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
1.48      dillo      64:           <p class="copyright">Copyright &#169; 1994-2005 The
1.1       grant      65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.69      rillig     69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.12
                     70:           2006/02/18 01:46:43 rillig Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
1.51      rillig     91:         <dt><span class="chapter"><a href="#introduction">1. What
                     92:         is pkgsrc?</a></span></dt>
1.1       grant      93: 
                     94:         <dd>
                     95:           <dl>
1.30      wiz        96:             <dt><span class="sect1"><a href=
                     97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.46      gdt       111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
1.59      rillig    117:             to get pkgsrc and how to keep it
                    118:             up-to-date</a></span></dt>
1.1       grant     119: 
                    120:             <dd>
                    121:               <dl>
1.30      wiz       122:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     123:                 As tar file</a></span></dt>
                    124: 
1.30      wiz       125:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
                    126:                 SUP</a></span></dt>
1.1       grant     127: 
1.30      wiz       128:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
                    129:                 CVS</a></span></dt>
1.59      rillig    130: 
                    131:                 <dt><span class="sect1"><a href=
                    132:                 "#uptodate-cvs">2.4. Keeping pkgsrc up-to-date via
                    133:                 CVS</a></span></dt>
1.1       grant     134:               </dl>
                    135:             </dd>
                    136: 
                    137:             <dt><span class="chapter"><a href="#platforms">3. Using
                    138:             pkgsrc on systems other than NetBSD</a></span></dt>
                    139: 
                    140:             <dd>
                    141:               <dl>
1.30      wiz       142:                 <dt><span class="sect1"><a href=
                    143:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
                    144:                 pkgsrc</a></span></dt>
1.1       grant     145: 
1.30      wiz       146:                 <dt><span class="sect1"><a href=
1.47      reed      147:                 "#platform-specific-notes">3.2. Platform-specific
1.30      wiz       148:                 notes</a></span></dt>
1.1       grant     149: 
                    150:                 <dd>
                    151:                   <dl>
                    152:                     <dt><span class="sect2"><a href=
1.30      wiz       153:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     154:                     X)</a></span></dt>
                    155: 
                    156:                     <dt><span class="sect2"><a href=
1.30      wiz       157:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     158: 
                    159:                     <dt><span class="sect2"><a href=
1.30      wiz       160:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     161: 
1.30      wiz       162:                     <dt><span class="sect2"><a href="#irix">3.2.4.
                    163:                     IRIX</a></span></dt>
1.1       grant     164: 
1.30      wiz       165:                     <dt><span class="sect2"><a href="#linux">3.2.5.
                    166:                     Linux</a></span></dt>
1.1       grant     167: 
                    168:                     <dt><span class="sect2"><a href=
1.30      wiz       169:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        170: 
                    171:                     <dt><span class="sect2"><a href=
1.30      wiz       172:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     173:                   </dl>
                    174:                 </dd>
                    175:               </dl>
                    176:             </dd>
                    177: 
                    178:             <dt><span class="chapter"><a href="#using">4. Using
                    179:             pkgsrc</a></span></dt>
                    180: 
                    181:             <dd>
                    182:               <dl>
1.70      rillig    183:                 <dt><span class="sect1"><a href="#using-pkg">4.1.
                    184:                 Using binary packages</a></span></dt>
1.1       grant     185: 
                    186:                 <dd>
                    187:                   <dl>
                    188:                     <dt><span class="sect2"><a href=
1.70      rillig    189:                     "#finding-binary-packages">4.1.1. Finding
                    190:                     binary packages</a></span></dt>
1.1       grant     191: 
                    192:                     <dt><span class="sect2"><a href=
1.70      rillig    193:                     "#installing-binary-packages">4.1.2. Installing
1.30      wiz       194:                     binary packages</a></span></dt>
1.1       grant     195: 
                    196:                     <dt><span class="sect2"><a href=
1.30      wiz       197:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     198:                     warning</a></span></dt>
                    199:                   </dl>
                    200:                 </dd>
                    201: 
1.30      wiz       202:                 <dt><span class="sect1"><a href=
                    203:                 "#building-packages-from-source">4.2. Building
                    204:                 packages from source</a></span></dt>
1.1       grant     205: 
                    206:                 <dd>
                    207:                   <dl>
                    208:                     <dt><span class="sect2"><a href=
1.30      wiz       209:                     "#requirements">4.2.1.
1.1       grant     210:                     Requirements</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.30      wiz       213:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     214:                     distfiles</a></span></dt>
                    215: 
                    216:                     <dt><span class="sect2"><a href=
1.30      wiz       217:                     "#how-to-build-and-install">4.2.3. How to build
                    218:                     and install</a></span></dt>
1.1       grant     219: 
                    220:                     <dt><span class="sect2"><a href=
1.30      wiz       221:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     222:                     compiler</a></span></dt>
                    223:                   </dl>
                    224:                 </dd>
                    225:               </dl>
                    226:             </dd>
                    227: 
1.38      dillo     228:             <dt><span class="chapter"><a href="#configuring">5.
                    229:             Configuring pkgsrc</a></span></dt>
                    230: 
                    231:             <dd>
                    232:               <dl>
                    233:                 <dt><span class="sect1"><a href=
1.45      wiz       234:                 "#general-configuration">5.1. General
                    235:                 configuration</a></span></dt>
                    236: 
                    237:                 <dt><span class="sect1"><a href=
                    238:                 "#variables-affecting-build">5.2. Variables
                    239:                 affecting the build process</a></span></dt>
                    240: 
                    241:                 <dt><span class="sect1"><a href=
                    242:                 "#developer-advanced-settings">5.3.
                    243:                 Developer/advanced settings</a></span></dt>
                    244: 
                    245:                 <dt><span class="sect1"><a href=
                    246:                 "#selecting-build-options">5.4. Selecting Build
1.42      dillo     247:                 Options</a></span></dt>
1.38      dillo     248:               </dl>
                    249:             </dd>
                    250: 
                    251:             <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant     252:             binary packages</a></span></dt>
                    253: 
                    254:             <dd>
                    255:               <dl>
1.30      wiz       256:                 <dt><span class="sect1"><a href=
1.38      dillo     257:                 "#building-a-single-binary-package">6.1. Building a
1.30      wiz       258:                 single binary package</a></span></dt>
1.1       grant     259: 
1.30      wiz       260:                 <dt><span class="sect1"><a href=
1.38      dillo     261:                 "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant     262:                 Settings for creation of binary
                    263:                 packages</a></span></dt>
                    264: 
1.38      dillo     265:                 <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant     266:                 Doing a bulk build of all packages</a></span></dt>
                    267: 
                    268:                 <dd>
                    269:                   <dl>
                    270:                     <dt><span class="sect2"><a href=
1.38      dillo     271:                     "#binary.configuration">6.3.1.
1.1       grant     272:                     Configuration</a></span></dt>
                    273: 
                    274:                     <dt><span class="sect2"><a href=
1.38      dillo     275:                     "#other-environmental-considerations">6.3.2.
1.30      wiz       276:                     Other environmental
1.1       grant     277:                     considerations</a></span></dt>
                    278: 
                    279:                     <dt><span class="sect2"><a href=
1.38      dillo     280:                     "#operation">6.3.3. Operation</a></span></dt>
1.1       grant     281: 
                    282:                     <dt><span class="sect2"><a href=
1.38      dillo     283:                     "#what-it-does">6.3.4. What it
1.1       grant     284:                     does</a></span></dt>
                    285: 
                    286:                     <dt><span class="sect2"><a href=
1.38      dillo     287:                     "#disk-space-requirements">6.3.5. Disk space
1.1       grant     288:                     requirements</a></span></dt>
                    289: 
                    290:                     <dt><span class="sect2"><a href=
1.38      dillo     291:                     "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed      292:                     sandbox for chrooted builds</a></span></dt>
1.1       grant     293: 
                    294:                     <dt><span class="sect2"><a href=
1.38      dillo     295:                     "#building-a-partial-set">6.3.7. Building a
1.30      wiz       296:                     partial set of packages</a></span></dt>
1.13      hubertf   297: 
                    298:                     <dt><span class="sect2"><a href=
1.38      dillo     299:                     "#bulk-upload">6.3.8. Uploading results of a
1.13      hubertf   300:                     bulk build</a></span></dt>
1.1       grant     301:                   </dl>
                    302:                 </dd>
                    303: 
1.30      wiz       304:                 <dt><span class="sect1"><a href=
1.38      dillo     305:                 "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz       306:                 packages collection</a></span></dt>
1.1       grant     307: 
                    308:                 <dd>
                    309:                   <dl>
                    310:                     <dt><span class="sect2"><a href=
1.38      dillo     311:                     "#cdpack-example">6.4.1. Example of
1.1       grant     312:                     cdpack</a></span></dt>
                    313:                   </dl>
                    314:                 </dd>
                    315:               </dl>
                    316:             </dd>
                    317: 
1.38      dillo     318:             <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant     319:             Asked Questions</a></span></dt>
                    320: 
                    321:             <dd>
                    322:               <dl>
1.30      wiz       323:                 <dt><span class="sect1"><a href=
1.38      dillo     324:                 "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz       325:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     326: 
1.30      wiz       327:                 <dt><span class="sect1"><a href=
1.38      dillo     328:                 "#pkgviews-docs">7.2. Where's the pkgviews
1.30      wiz       329:                 documentation?</a></span></dt>
1.1       grant     330: 
1.5       hubertf   331:                 <dt><span class="sect1"><a href=
1.38      dillo     332:                 "#faq-pkgtools">7.3. Utilities for package
1.5       hubertf   333:                 management (pkgtools)</a></span></dt>
1.1       grant     334: 
1.30      wiz       335:                 <dt><span class="sect1"><a href=
1.38      dillo     336:                 "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz       337:                 non-root</a></span></dt>
                    338: 
                    339:                 <dt><span class="sect1"><a href=
1.38      dillo     340:                 "#resume-transfers">7.5. How to resume transfers
1.30      wiz       341:                 when fetching distfiles?</a></span></dt>
                    342: 
                    343:                 <dt><span class="sect1"><a href=
1.38      dillo     344:                 "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz       345:                 XFree86 from pkgsrc?</a></span></dt>
                    346: 
                    347:                 <dt><span class="sect1"><a href=
1.38      dillo     348:                 "#x.org-from-pkgsrc">7.7. How can I install/use
1.30      wiz       349:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     350: 
1.30      wiz       351:                 <dt><span class="sect1"><a href=
1.38      dillo     352:                 "#fetch-behind-firewall">7.8. How to fetch files
1.30      wiz       353:                 from behind a firewall</a></span></dt>
1.1       grant     354: 
1.38      dillo     355:                 <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.14      xtraeme   356:                 How do I tell <span><strong class="command">make
                    357:                 fetch</strong></span> to do passive
1.1       grant     358:                 FTP?</a></span></dt>
                    359: 
1.30      wiz       360:                 <dt><span class="sect1"><a href=
1.38      dillo     361:                 "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz       362:                 distfiles at once</a></span></dt>
1.1       grant     363: 
1.30      wiz       364:                 <dt><span class="sect1"><a href=
1.38      dillo     365:                 "#tmac.andoc-missing">7.11. What does
1.30      wiz       366:                 &#8220;<span class="quote">Don't know how to make
                    367:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   368:                 mean?</a></span></dt>
1.13      hubertf   369: 
1.30      wiz       370:                 <dt><span class="sect1"><a href=
1.38      dillo     371:                 "#bsd.own.mk-missing">7.12. What does
1.30      wiz       372:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   373:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     374: 
1.30      wiz       375:                 <dt><span class="sect1"><a href=
1.38      dillo     376:                 "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz       377:                 pkgsrc</a></span></dt>
1.1       grant     378: 
1.38      dillo     379:                 <dt><span class="sect1"><a href="#faq.conf">7.14.
1.35      jmmv      380:                 How do I change the location of configuration
                    381:                 files?</a></span></dt>
1.1       grant     382: 
                    383:                 <dt><span class="sect1"><a href=
1.38      dillo     384:                 "#audit-packages">7.15. Automated security
1.1       grant     385:                 checks</a></span></dt>
                    386:               </dl>
                    387:             </dd>
                    388:           </dl>
                    389:         </dd>
                    390: 
1.46      gdt       391:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     392:         pkgsrc developer's guide</a></span></dt>
                    393: 
                    394:         <dd>
                    395:           <dl>
1.38      dillo     396:             <dt><span class="chapter"><a href="#components">8.
1.27      rillig    397:             Package components - files, directories and
                    398:             contents</a></span></dt>
                    399: 
                    400:             <dd>
                    401:               <dl>
                    402:                 <dt><span class="sect1"><a href=
1.45      wiz       403:                 "#components.Makefile">8.1. <code xmlns=
                    404:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    405:                 "filename">Makefile</code></a></span></dt>
                    406: 
                    407:                 <dt><span class="sect1"><a href=
1.45      wiz       408:                 "#components.distinfo">8.2. <code xmlns=
                    409:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    410:                 "filename">distinfo</code></a></span></dt>
                    411: 
                    412:                 <dt><span class="sect1"><a href=
1.38      dillo     413:                 "#components.patches">8.3.
1.27      rillig    414:                 patches/*</a></span></dt>
                    415: 
1.30      wiz       416:                 <dt><span class="sect1"><a href=
1.38      dillo     417:                 "#other-mandatory-files">8.4. Other mandatory
1.30      wiz       418:                 files</a></span></dt>
1.27      rillig    419: 
                    420:                 <dt><span class="sect1"><a href=
1.38      dillo     421:                 "#components.optional">8.5. Optional
1.27      rillig    422:                 files</a></span></dt>
                    423: 
1.38      dillo     424:                 <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz       425:                 <code xmlns=
                    426:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    427:                 "filename">work*</code></a></span></dt>
1.27      rillig    428: 
1.38      dillo     429:                 <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz       430:                 <code xmlns=
                    431:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig    432:                 "filename">files/*</code></a></span></dt>
                    433:               </dl>
                    434:             </dd>
                    435: 
1.38      dillo     436:             <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz       437:             Programming in <code xmlns=
                    438:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    439:             "filename">Makefile</code>s</a></span></dt>
                    440: 
                    441:             <dd>
                    442:               <dl>
                    443:                 <dt><span class="sect1"><a href=
1.45      wiz       444:                 "#makefile.variables">9.1. <code xmlns=
                    445:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig    446:                 "filename">Makefile</code>
                    447:                 variables</a></span></dt>
                    448: 
1.27      rillig    449:                 <dd>
                    450:                   <dl>
                    451:                     <dt><span class="sect2"><a href=
1.38      dillo     452:                     "#makefile.variables.names">9.1.1. Naming
1.27      rillig    453:                     conventions</a></span></dt>
                    454:                   </dl>
                    455:                 </dd>
                    456: 
1.25      rillig    457:                 <dt><span class="sect1"><a href=
1.38      dillo     458:                 "#makefile.code">9.2. Code snippets</a></span></dt>
1.25      rillig    459: 
                    460:                 <dd>
                    461:                   <dl>
                    462:                     <dt><span class="sect2"><a href=
1.38      dillo     463:                     "#adding-to-list">9.2.1. Adding things to a
1.25      rillig    464:                     list</a></span></dt>
                    465: 
                    466:                     <dt><span class="sect2"><a href=
1.38      dillo     467:                     "#converting-internal-to-external">9.2.2.
1.30      wiz       468:                     Converting an internal list into an external
                    469:                     list</a></span></dt>
1.25      rillig    470: 
                    471:                     <dt><span class="sect2"><a href=
1.38      dillo     472:                     "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz       473:                     variables to a shell command</a></span></dt>
1.27      rillig    474: 
                    475:                     <dt><span class="sect2"><a href=
1.38      dillo     476:                     "#quoting-guideline">9.2.4. Quoting
1.27      rillig    477:                     guideline</a></span></dt>
                    478: 
                    479:                     <dt><span class="sect2"><a href=
1.38      dillo     480:                     "#bsd-make-bug-workaround">9.2.5. Workaround
1.30      wiz       481:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    482:                   </dl>
                    483:                 </dd>
                    484:               </dl>
                    485:             </dd>
                    486: 
1.38      dillo     487:             <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant     488:             issues</a></span></dt>
                    489: 
                    490:             <dd>
                    491:               <dl>
1.38      dillo     492:                 <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.30      wiz       493:                 ID</a></span></dt>
1.1       grant     494: 
1.30      wiz       495:                 <dt><span class="sect1"><a href=
1.38      dillo     496:                 "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz       497:                 <code xmlns=
                    498:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                    499:                 "filename">PLIST</code> generation</a></span></dt>
1.1       grant     500: 
1.38      dillo     501:                 <dt><span class="sect1"><a href=
                    502:                 "#print-PLIST">10.3. Tweaking output of
                    503:                 <span><strong class="command">make
1.14      xtraeme   504:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     505: 
1.38      dillo     506:                 <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant     507:                 Variable substitution in PLIST</a></span></dt>
                    508: 
1.30      wiz       509:                 <dt><span class="sect1"><a href=
1.48      dillo     510:                 "#manpage-compression">10.5. Man page
                    511:                 compression</a></span></dt>
1.1       grant     512: 
1.30      wiz       513:                 <dt><span class="sect1"><a href=
1.38      dillo     514:                 "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz       515:                 <code class=
1.14      xtraeme   516:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     517: 
1.30      wiz       518:                 <dt><span class="sect1"><a href=
1.47      reed      519:                 "#platform-specific-plist">10.7. Platform-specific
1.30      wiz       520:                 and differing PLISTs</a></span></dt>
1.1       grant     521: 
                    522:                 <dt><span class="sect1"><a href=
1.38      dillo     523:                 "#faq.common-dirs">10.8. Sharing directories
                    524:                 between packages</a></span></dt>
1.1       grant     525:               </dl>
                    526:             </dd>
                    527: 
1.38      dillo     528:             <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant     529:             Buildlink methodology</a></span></dt>
                    530: 
                    531:             <dd>
                    532:               <dl>
1.30      wiz       533:                 <dt><span class="sect1"><a href=
1.38      dillo     534:                 "#converting-to-buildlink3">11.1. Converting
1.30      wiz       535:                 packages to use buildlink3</a></span></dt>
1.1       grant     536: 
1.30      wiz       537:                 <dt><span class="sect1"><a href=
1.38      dillo     538:                 "#creating-buildlink3.mk">11.2. Writing
1.45      wiz       539:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                    540:                 class="filename">buildlink3.mk</code>
1.14      xtraeme   541:                 files</a></span></dt>
1.1       grant     542: 
                    543:                 <dd>
                    544:                   <dl>
                    545:                     <dt><span class="sect2"><a href=
1.38      dillo     546:                     "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz       547:                     buildlink3.mk file</a></span></dt>
1.1       grant     548: 
                    549:                     <dt><span class="sect2"><a href=
1.38      dillo     550:                     "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz       551:                     <code class=
1.14      xtraeme   552:                     "varname">BUILDLINK_DEPENDS.<em class=
                    553:                     "replaceable"><code>pkg</code></em></code> in
1.45      wiz       554:                     <code xmlns=
                    555:                     "http://www.w3.org/TR/xhtml1/transitional"
                    556:                     class="filename">buildlink3.mk</code>
1.1       grant     557:                     files</a></span></dt>
                    558:                   </dl>
                    559:                 </dd>
                    560: 
1.30      wiz       561:                 <dt><span class="sect1"><a href=
1.45      wiz       562:                 "#writing-builtin.mk">11.3. Writing <code xmlns=
                    563:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz       564:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     565: 
                    566:                 <dd>
                    567:                   <dl>
                    568:                     <dt><span class="sect2"><a href=
1.38      dillo     569:                     "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz       570:                     <code xmlns=
                    571:                     "http://www.w3.org/TR/xhtml1/transitional"
                    572:                     class="filename">builtin.mk</code>
1.1       grant     573:                     file</a></span></dt>
                    574: 
                    575:                     <dt><span class="sect2"><a href=
1.38      dillo     576:                     "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz       577:                     preferences for native or pkgsrc
                    578:                     software</a></span></dt>
1.1       grant     579:                   </dl>
                    580:                 </dd>
                    581:               </dl>
                    582:             </dd>
                    583: 
1.38      dillo     584:             <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv      585:             pkginstall framework</a></span></dt>
                    586: 
                    587:             <dd>
                    588:               <dl>
                    589:                 <dt><span class="sect1"><a href=
1.38      dillo     590:                 "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv      591:                 directories outside the installation
                    592:                 prefix</a></span></dt>
                    593: 
                    594:                 <dd>
                    595:                   <dl>
                    596:                     <dt><span class="sect2"><a href=
1.38      dillo     597:                     "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv      598:                     manipulation</a></span></dt>
                    599: 
                    600:                     <dt><span class="sect2"><a href=
1.38      dillo     601:                     "#files-outside-prefix">12.1.2. File
1.35      jmmv      602:                     manipulation</a></span></dt>
                    603:                   </dl>
                    604:                 </dd>
                    605: 
1.38      dillo     606:                 <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv      607:                 Configuration files</a></span></dt>
                    608: 
                    609:                 <dd>
                    610:                   <dl>
                    611:                     <dt><span class="sect2"><a href=
1.38      dillo     612:                     "#conf-files-sysconfdir">12.2.1. How
1.35      jmmv      613:                     <code class="varname">PKG_SYSCONFDIR</code> is
                    614:                     set</a></span></dt>
                    615: 
                    616:                     <dt><span class="sect2"><a href=
1.38      dillo     617:                     "#conf-files-configure">12.2.2. Telling the
1.47      reed      618:                     software where configuration files
1.35      jmmv      619:                     are</a></span></dt>
                    620: 
                    621:                     <dt><span class="sect2"><a href=
1.38      dillo     622:                     "#conf-files-patching">12.2.3. Patching
1.35      jmmv      623:                     installations</a></span></dt>
                    624: 
                    625:                     <dt><span class="sect2"><a href=
1.38      dillo     626:                     "#conf-files-disable">12.2.4. Disabling
1.35      jmmv      627:                     handling of configuration files</a></span></dt>
                    628:                   </dl>
                    629:                 </dd>
                    630: 
                    631:                 <dt><span class="sect1"><a href=
1.38      dillo     632:                 "#rcd-scripts">12.3. System startup
1.35      jmmv      633:                 scripts</a></span></dt>
                    634: 
                    635:                 <dd>
                    636:                   <dl>
                    637:                     <dt><span class="sect2"><a href=
1.38      dillo     638:                     "#rcd-scripts-disable">12.3.1. Disabling
1.35      jmmv      639:                     handling of system startup
                    640:                     scripts</a></span></dt>
                    641:                   </dl>
                    642:                 </dd>
                    643: 
                    644:                 <dt><span class="sect1"><a href=
1.38      dillo     645:                 "#users-and-groups">12.4. System users and
1.35      jmmv      646:                 groups</a></span></dt>
                    647: 
1.38      dillo     648:                 <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv      649:                 System shells</a></span></dt>
                    650: 
                    651:                 <dd>
                    652:                   <dl>
                    653:                     <dt><span class="sect2"><a href=
1.65      hubertf   654:                     "#shells-disable">12.5.1. Disabling shell
                    655:                     registration</a></span></dt>
                    656:                   </dl>
                    657:                 </dd>
                    658: 
                    659:                 <dt><span class="sect1"><a href="#fonts">12.6.
                    660:                 Fonts</a></span></dt>
                    661: 
                    662:                 <dd>
                    663:                   <dl>
                    664:                     <dt><span class="sect2"><a href=
                    665:                     "#fonts-disable">12.6.1. Disabling automatic
                    666:                     update of the fonts databases</a></span></dt>
1.35      jmmv      667:                   </dl>
                    668:                 </dd>
                    669:               </dl>
                    670:             </dd>
                    671: 
1.38      dillo     672:             <dt><span class="chapter"><a href="#options">13.
1.1       grant     673:             Options handling</a></span></dt>
                    674: 
                    675:             <dd>
                    676:               <dl>
1.30      wiz       677:                 <dt><span class="sect1"><a href=
1.38      dillo     678:                 "#global-default-options">13.1. Global default
1.30      wiz       679:                 options</a></span></dt>
1.1       grant     680: 
1.30      wiz       681:                 <dt><span class="sect1"><a href=
1.38      dillo     682:                 "#converting-to-options">13.2. Converting packages
1.45      wiz       683:                 to use <code xmlns=
                    684:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme   685:                 "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo     686: 
                    687:                 <dt><span class="sect1"><a href=
                    688:                 "#option-names">13.3. Option Names</a></span></dt>
1.1       grant     689:               </dl>
                    690:             </dd>
                    691: 
1.38      dillo     692:             <dt><span class="chapter"><a href="#build">14. The
1.1       grant     693:             build process</a></span></dt>
                    694: 
                    695:             <dd>
                    696:               <dl>
                    697:                 <dt><span class="sect1"><a href=
1.56      rillig    698:                 "#build.intro">14.1. Introduction</a></span></dt>
                    699: 
                    700:                 <dt><span class="sect1"><a href=
                    701:                 "#build.prefix">14.2. Program
1.1       grant     702:                 location</a></span></dt>
                    703: 
1.30      wiz       704:                 <dt><span class="sect1"><a href=
1.56      rillig    705:                 "#build.builddirs">14.3. Directories used during
                    706:                 the build process</a></span></dt>
                    707: 
                    708:                 <dt><span class="sect1"><a href=
                    709:                 "#build.running">14.4. Running a
                    710:                 phase</a></span></dt>
                    711: 
                    712:                 <dt><span class="sect1"><a href=
                    713:                 "#build.fetch">14.5. The <span class=
                    714:                 "emphasis"><em>fetch</em></span>
                    715:                 phase</a></span></dt>
                    716: 
                    717:                 <dt><span class="sect1"><a href=
                    718:                 "#build.checksum">14.6. The <span class=
                    719:                 "emphasis"><em>checksum</em></span>
                    720:                 phase</a></span></dt>
                    721: 
                    722:                 <dt><span class="sect1"><a href=
                    723:                 "#build.extract">14.7. The <span class=
                    724:                 "emphasis"><em>extract</em></span>
                    725:                 phase</a></span></dt>
                    726: 
                    727:                 <dt><span class="sect1"><a href=
                    728:                 "#build.patch">14.8. The <span class=
                    729:                 "emphasis"><em>patch</em></span>
                    730:                 phase</a></span></dt>
                    731: 
                    732:                 <dt><span class="sect1"><a href=
                    733:                 "#build.tools">14.9. The <span class=
                    734:                 "emphasis"><em>tools</em></span>
                    735:                 phase</a></span></dt>
                    736: 
                    737:                 <dt><span class="sect1"><a href=
                    738:                 "#build.wrapper">14.10. The <span class=
                    739:                 "emphasis"><em>wrapper</em></span>
                    740:                 phase</a></span></dt>
                    741: 
                    742:                 <dt><span class="sect1"><a href=
                    743:                 "#build.configure">14.11. The <span class=
                    744:                 "emphasis"><em>configure</em></span>
                    745:                 phase</a></span></dt>
                    746: 
                    747:                 <dt><span class="sect1"><a href=
                    748:                 "#build.build">14.12. The <span class=
                    749:                 "emphasis"><em>build</em></span>
                    750:                 phase</a></span></dt>
                    751: 
                    752:                 <dt><span class="sect1"><a href=
                    753:                 "#build.test">14.13. The <span class=
                    754:                 "emphasis"><em>test</em></span>
                    755:                 phase</a></span></dt>
                    756: 
                    757:                 <dt><span class="sect1"><a href=
                    758:                 "#build.install">14.14. The <span class=
                    759:                 "emphasis"><em>install</em></span>
                    760:                 phase</a></span></dt>
1.1       grant     761: 
                    762:                 <dt><span class="sect1"><a href=
1.56      rillig    763:                 "#build.package">14.15. The <span class=
                    764:                 "emphasis"><em>package</em></span>
                    765:                 phase</a></span></dt>
                    766: 
                    767:                 <dt><span class="sect1"><a href=
                    768:                 "#build.helpful-targets">14.16. Other helpful
1.1       grant     769:                 targets</a></span></dt>
                    770:               </dl>
                    771:             </dd>
                    772: 
1.68      rillig    773:             <dt><span class="chapter"><a href="#tools">15. Tools
                    774:             needed for building or running</a></span></dt>
                    775: 
                    776:             <dd>
                    777:               <dl>
                    778:                 <dt><span class="sect1"><a href=
                    779:                 "#pkgsrc-tools">15.1. Tools for pkgsrc
                    780:                 builds</a></span></dt>
                    781: 
                    782:                 <dt><span class="sect1"><a href=
                    783:                 "#package-tools">15.2. Tools needed by
                    784:                 packages</a></span></dt>
                    785: 
                    786:                 <dt><span class="sect1"><a href=
                    787:                 "#platform-tools">15.3. Tools provided by
                    788:                 platforms</a></span></dt>
                    789:               </dl>
                    790:             </dd>
                    791: 
                    792:             <dt><span class="chapter"><a href="#fixes">16. Making
1.55      rillig    793:             your package work</a></span></dt>
1.1       grant     794: 
                    795:             <dd>
                    796:               <dl>
1.30      wiz       797:                 <dt><span class="sect1"><a href=
1.68      rillig    798:                 "#general-operation">16.1. General
1.30      wiz       799:                 operation</a></span></dt>
1.1       grant     800: 
                    801:                 <dd>
                    802:                   <dl>
                    803:                     <dt><span class="sect2"><a href=
1.68      rillig    804:                     "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz       805:                     pull in variables from
                    806:                     /etc/mk.conf</a></span></dt>
1.1       grant     807: 
                    808:                     <dt><span class="sect2"><a href=
1.68      rillig    809:                     "#where-to-install-documentation">16.1.2. Where
1.31      wiz       810:                     to install documentation</a></span></dt>
                    811: 
                    812:                     <dt><span class="sect2"><a href=
1.68      rillig    813:                     "#restricted-packages">16.1.3. Restricted
1.1       grant     814:                     packages</a></span></dt>
                    815: 
                    816:                     <dt><span class="sect2"><a href=
1.68      rillig    817:                     "#dependencies">16.1.4. Handling
1.1       grant     818:                     dependencies</a></span></dt>
                    819: 
                    820:                     <dt><span class="sect2"><a href=
1.68      rillig    821:                     "#conflicts">16.1.5. Handling conflicts with
1.1       grant     822:                     other packages</a></span></dt>
                    823: 
                    824:                     <dt><span class="sect2"><a href=
1.68      rillig    825:                     "#not-building-packages">16.1.6. Packages that
1.30      wiz       826:                     cannot or should not be built</a></span></dt>
1.1       grant     827: 
                    828:                     <dt><span class="sect2"><a href=
1.68      rillig    829:                     "#undeletable-packages">16.1.7. Packages which
1.30      wiz       830:                     should not be deleted, once
                    831:                     installed</a></span></dt>
1.1       grant     832: 
                    833:                     <dt><span class="sect2"><a href=
1.68      rillig    834:                     "#security-handling">16.1.8. Handling packages
1.1       grant     835:                     with security problems</a></span></dt>
                    836: 
                    837:                     <dt><span class="sect2"><a href=
1.68      rillig    838:                     "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant     839:                     bugs</a></span></dt>
                    840: 
                    841:                     <dt><span class="sect2"><a href=
1.68      rillig    842:                     "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz       843:                     incrementing versions when fixing an existing
1.1       grant     844:                     package</a></span></dt>
                    845: 
                    846:                     <dt><span class="sect2"><a href=
1.68      rillig    847:                     "#portability-of-packages">16.1.11. Portability
1.30      wiz       848:                     of packages</a></span></dt>
1.1       grant     849:                   </dl>
                    850:                 </dd>
                    851: 
1.30      wiz       852:                 <dt><span class="sect1"><a href=
1.68      rillig    853:                 "#downloading-issues">16.2. Possible downloading
1.30      wiz       854:                 issues</a></span></dt>
1.1       grant     855: 
                    856:                 <dd>
                    857:                   <dl>
                    858:                     <dt><span class="sect2"><a href=
1.68      rillig    859:                     "#no-plain-download">16.2.1. Packages whose
1.30      wiz       860:                     distfiles aren't available for plain
1.1       grant     861:                     downloading</a></span></dt>
                    862: 
                    863:                     <dt><span class="sect2"><a href=
1.68      rillig    864:                     "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz       865:                     handle modified distfiles with the 'old'
                    866:                     name</a></span></dt>
1.1       grant     867:                   </dl>
                    868:                 </dd>
                    869: 
1.30      wiz       870:                 <dt><span class="sect1"><a href=
1.68      rillig    871:                 "#configuration-gotchas">16.3. Configuration
1.30      wiz       872:                 gotchas</a></span></dt>
1.1       grant     873: 
                    874:                 <dd>
                    875:                   <dl>
                    876:                     <dt><span class="sect2"><a href=
1.68      rillig    877:                     "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant     878:                     libtool</a></span></dt>
                    879: 
                    880:                     <dt><span class="sect2"><a href=
1.68      rillig    881:                     "#using-libtool">16.3.2. Using libtool on GNU
1.1       grant     882:                     packages that already support
                    883:                     libtool</a></span></dt>
                    884: 
                    885:                     <dt><span class="sect2"><a href=
1.68      rillig    886:                     "#autoconf-automake">16.3.3. GNU
1.1       grant     887:                     Autoconf/Automake</a></span></dt>
                    888:                   </dl>
                    889:                 </dd>
                    890: 
1.30      wiz       891:                 <dt><span class="sect1"><a href=
1.68      rillig    892:                 "#fixes-build">16.4. Building the
1.55      rillig    893:                 package</a></span></dt>
1.1       grant     894: 
                    895:                 <dd>
                    896:                   <dl>
                    897:                     <dt><span class="sect2"><a href=
1.68      rillig    898:                     "#cpp-defines">16.4.1. CPP
1.1       grant     899:                     defines</a></span></dt>
1.51      rillig    900: 
                    901:                     <dt><span class="sect2"><a href=
1.68      rillig    902:                     "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig    903:                     defines for some platforms</a></span></dt>
                    904: 
                    905:                     <dt><span class="sect2"><a href=
1.68      rillig    906:                     "#cpp-list">16.4.3. Getting a list of CPP
1.51      rillig    907:                     defines</a></span></dt>
1.1       grant     908:                   </dl>
                    909:                 </dd>
                    910: 
1.30      wiz       911:                 <dt><span class="sect1"><a href=
1.68      rillig    912:                 "#package-specific-actions">16.5. Package specific
1.30      wiz       913:                 actions</a></span></dt>
1.1       grant     914: 
                    915:                 <dd>
                    916:                   <dl>
                    917:                     <dt><span class="sect2"><a href=
1.68      rillig    918:                     "#user-interaction">16.5.1. User
1.2       hubertf   919:                     interaction</a></span></dt>
1.1       grant     920: 
                    921:                     <dt><span class="sect2"><a href=
1.68      rillig    922:                     "#handling-licenses">16.5.2. Handling
1.1       grant     923:                     licenses</a></span></dt>
                    924: 
                    925:                     <dt><span class="sect2"><a href=
1.68      rillig    926:                     "#installing-score-files">16.5.3. Installing
1.30      wiz       927:                     score files</a></span></dt>
1.1       grant     928: 
                    929:                     <dt><span class="sect2"><a href=
1.68      rillig    930:                     "#perl-scripts">16.5.4. Packages containing
1.30      wiz       931:                     perl scripts</a></span></dt>
1.1       grant     932: 
                    933:                     <dt><span class="sect2"><a href=
1.68      rillig    934:                     "#hardcoded-paths">16.5.5. Packages with
1.30      wiz       935:                     hardcoded paths to other
                    936:                     interpreters</a></span></dt>
1.1       grant     937: 
                    938:                     <dt><span class="sect2"><a href=
1.68      rillig    939:                     "#perl-modules">16.5.6. Packages installing
1.30      wiz       940:                     perl modules</a></span></dt>
1.1       grant     941: 
                    942:                     <dt><span class="sect2"><a href=
1.68      rillig    943:                     "#faq.info-files">16.5.7. Packages installing
1.1       grant     944:                     info files</a></span></dt>
                    945: 
                    946:                     <dt><span class="sect2"><a href=
1.68      rillig    947:                     "#manpages">16.5.8. Packages installing man
1.57      minskim   948:                     pages</a></span></dt>
                    949: 
                    950:                     <dt><span class="sect2"><a href=
1.68      rillig    951:                     "#gconf2-data-files">16.5.9. Packages
1.30      wiz       952:                     installing GConf2 data files</a></span></dt>
1.1       grant     953: 
                    954:                     <dt><span class="sect2"><a href=
1.68      rillig    955:                     "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz       956:                     installing scrollkeeper data
                    957:                     files</a></span></dt>
1.1       grant     958: 
                    959:                     <dt><span class="sect2"><a href=
1.68      rillig    960:                     "#x11-fonts">16.5.11. Packages installing X11
1.1       grant     961:                     fonts</a></span></dt>
                    962: 
                    963:                     <dt><span class="sect2"><a href=
1.68      rillig    964:                     "#gtk2-modules">16.5.12. Packages installing
1.30      wiz       965:                     GTK2 modules</a></span></dt>
1.1       grant     966: 
                    967:                     <dt><span class="sect2"><a href=
1.68      rillig    968:                     "#sgml-xml-data">16.5.13. Packages installing
1.30      wiz       969:                     SGML or XML data</a></span></dt>
1.1       grant     970: 
                    971:                     <dt><span class="sect2"><a href=
1.68      rillig    972:                     "#mime-database">16.5.14. Packages installing
1.1       grant     973:                     extensions to the MIME database</a></span></dt>
                    974: 
                    975:                     <dt><span class="sect2"><a href=
1.68      rillig    976:                     "#intltool">16.5.15. Packages using
1.1       grant     977:                     intltool</a></span></dt>
1.18      xtraeme   978: 
                    979:                     <dt><span class="sect2"><a href=
1.68      rillig    980:                     "#startup-scripts">16.5.16. Packages installing
1.18      xtraeme   981:                     startup scripts</a></span></dt>
1.57      minskim   982: 
                    983:                     <dt><span class="sect2"><a href=
1.68      rillig    984:                     "#tex-packages">16.5.17. Packages installing
1.57      minskim   985:                     TeX modules</a></span></dt>
1.1       grant     986:                   </dl>
                    987:                 </dd>
                    988: 
1.30      wiz       989:                 <dt><span class="sect1"><a href=
1.68      rillig    990:                 "#feedback-to-author">16.6. Feedback to the
1.30      wiz       991:                 author</a></span></dt>
1.1       grant     992:               </dl>
                    993:             </dd>
                    994: 
1.68      rillig    995:             <dt><span class="chapter"><a href="#debug">17.
1.1       grant     996:             Debugging</a></span></dt>
                    997: 
1.68      rillig    998:             <dt><span class="chapter"><a href="#submit">18.
1.1       grant     999:             Submitting and Committing</a></span></dt>
                   1000: 
                   1001:             <dd>
                   1002:               <dl>
1.30      wiz      1003:                 <dt><span class="sect1"><a href=
1.68      rillig   1004:                 "#submitting-your-package">18.1. Submitting your
1.30      wiz      1005:                 packages</a></span></dt>
1.1       grant    1006: 
1.30      wiz      1007:                 <dt><span class="sect1"><a href=
1.68      rillig   1008:                 "#general-notes-for-changes">18.2. General notes
1.41      wiz      1009:                 when adding, updating, or removing
                   1010:                 packages</a></span></dt>
                   1011: 
                   1012:                 <dt><span class="sect1"><a href=
1.68      rillig   1013:                 "#committing-importing">18.3. Committing: Importing
1.30      wiz      1014:                 a package into CVS</a></span></dt>
1.1       grant    1015: 
1.30      wiz      1016:                 <dt><span class="sect1"><a href=
1.68      rillig   1017:                 "#updating-package">18.4. Updating a package to a
1.30      wiz      1018:                 newer version</a></span></dt>
1.1       grant    1019: 
1.30      wiz      1020:                 <dt><span class="sect1"><a href=
1.68      rillig   1021:                 "#moving-package">18.5. Moving a package in
1.30      wiz      1022:                 pkgsrc</a></span></dt>
1.1       grant    1023:               </dl>
                   1024:             </dd>
1.69      rillig   1025: 
                   1026:             <dt><span class="chapter"><a href="#porting">19.
                   1027:             Porting pkgsrc</a></span></dt>
                   1028: 
                   1029:             <dd>
                   1030:               <dl>
                   1031:                 <dt><span class="sect1"><a href=
                   1032:                 "#porting.opsys">19.1. Porting pkgsrc to a new
                   1033:                 operating system</a></span></dt>
                   1034: 
                   1035:                 <dt><span class="sect1"><a href=
                   1036:                 "#porting.compiler">19.2. Adding support for a new
                   1037:                 compiler</a></span></dt>
                   1038:               </dl>
                   1039:             </dd>
1.1       grant    1040:           </dl>
                   1041:         </dd>
                   1042: 
1.46      gdt      1043:         <dt><span class="appendix"><a href="#examples">A. A simple
1.1       grant    1044:         example package: bison</a></span></dt>
                   1045: 
                   1046:         <dd>
                   1047:           <dl>
1.46      gdt      1048:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    1049:             files</a></span></dt>
                   1050: 
                   1051:             <dd>
                   1052:               <dl>
1.30      wiz      1053:                 <dt><span class="sect2"><a href=
1.46      gdt      1054:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    1055: 
1.30      wiz      1056:                 <dt><span class="sect2"><a href=
1.46      gdt      1057:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    1058: 
1.30      wiz      1059:                 <dt><span class="sect2"><a href=
1.46      gdt      1060:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    1061: 
1.30      wiz      1062:                 <dt><span class="sect2"><a href=
1.46      gdt      1063:                 "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      1064:                 package with <span><strong class=
1.14      xtraeme  1065:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant    1066:               </dl>
                   1067:             </dd>
                   1068: 
1.46      gdt      1069:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      1070:             Steps for building, installing,
                   1071:             packaging</a></span></dt>
1.1       grant    1072:           </dl>
                   1073:         </dd>
                   1074: 
1.46      gdt      1075:         <dt><span class="appendix"><a href="#logs">B. Build
1.1       grant    1076:         logs</a></span></dt>
                   1077: 
                   1078:         <dd>
                   1079:           <dl>
1.46      gdt      1080:             <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    1081:             Building figlet</a></span></dt>
                   1082: 
1.46      gdt      1083:             <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    1084:             Packaging figlet</a></span></dt>
                   1085:           </dl>
                   1086:         </dd>
                   1087: 
1.46      gdt      1088:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
1.1       grant    1089:         of the FTP server's package archive</a></span></dt>
1.2       hubertf  1090: 
1.46      gdt      1091:         <dt><span class="appendix"><a href="#editing">D. Editing
1.2       hubertf  1092:         guidelines for the pkgsrc guide</a></span></dt>
                   1093: 
                   1094:         <dd>
                   1095:           <dl>
1.46      gdt      1096:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  1097:             Targets</a></span></dt>
                   1098: 
1.46      gdt      1099:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  1100:             Procedure</a></span></dt>
                   1101:           </dl>
                   1102:         </dd>
1.1       grant    1103:       </dl>
                   1104:     </div>
                   1105: 
1.67      hubertf  1106:     <div class="chapter" lang="en">
1.1       grant    1107:       <div class="titlepage">
                   1108:         <div>
                   1109:           <div>
1.67      hubertf  1110:             <h2 class="title"><a name=
1.51      rillig   1111:             "introduction"></a>Chapter&nbsp;1.&nbsp;What is
                   1112:             pkgsrc?</h2>
1.1       grant    1113:           </div>
                   1114:         </div>
                   1115:       </div>
                   1116: 
                   1117:       <div class="toc">
                   1118:         <p><b>Table of Contents</b></p>
                   1119: 
                   1120:         <dl>
1.30      wiz      1121:           <dt><span class="sect1"><a href=
                   1122:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant    1123: 
                   1124:           <dt><span class="sect1"><a href="#overview">1.2.
                   1125:           Overview</a></span></dt>
                   1126: 
                   1127:           <dt><span class="sect1"><a href="#terminology">1.3.
                   1128:           Terminology</a></span></dt>
                   1129: 
                   1130:           <dt><span class="sect1"><a href="#typography">1.4.
                   1131:           Typography</a></span></dt>
                   1132:         </dl>
                   1133:       </div>
                   1134: 
1.67      hubertf  1135:       <div class="sect1" lang="en">
1.1       grant    1136:         <div class="titlepage">
                   1137:           <div>
                   1138:             <div>
                   1139:               <h2 class="title" style="clear: both"><a name=
1.30      wiz      1140:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant    1141:             </div>
                   1142:           </div>
                   1143:         </div>
                   1144: 
1.47      reed     1145:         <p>There is a lot of software freely available for
                   1146:         Unix-based systems, which usually runs on NetBSD and other
1.1       grant    1147:         Unix-flavoured systems, too, sometimes with some
                   1148:         modifications. The NetBSD Packages Collection (pkgsrc)
                   1149:         incorporates any such changes necessary to make that
                   1150:         software run, and makes the installation (and
                   1151:         de-installation) of the software package easy by means of a
                   1152:         single command.</p>
                   1153: 
                   1154:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme  1155:         the <span><strong class="command">pkg_*</strong></span>
                   1156:         tools so that installation and de-installation, printing of
                   1157:         an inventory of all installed packages and retrieval of
                   1158:         one-line comments or more verbose descriptions are all
                   1159:         simple.</p>
1.1       grant    1160: 
                   1161:         <p>pkgsrc currently contains several thousand packages,
                   1162:         including:</p>
                   1163: 
                   1164:         <div class="itemizedlist">
                   1165:           <ul type="disc">
                   1166:             <li>
                   1167:               <p><a xmlns=
                   1168:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1169:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.45      wiz      1170:               target="_top"><code xmlns="" class=
                   1171:               "filename">www/apache</code></a> - The Apache web
1.20      ben      1172:               server</p>
1.1       grant    1173:             </li>
                   1174: 
                   1175:             <li>
                   1176:               <p><a xmlns=
                   1177:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1178:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      1179:               target="_top"><code xmlns="" class=
                   1180:               "filename">www/mozilla</code></a> - The Mozilla web
1.20      ben      1181:               browser</p>
1.1       grant    1182:             </li>
                   1183: 
                   1184:             <li>
                   1185:               <p><a xmlns=
                   1186:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1187:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.45      wiz      1188:               target="_top"><code xmlns="" class=
                   1189:               "filename">meta-pkgs/gnome</code></a> - The GNOME
1.20      ben      1190:               Desktop Environment</p>
1.1       grant    1191:             </li>
                   1192: 
                   1193:             <li>
                   1194:               <p><a xmlns=
                   1195:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   1196:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.45      wiz      1197:               target="_top"><code xmlns="" class=
                   1198:               "filename">meta-pkgs/kde3</code></a> - The K Desktop
1.20      ben      1199:               Environment</p>
1.1       grant    1200:             </li>
                   1201:           </ul>
                   1202:         </div>
                   1203: 
                   1204:         <p>...just to name a few.</p>
                   1205: 
                   1206:         <p>pkgsrc has built-in support for handling varying
                   1207:         dependencies, such as pthreads and X11, and extended
                   1208:         features such as IPv6 support on a range of platforms.</p>
                   1209: 
                   1210:         <p>pkgsrc was derived from FreeBSD's ports system, and
                   1211:         initially developed for NetBSD only. Since then, pkgsrc has
                   1212:         grown a lot, and now supports the following platforms:</p>
                   1213: 
                   1214:         <div class="itemizedlist">
                   1215:           <ul type="disc">
                   1216:             <li>
                   1217:               <p><a href="http://developer.apple.com/darwin/"
                   1218:               target="_top">Darwin</a> (<a href=
                   1219:               "http://www.apple.com/macosx/" target="_top">Mac OS
                   1220:               X</a>)</p>
                   1221:             </li>
                   1222: 
                   1223:             <li>
1.3       hubertf  1224:               <p><a href="http://www.DragonFlyBSD.org/" target=
1.70      rillig   1225:               "_top">DragonFly BSD</a></p>
1.3       hubertf  1226:             </li>
                   1227: 
                   1228:             <li>
1.1       grant    1229:               <p><a href="http://www.FreeBSD.org/" target=
                   1230:               "_top">FreeBSD</a></p>
                   1231:             </li>
                   1232: 
                   1233:             <li>
1.3       hubertf  1234:               <p>Microsoft Windows, via <a href=
                   1235:               "http://www.microsoft.com/windows/sfu/" target=
                   1236:               "_top">Interix</a></p>
1.1       grant    1237:             </li>
                   1238: 
                   1239:             <li>
                   1240:               <p><a href="http://www.sgi.com/software/irix6.5/"
                   1241:               target="_top">IRIX</a></p>
                   1242:             </li>
                   1243: 
                   1244:             <li>
                   1245:               <p><a href="http://www.linux.org/" target=
                   1246:               "_top">Linux</a></p>
                   1247:             </li>
                   1248: 
                   1249:             <li>
                   1250:               <p><a href="http://www.NetBSD.org/" target=
                   1251:               "_top">NetBSD</a> (of course)</p>
                   1252:             </li>
                   1253: 
                   1254:             <li>
1.17      sketch   1255:               <p><a href="http://h30097.www3.hp.com/" target=
                   1256:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1257:             </li>
                   1258: 
                   1259:             <li>
1.1       grant    1260:               <p><a href="http://www.openbsd.org/" target=
                   1261:               "_top">OpenBSD</a></p>
                   1262:             </li>
                   1263: 
                   1264:             <li>
                   1265:               <p><a href="http://www.sun.com/solaris/" target=
                   1266:               "_top">Solaris</a></p>
                   1267:             </li>
                   1268:           </ul>
                   1269:         </div>
                   1270:       </div>
                   1271: 
1.67      hubertf  1272:       <div class="sect1" lang="en">
1.1       grant    1273:         <div class="titlepage">
                   1274:           <div>
                   1275:             <div>
                   1276:               <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1277:               "overview"></a>1.2.&nbsp;Overview</h2>
1.1       grant    1278:             </div>
                   1279:           </div>
                   1280:         </div>
                   1281: 
                   1282:         <p>This document is divided into two parts. The first,
                   1283:         <a href="#users-guide" title=
1.46      gdt      1284:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
1.2       hubertf  1285:         user's guide</a>, describes how one can use one of the
                   1286:         packages in the Package Collection, either by installing a
                   1287:         precompiled binary package, or by building one's own copy
                   1288:         using the NetBSD package system. The second part, <a href=
1.1       grant    1289:         "#developers-guide" title=
1.46      gdt      1290:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1291:         pkgsrc developer's guide</a>, explains how to prepare a
                   1292:         package so it can be easily built by other NetBSD users
                   1293:         without knowing about the package's building details.</p>
1.1       grant    1294: 
                   1295:         <p>This document is available in various formats:</p>
                   1296: 
                   1297:         <div class="itemizedlist">
                   1298:           <ul type="disc">
                   1299:             <li>
                   1300:               <p><a href="index.html" target="_top">HTML</a></p>
                   1301:             </li>
                   1302: 
                   1303:             <li>
                   1304:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1305:             </li>
                   1306: 
                   1307:             <li>
                   1308:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1309:             </li>
                   1310: 
                   1311:             <li>
                   1312:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1313:             </li>
                   1314:           </ul>
                   1315:         </div>
                   1316:       </div>
                   1317: 
1.67      hubertf  1318:       <div class="sect1" lang="en">
1.1       grant    1319:         <div class="titlepage">
                   1320:           <div>
                   1321:             <div>
                   1322:               <h2 class="title" style="clear: both"><a name=
                   1323:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1324:             </div>
                   1325:           </div>
                   1326:         </div>
                   1327: 
                   1328:         <p>There has been a lot of talk about &#8220;<span class=
                   1329:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1330:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1331:         description of all the terminology used within this
                   1332:         document.</p>
                   1333: 
                   1334:         <div class="variablelist">
                   1335:           <dl>
                   1336:             <dt><span class="term">Package</span></dt>
                   1337: 
                   1338:             <dd>
                   1339:               <p>A set of files and building instructions that
                   1340:               describe what's necessary to build a certain piece of
                   1341:               software using pkgsrc. Packages are traditionally
1.45      wiz      1342:               stored under <code xmlns=
                   1343:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1344:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1345:             </dd>
                   1346: 
                   1347:             <dt><span class="term">The NetBSD package
                   1348:             system</span></dt>
                   1349: 
                   1350:             <dd>
                   1351:               <p>This is the former name of &#8220;<span class=
                   1352:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1353:               NetBSD operating system and can be bootstrapped to
                   1354:               run on non-NetBSD operating systems as well. It
                   1355:               handles building (compiling), installing, and
                   1356:               removing of packages.</p>
1.1       grant    1357:             </dd>
                   1358: 
                   1359:             <dt><span class="term">Distfile</span></dt>
                   1360: 
                   1361:             <dd>
                   1362:               <p>This term describes the file or files that are
                   1363:               provided by the author of the piece of software to
                   1364:               distribute his work. All the changes necessary to
                   1365:               build on NetBSD are reflected in the corresponding
                   1366:               package. Usually the distfile is in the form of a
                   1367:               compressed tar-archive, but other types are possible,
1.45      wiz      1368:               too. Distfiles are usually stored below <code xmlns=
                   1369:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1370:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1371:             </dd>
                   1372: 
                   1373:             <dt><span class="term">Port</span></dt>
                   1374: 
                   1375:             <dd>
                   1376:               <p>This is the term used by FreeBSD and OpenBSD
                   1377:               people for what we call a package. In NetBSD
                   1378:               terminology, &#8220;<span class=
                   1379:               "quote">port</span>&#8221; refers to a different
                   1380:               architecture.</p>
                   1381:             </dd>
                   1382: 
                   1383:             <dt><span class="term">Precompiled/binary
                   1384:             package</span></dt>
                   1385: 
                   1386:             <dd>
                   1387:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1388:               distfile and stuffed together in a single
1.45      wiz      1389:               <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1390:               class="filename">.tgz</code> file so it can be
1.14      xtraeme  1391:               installed on machines of the same machine
                   1392:               architecture without the need to recompile. Packages
1.45      wiz      1393:               are usually generated in <code xmlns=
                   1394:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1395:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1396:               an archive on <a href=
1.1       grant    1397:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1398:               "_top">ftp.NetBSD.org</a>.</p>
                   1399: 
                   1400:               <p>Sometimes, this is referred to by the term
                   1401:               &#8220;<span class="quote">package</span>&#8221; too,
                   1402:               especially in the context of precompiled
                   1403:               packages.</p>
                   1404:             </dd>
                   1405: 
                   1406:             <dt><span class="term">Program</span></dt>
                   1407: 
                   1408:             <dd>
                   1409:               <p>The piece of software to be installed which will
1.47      reed     1410:               be constructed from all the files in the distfile by
1.1       grant    1411:               the actions defined in the corresponding package.</p>
                   1412:             </dd>
                   1413:           </dl>
                   1414:         </div>
                   1415:       </div>
                   1416: 
1.67      hubertf  1417:       <div class="sect1" lang="en">
1.1       grant    1418:         <div class="titlepage">
                   1419:           <div>
                   1420:             <div>
                   1421:               <h2 class="title" style="clear: both"><a name=
                   1422:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1423:             </div>
                   1424:           </div>
                   1425:         </div>
                   1426: 
                   1427:         <p>When giving examples for commands, shell prompts are
                   1428:         used to show if the command should/can be issued as root,
                   1429:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1430:         privileges are sufficient. We use a <code class=
                   1431:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1432:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1433:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1434:       </div>
                   1435:     </div>
                   1436: 
1.67      hubertf  1437:     <div class="part" lang="en">
1.1       grant    1438:       <div class="titlepage">
                   1439:         <div>
                   1440:           <div>
1.67      hubertf  1441:             <h1 class="title"><a name=
1.48      dillo    1442:             "users-guide"></a>Part&nbsp;I.&nbsp;The pkgsrc user's
                   1443:             guide</h1>
1.1       grant    1444:           </div>
                   1445:         </div>
                   1446:       </div>
                   1447: 
                   1448:       <div class="toc">
                   1449:         <p><b>Table of Contents</b></p>
                   1450: 
                   1451:         <dl>
                   1452:           <dt><span class="chapter"><a href="#getting">2. Where to
1.59      rillig   1453:           get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       grant    1454: 
                   1455:           <dd>
                   1456:             <dl>
1.30      wiz      1457:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
                   1458:               As tar file</a></span></dt>
1.1       grant    1459: 
1.30      wiz      1460:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1461:               SUP</a></span></dt>
                   1462: 
1.30      wiz      1463:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1464:               CVS</a></span></dt>
1.59      rillig   1465: 
                   1466:               <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1467:               Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1468:             </dl>
                   1469:           </dd>
                   1470: 
                   1471:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1472:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1473: 
                   1474:           <dd>
                   1475:             <dl>
1.30      wiz      1476:               <dt><span class="sect1"><a href=
                   1477:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1478:               pkgsrc</a></span></dt>
1.1       grant    1479: 
1.30      wiz      1480:               <dt><span class="sect1"><a href=
1.47      reed     1481:               "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1482:               notes</a></span></dt>
1.1       grant    1483: 
                   1484:               <dd>
                   1485:                 <dl>
1.30      wiz      1486:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
                   1487:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1488: 
1.30      wiz      1489:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
                   1490:                   FreeBSD</a></span></dt>
1.22      tv       1491: 
1.30      wiz      1492:                   <dt><span class="sect2"><a href="#interix">3.2.3.
                   1493:                   Interix</a></span></dt>
1.1       grant    1494: 
1.30      wiz      1495:                   <dt><span class="sect2"><a href="#irix">3.2.4.
                   1496:                   IRIX</a></span></dt>
1.1       grant    1497: 
1.30      wiz      1498:                   <dt><span class="sect2"><a href="#linux">3.2.5.
                   1499:                   Linux</a></span></dt>
1.1       grant    1500: 
1.30      wiz      1501:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
                   1502:                   OpenBSD</a></span></dt>
1.1       grant    1503: 
1.30      wiz      1504:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
                   1505:                   Solaris</a></span></dt>
1.1       grant    1506:                 </dl>
                   1507:               </dd>
                   1508:             </dl>
                   1509:           </dd>
                   1510: 
                   1511:           <dt><span class="chapter"><a href="#using">4. Using
                   1512:           pkgsrc</a></span></dt>
                   1513: 
                   1514:           <dd>
                   1515:             <dl>
1.70      rillig   1516:               <dt><span class="sect1"><a href="#using-pkg">4.1.
                   1517:               Using binary packages</a></span></dt>
1.1       grant    1518: 
                   1519:               <dd>
                   1520:                 <dl>
                   1521:                   <dt><span class="sect2"><a href=
1.70      rillig   1522:                   "#finding-binary-packages">4.1.1. Finding binary
                   1523:                   packages</a></span></dt>
1.1       grant    1524: 
                   1525:                   <dt><span class="sect2"><a href=
1.70      rillig   1526:                   "#installing-binary-packages">4.1.2. Installing
1.30      wiz      1527:                   binary packages</a></span></dt>
1.1       grant    1528: 
                   1529:                   <dt><span class="sect2"><a href=
1.30      wiz      1530:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1531:                   warning</a></span></dt>
                   1532:                 </dl>
                   1533:               </dd>
                   1534: 
1.30      wiz      1535:               <dt><span class="sect1"><a href=
                   1536:               "#building-packages-from-source">4.2. Building
                   1537:               packages from source</a></span></dt>
1.1       grant    1538: 
                   1539:               <dd>
                   1540:                 <dl>
                   1541:                   <dt><span class="sect2"><a href=
1.30      wiz      1542:                   "#requirements">4.2.1.
                   1543:                   Requirements</a></span></dt>
1.1       grant    1544: 
                   1545:                   <dt><span class="sect2"><a href=
1.30      wiz      1546:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1547:                   distfiles</a></span></dt>
                   1548: 
                   1549:                   <dt><span class="sect2"><a href=
1.30      wiz      1550:                   "#how-to-build-and-install">4.2.3. How to build
                   1551:                   and install</a></span></dt>
1.1       grant    1552: 
                   1553:                   <dt><span class="sect2"><a href=
1.30      wiz      1554:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1555:                   compiler</a></span></dt>
                   1556:                 </dl>
                   1557:               </dd>
                   1558:             </dl>
                   1559:           </dd>
                   1560: 
1.38      dillo    1561:           <dt><span class="chapter"><a href="#configuring">5.
                   1562:           Configuring pkgsrc</a></span></dt>
                   1563: 
                   1564:           <dd>
                   1565:             <dl>
                   1566:               <dt><span class="sect1"><a href=
1.45      wiz      1567:               "#general-configuration">5.1. General
                   1568:               configuration</a></span></dt>
                   1569: 
                   1570:               <dt><span class="sect1"><a href=
                   1571:               "#variables-affecting-build">5.2. Variables affecting
                   1572:               the build process</a></span></dt>
                   1573: 
                   1574:               <dt><span class="sect1"><a href=
                   1575:               "#developer-advanced-settings">5.3.
                   1576:               Developer/advanced settings</a></span></dt>
                   1577: 
                   1578:               <dt><span class="sect1"><a href=
                   1579:               "#selecting-build-options">5.4. Selecting Build
1.42      dillo    1580:               Options</a></span></dt>
1.38      dillo    1581:             </dl>
                   1582:           </dd>
                   1583: 
                   1584:           <dt><span class="chapter"><a href="#binary">6. Creating
1.1       grant    1585:           binary packages</a></span></dt>
                   1586: 
                   1587:           <dd>
                   1588:             <dl>
1.30      wiz      1589:               <dt><span class="sect1"><a href=
1.38      dillo    1590:               "#building-a-single-binary-package">6.1. Building a
1.30      wiz      1591:               single binary package</a></span></dt>
1.1       grant    1592: 
1.30      wiz      1593:               <dt><span class="sect1"><a href=
1.38      dillo    1594:               "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    1595:               Settings for creation of binary
                   1596:               packages</a></span></dt>
                   1597: 
1.38      dillo    1598:               <dt><span class="sect1"><a href="#bulkbuild">6.3.
1.1       grant    1599:               Doing a bulk build of all packages</a></span></dt>
                   1600: 
                   1601:               <dd>
                   1602:                 <dl>
                   1603:                   <dt><span class="sect2"><a href=
1.38      dillo    1604:                   "#binary.configuration">6.3.1.
1.1       grant    1605:                   Configuration</a></span></dt>
                   1606: 
                   1607:                   <dt><span class="sect2"><a href=
1.38      dillo    1608:                   "#other-environmental-considerations">6.3.2.
1.30      wiz      1609:                   Other environmental
1.1       grant    1610:                   considerations</a></span></dt>
                   1611: 
                   1612:                   <dt><span class="sect2"><a href=
1.38      dillo    1613:                   "#operation">6.3.3. Operation</a></span></dt>
1.1       grant    1614: 
                   1615:                   <dt><span class="sect2"><a href=
1.38      dillo    1616:                   "#what-it-does">6.3.4. What it
1.30      wiz      1617:                   does</a></span></dt>
1.1       grant    1618: 
                   1619:                   <dt><span class="sect2"><a href=
1.38      dillo    1620:                   "#disk-space-requirements">6.3.5. Disk space
1.1       grant    1621:                   requirements</a></span></dt>
                   1622: 
                   1623:                   <dt><span class="sect2"><a href=
1.38      dillo    1624:                   "#setting-up-a-sandbox">6.3.6. Setting up a
1.47      reed     1625:                   sandbox for chrooted builds</a></span></dt>
1.1       grant    1626: 
                   1627:                   <dt><span class="sect2"><a href=
1.38      dillo    1628:                   "#building-a-partial-set">6.3.7. Building a
1.30      wiz      1629:                   partial set of packages</a></span></dt>
1.13      hubertf  1630: 
                   1631:                   <dt><span class="sect2"><a href=
1.38      dillo    1632:                   "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  1633:                   build</a></span></dt>
1.1       grant    1634:                 </dl>
                   1635:               </dd>
                   1636: 
1.30      wiz      1637:               <dt><span class="sect1"><a href=
1.38      dillo    1638:               "#creating-cdroms">6.4. Creating a multiple CD-ROM
1.30      wiz      1639:               packages collection</a></span></dt>
1.1       grant    1640: 
                   1641:               <dd>
                   1642:                 <dl>
                   1643:                   <dt><span class="sect2"><a href=
1.38      dillo    1644:                   "#cdpack-example">6.4.1. Example of
1.1       grant    1645:                   cdpack</a></span></dt>
                   1646:                 </dl>
                   1647:               </dd>
                   1648:             </dl>
                   1649:           </dd>
                   1650: 
1.38      dillo    1651:           <dt><span class="chapter"><a href="#faq">7. Frequently
1.1       grant    1652:           Asked Questions</a></span></dt>
                   1653: 
                   1654:           <dd>
                   1655:             <dl>
1.30      wiz      1656:               <dt><span class="sect1"><a href=
1.38      dillo    1657:               "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      1658:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1659: 
1.38      dillo    1660:               <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    1661:               Where's the pkgviews documentation?</a></span></dt>
                   1662: 
1.38      dillo    1663:               <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    1664:               Utilities for package management
                   1665:               (pkgtools)</a></span></dt>
                   1666: 
1.30      wiz      1667:               <dt><span class="sect1"><a href=
1.38      dillo    1668:               "#non-root-pkgsrc">7.4. How to use pkgsrc as
1.30      wiz      1669:               non-root</a></span></dt>
1.1       grant    1670: 
1.30      wiz      1671:               <dt><span class="sect1"><a href=
1.38      dillo    1672:               "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      1673:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1674: 
1.30      wiz      1675:               <dt><span class="sect1"><a href=
1.38      dillo    1676:               "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      1677:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1678: 
1.30      wiz      1679:               <dt><span class="sect1"><a href=
1.38      dillo    1680:               "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      1681:               from pkgsrc?</a></span></dt>
1.1       grant    1682: 
1.30      wiz      1683:               <dt><span class="sect1"><a href=
1.38      dillo    1684:               "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      1685:               behind a firewall</a></span></dt>
1.1       grant    1686: 
1.38      dillo    1687:               <dt><span class="sect1"><a href="#passive-ftp">7.9.
1.30      wiz      1688:               How do I tell <span><strong class="command">make
1.14      xtraeme  1689:               fetch</strong></span> to do passive
1.1       grant    1690:               FTP?</a></span></dt>
                   1691: 
1.30      wiz      1692:               <dt><span class="sect1"><a href=
1.38      dillo    1693:               "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      1694:               distfiles at once</a></span></dt>
1.1       grant    1695: 
1.30      wiz      1696:               <dt><span class="sect1"><a href=
1.38      dillo    1697:               "#tmac.andoc-missing">7.11. What does
1.30      wiz      1698:               &#8220;<span class="quote">Don't know how to make
                   1699:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1700:               mean?</a></span></dt>
1.13      hubertf  1701: 
1.30      wiz      1702:               <dt><span class="sect1"><a href=
1.38      dillo    1703:               "#bsd.own.mk-missing">7.12. What does
1.30      wiz      1704:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1705:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1706: 
1.30      wiz      1707:               <dt><span class="sect1"><a href=
1.38      dillo    1708:               "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      1709:               pkgsrc</a></span></dt>
1.1       grant    1710: 
1.38      dillo    1711:               <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     1712:               do I change the location of configuration
                   1713:               files?</a></span></dt>
1.1       grant    1714: 
                   1715:               <dt><span class="sect1"><a href=
1.38      dillo    1716:               "#audit-packages">7.15. Automated security
1.1       grant    1717:               checks</a></span></dt>
                   1718:             </dl>
                   1719:           </dd>
                   1720:         </dl>
                   1721:       </div>
                   1722: 
1.67      hubertf  1723:       <div class="chapter" lang="en">
1.1       grant    1724:         <div class="titlepage">
                   1725:           <div>
                   1726:             <div>
1.67      hubertf  1727:               <h2 class="title"><a name=
1.1       grant    1728:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
1.59      rillig   1729:               pkgsrc and how to keep it up-to-date</h2>
1.1       grant    1730:             </div>
                   1731:           </div>
                   1732:         </div>
                   1733: 
                   1734:         <div class="toc">
                   1735:           <p><b>Table of Contents</b></p>
                   1736: 
                   1737:           <dl>
1.30      wiz      1738:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1739:             tar file</a></span></dt>
                   1740: 
1.30      wiz      1741:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1742:             SUP</a></span></dt>
                   1743: 
1.30      wiz      1744:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1745:             CVS</a></span></dt>
1.59      rillig   1746: 
                   1747:             <dt><span class="sect1"><a href="#uptodate-cvs">2.4.
                   1748:             Keeping pkgsrc up-to-date via CVS</a></span></dt>
1.1       grant    1749:           </dl>
                   1750:         </div>
                   1751: 
                   1752:         <p>There are three ways to get pkgsrc. Either as a tar
                   1753:         file, via SUP, or via CVS. All three ways are described
                   1754:         here.</p>
                   1755: 
1.67      hubertf  1756:         <div class="sect1" lang="en">
1.1       grant    1757:           <div class="titlepage">
                   1758:             <div>
                   1759:               <div>
                   1760:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1761:                 "as-tar-file"></a>2.1.&nbsp;As tar file</h2>
1.1       grant    1762:               </div>
                   1763:             </div>
                   1764:           </div>
                   1765: 
                   1766:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1767:           file from <a href=
1.11      ben      1768:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1769:           target="_top">ftp.NetBSD.org</a> and unpack it into
1.45      wiz      1770:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   1771:           class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1772:         </div>
                   1773: 
1.67      hubertf  1774:         <div class="sect1" lang="en">
1.1       grant    1775:           <div class="titlepage">
                   1776:             <div>
                   1777:               <div>
                   1778:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1779:                 "via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1780:               </div>
                   1781:             </div>
                   1782:           </div>
                   1783: 
                   1784:           <p>As an alternative to the tar file, you can get pkgsrc
                   1785:           via the Software Update Protocol, SUP. To do so, make
                   1786:           sure your supfile has a line</p>
                   1787:           <pre class="programlisting">
1.51      rillig   1788:     release=pkgsrc
1.1       grant    1789: </pre>
                   1790: 
1.45      wiz      1791:           <p>in it, see the examples in <code xmlns=
                   1792:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1793:           "filename">/usr/share/examples/supfiles</code>, and that
1.45      wiz      1794:           the <code xmlns=
                   1795:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1796:           "filename">/usr/pkgsrc</code> directory exists. Then,
                   1797:           simply run <span><strong class="command">sup -v
                   1798:           <em class="replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1799:         </div>
                   1800: 
1.67      hubertf  1801:         <div class="sect1" lang="en">
1.1       grant    1802:           <div class="titlepage">
                   1803:             <div>
                   1804:               <div>
                   1805:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  1806:                 "via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1807:               </div>
                   1808:             </div>
                   1809:           </div>
                   1810: 
                   1811:           <p>To get pkgsrc via CVS, make sure you have
                   1812:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1813:           To do an initial (full) checkout of pkgsrc, do the
                   1814:           following steps:</p>
1.1       grant    1815:           <pre class="screen">
1.14      xtraeme  1816: <code class="prompt">%</code> <strong class=
                   1817: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1818: <code class="prompt">%</code> <strong class=
                   1819: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1820: <code class="prompt">%</code> <strong class=
                   1821: "userinput"><code>cd /usr</code></strong>
                   1822: <code class="prompt">%</code> <strong class=
                   1823: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1824: </pre>
                   1825: 
1.45      wiz      1826:           <p>This will create the <code xmlns=
                   1827:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1828:           "filename">pkgsrc</code> directory in your <code xmlns=
                   1829:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1830:           "filename">/usr</code>, and all the package source will
1.45      wiz      1831:           be stored under <code xmlns=
                   1832:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  1833:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1834:           initial checkout, make sure you have <code class=
                   1835:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1836:           <pre class="screen">
1.14      xtraeme  1837: <code class="prompt">%</code> <strong class=
                   1838: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1839: <code class="prompt">%</code> <strong class=
                   1840: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1841: </pre>
                   1842: 
                   1843:           <p>Please also note that it is possible to have multiple
                   1844:           copies of the pkgsrc hierarchy in use at any one time -
                   1845:           all work is done relatively within the pkgsrc tree.</p>
                   1846:         </div>
1.59      rillig   1847: 
1.67      hubertf  1848:         <div class="sect1" lang="en">
1.59      rillig   1849:           <div class="titlepage">
                   1850:             <div>
                   1851:               <div>
                   1852:                 <h2 class="title" style="clear: both"><a name=
                   1853:                 "uptodate-cvs"></a>2.4.&nbsp;Keeping pkgsrc
                   1854:                 up-to-date via CVS</h2>
                   1855:               </div>
                   1856:             </div>
                   1857:           </div>
                   1858: 
                   1859:           <p>If your copy of pkgsrc contains a lot of <code xmlns=
                   1860:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1861:           "filename">CVS</code> directories, you can update it
                   1862:           using the <a href=
                   1863:           "http://netbsd.gw.com/cgi-bin/man-cgi?cvs+1+NetBSD-current">
                   1864:           <span class="citerefentry"><span class=
                   1865:           "refentrytitle">cvs</span>(1)</span></a> program. First,
                   1866:           <span><strong class="command">cd</strong></span> to the
                   1867:           top level directory of pkgsrc. Then run
                   1868:           <span><strong class="command">cvs -q update
                   1869:           -dP</strong></span>, and you're done.</p>
                   1870: 
                   1871:           <p>If that doesn't work and the file <code xmlns=
                   1872:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   1873:           "filename">CVS/Root</code> contains the string
                   1874:           &#8220;<span class="quote">:pserver:</span>&#8221;, you
                   1875:           have to run <span><strong class="command">cvs
                   1876:           login</strong></span> once to get known to the NetBSD CVS
                   1877:           server. The <span><strong class=
                   1878:           "command">cvs</strong></span> utility will then ask you
                   1879:           for a password. Just enter &#8220;<span class=
                   1880:           "quote">anoncvs</span>&#8221;. Then try again to
                   1881:           update.</p>
                   1882:         </div>
1.1       grant    1883:       </div>
                   1884: 
1.67      hubertf  1885:       <div class="chapter" lang="en">
1.1       grant    1886:         <div class="titlepage">
                   1887:           <div>
                   1888:             <div>
1.67      hubertf  1889:               <h2 class="title"><a name=
1.1       grant    1890:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1891:               systems other than NetBSD</h2>
                   1892:             </div>
                   1893:           </div>
                   1894:         </div>
                   1895: 
                   1896:         <div class="toc">
                   1897:           <p><b>Table of Contents</b></p>
                   1898: 
                   1899:           <dl>
1.30      wiz      1900:             <dt><span class="sect1"><a href=
                   1901:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
                   1902:             pkgsrc</a></span></dt>
1.1       grant    1903: 
1.30      wiz      1904:             <dt><span class="sect1"><a href=
1.47      reed     1905:             "#platform-specific-notes">3.2. Platform-specific
1.30      wiz      1906:             notes</a></span></dt>
1.1       grant    1907: 
                   1908:             <dd>
                   1909:               <dl>
1.30      wiz      1910:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1911:                 Darwin (Mac OS X)</a></span></dt>
                   1912: 
1.30      wiz      1913:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1914:                 FreeBSD</a></span></dt>
                   1915: 
1.30      wiz      1916:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1917:                 Interix</a></span></dt>
                   1918: 
1.30      wiz      1919:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1920:                 IRIX</a></span></dt>
                   1921: 
1.30      wiz      1922:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1923:                 Linux</a></span></dt>
                   1924: 
1.30      wiz      1925:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1926:                 OpenBSD</a></span></dt>
                   1927: 
1.30      wiz      1928:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1929:                 Solaris</a></span></dt>
                   1930:               </dl>
                   1931:             </dd>
                   1932:           </dl>
                   1933:         </div>
                   1934: 
1.67      hubertf  1935:         <div class="sect1" lang="en">
1.1       grant    1936:           <div class="titlepage">
                   1937:             <div>
                   1938:               <div>
                   1939:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      1940:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
                   1941:                 pkgsrc</h2>
1.1       grant    1942:               </div>
                   1943:             </div>
                   1944:           </div>
                   1945: 
1.27      rillig   1946:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1947:           bootstrap kit to build the required tools to use pkgsrc
                   1948:           on your platform. Besides support for native NetBSD,
                   1949:           pkgsrc and the bootstrap kit have support for the
                   1950:           following operating systems:</p>
                   1951: 
                   1952:           <div class="itemizedlist">
                   1953:             <ul type="disc">
                   1954:               <li>
                   1955:                 <p>Darwin (Mac OS X)</p>
                   1956:               </li>
                   1957: 
                   1958:               <li>
1.70      rillig   1959:                 <p>DragonFly BSD</p>
1.16      grant    1960:               </li>
                   1961: 
                   1962:               <li>
1.1       grant    1963:                 <p>FreeBSD</p>
                   1964:               </li>
                   1965: 
                   1966:               <li>
                   1967:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1968:               </li>
                   1969: 
                   1970:               <li>
                   1971:                 <p>IRIX</p>
                   1972:               </li>
                   1973: 
                   1974:               <li>
                   1975:                 <p>Linux</p>
                   1976:               </li>
                   1977: 
                   1978:               <li>
                   1979:                 <p>OpenBSD</p>
                   1980:               </li>
                   1981: 
                   1982:               <li>
                   1983:                 <p>Solaris</p>
                   1984:               </li>
1.16      grant    1985: 
                   1986:               <li>
                   1987:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1988:               </li>
1.1       grant    1989:             </ul>
                   1990:           </div>
                   1991: 
                   1992:           <p>Support for other platforms is under development.</p>
                   1993: 
                   1994:           <p>Installing the bootstrap kit should be as simple
                   1995:           as:</p>
                   1996:           <pre class="screen">
1.14      xtraeme  1997: <code class="prompt">#</code> <strong class=
                   1998: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1999: <code class="prompt">#</code> <strong class=
                   2000: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2001: <code class="prompt">#</code> <strong class=
                   2002: "userinput"><code>./bootstrap</code></strong>
1.1       grant    2003: </pre>
                   2004: 
                   2005:           <p>See <a href="#getting" title=
1.59      rillig   2006:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc and how to keep it up-to-date">
1.67      hubertf  2007:           Chapter&nbsp;2, <i>Where to get pkgsrc and how to keep it
1.59      rillig   2008:           up-to-date</i></a> for other ways to get pkgsrc before
                   2009:           bootstrapping. The given <span><strong class=
                   2010:           "command">bootstrap</strong></span> command will use the
                   2011:           defaults of <code xmlns=
1.45      wiz      2012:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2013:           "filename">/usr/pkg</code> for the <span class=
                   2014:           "emphasis"><em>prefix</em></span> where programs will be
1.45      wiz      2015:           installed in, and <code xmlns=
                   2016:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2017:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   2018:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    2019:           However, these can also be set using command-line
1.27      rillig   2020:           arguments.</p>
1.1       grant    2021: 
                   2022:           <p>Binary packages for the pkgsrc tools and an initial
                   2023:           set of packages is available for supported platforms. An
                   2024:           up-to-date list of these can be found on <a href=
                   2025:           "http://www.pkgsrc.org/" target=
1.63      dillo    2026:           "_top">www.pkgsrc.org</a>. Note that this only works for
                   2027:           privileged builds that install into <code xmlns=
                   2028:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   2029:           "filename">/usr/pkg</code>.</p>
1.47      reed     2030: 
                   2031:           <div class="note" style=
                   2032:           "margin-left: 0.5in; margin-right: 0.5in;">
                   2033:             <h3 class="title">Note</h3>
                   2034: 
                   2035:             <p>The bootstrap installs a <span><strong class=
                   2036:             "command">bmake</strong></span> tool. Use this
                   2037:             <span><strong class="command">bmake</strong></span>
                   2038:             when building via pkgsrc. For examples in this guide,
                   2039:             use <span><strong class="command">bmake</strong></span>
                   2040:             instead of &#8220;<span class=
                   2041:             "quote">make</span>&#8221;.</p>
                   2042:           </div>
1.1       grant    2043:         </div>
                   2044: 
1.67      hubertf  2045:         <div class="sect1" lang="en">
1.1       grant    2046:           <div class="titlepage">
                   2047:             <div>
                   2048:               <div>
                   2049:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     2050:                 "platform-specific-notes"></a>3.2.&nbsp;Platform-specific
                   2051:                 notes</h2>
1.1       grant    2052:               </div>
                   2053:             </div>
                   2054:           </div>
                   2055: 
                   2056:           <p>Here are some platform-specific notes you should be
                   2057:           aware of.</p>
                   2058: 
1.67      hubertf  2059:           <div class="sect2" lang="en">
1.1       grant    2060:             <div class="titlepage">
                   2061:               <div>
                   2062:                 <div>
1.67      hubertf  2063:                   <h3 class="title"><a name=
1.30      wiz      2064:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    2065:                 </div>
                   2066:               </div>
                   2067:             </div>
                   2068: 
                   2069:             <p>Darwin 5.x and 6.x are supported. There are two
                   2070:             methods of using pkgsrc on Mac OS X, by using a
                   2071:             <a href="#platform.osx-image" title=
                   2072:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   2073:             <a href="#platform.osx-ufs" title=
                   2074:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   2075:             partition</a>.</p>
                   2076: 
                   2077:             <p>Before you start, you will need to download and
                   2078:             install the Mac OS X Developer Tools from Apple's
                   2079:             Developer Connection. See <a href=
                   2080:             "http://developer.apple.com/macosx/" target=
                   2081:             "_top">http://developer.apple.com/macosx/</a> for
                   2082:             details. Also, make sure you install X11 for Mac OS X
                   2083:             and the X11 SDK from <a href=
                   2084:             "http://www.apple.com/macosx/x11/download/" target=
                   2085:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   2086:             you intend to build packages that use the X11 Window
                   2087:             System.</p>
                   2088: 
                   2089:             <p>If you already have a UFS partition, or have a spare
                   2090:             partition that you can format as UFS, it is recommended
                   2091:             to use that instead of the disk image. It'll be
                   2092:             somewhat faster and will mount automatically at boot
                   2093:             time, where you must manually mount a disk image.</p>
                   2094: 
                   2095:             <div class="note" style=
                   2096:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2097:               <h3 class="title">Note</h3>
                   2098: 
                   2099:               <p>You cannot use a HFS+ file system for pkgsrc,
1.47      reed     2100:               because pkgsrc currently requires the file system to
1.1       grant    2101:               be case-sensitive, and HFS+ is not.</p>
                   2102:             </div>
                   2103: 
1.67      hubertf  2104:             <div class="sect3" lang="en">
1.1       grant    2105:               <div class="titlepage">
                   2106:                 <div>
                   2107:                   <div>
1.67      hubertf  2108:                     <h4 class="title"><a name=
                   2109:                     "platform.osx-image"></a>3.2.1.1.&nbsp;Using a
                   2110:                     disk image</h4>
1.1       grant    2111:                   </div>
                   2112:                 </div>
                   2113:               </div>
                   2114: 
                   2115:               <p>Create the disk image:</p>
                   2116:               <pre class="screen">
1.14      xtraeme  2117: <code class="prompt">#</code> <strong class=
                   2118: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   2119: <code class="prompt">#</code> <strong class=
                   2120: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   2121: <code class="prompt">#</code> <strong class=
                   2122: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   2123: <code class="prompt">#</code> <strong class=
                   2124: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    2125: </pre>
                   2126: 
                   2127:               <p>That's it!</p>
                   2128:             </div>
                   2129: 
1.67      hubertf  2130:             <div class="sect3" lang="en">
1.1       grant    2131:               <div class="titlepage">
                   2132:                 <div>
                   2133:                   <div>
1.67      hubertf  2134:                     <h4 class="title"><a name=
                   2135:                     "platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
1.1       grant    2136:                     UFS partition</h4>
                   2137:                   </div>
                   2138:                 </div>
                   2139:               </div>
                   2140: 
1.45      wiz      2141:               <p>By default, <code xmlns=
                   2142:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2143:               "filename">/usr</code> will be on your root file
                   2144:               system, normally HFS+. It is possible to use the
                   2145:               default <span class="emphasis"><em>prefix</em></span>
                   2146:               of <code xmlns=
                   2147:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2148:               "filename">/usr/pkg</code> by symlinking <code xmlns=
                   2149:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2150:               "filename">/usr/pkg</code> to a directory on a UFS
                   2151:               file system. Obviously, another symlink is required
                   2152:               if you want to place the package database directory
                   2153:               outside the <span class=
                   2154:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    2155:               <pre class="screen">
1.14      xtraeme  2156: <code class="prompt">#</code> <strong class=
1.59      rillig   2157: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb</code></strong>
1.1       grant    2158: </pre>
                   2159: 
                   2160:               <p>If you created your partitions at the time of
                   2161:               installing Mac OS X and formatted the target
                   2162:               partition as UFS, it should automatically mount on
1.45      wiz      2163:               <code xmlns=
                   2164:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2165:               "filename">/Volumes/&lt;volume name&gt;</code> when
                   2166:               the machine boots. If you are (re)formatting a
                   2167:               partition as UFS, you need to ensure that the
                   2168:               partition map correctly reflects &#8220;<span class=
                   2169:               "quote">Apple_UFS</span>&#8221; and not
                   2170:               &#8220;<span class=
1.1       grant    2171:               "quote">Apple_HFS</span>&#8221;.</p>
                   2172: 
                   2173:               <p>The problem is that none of the disk tools will
                   2174:               let you touch a disk that is booted from. You can
                   2175:               unmount the partition, but even if you newfs it, the
                   2176:               partition type will be incorrect and the automounter
                   2177:               won't mount it. It can be mounted manually, but it
                   2178:               won't appear in Finder.</p>
                   2179: 
                   2180:               <p>You'll need to boot off of the OS X Installation
                   2181:               (User) CD. When the Installation program starts, go
                   2182:               up to the menu and select Disk Utility. Now, you will
                   2183:               be able to select the partition you want to be UFS,
                   2184:               and Format it Apple UFS. Quit the Disk Utility, quit
                   2185:               the installer which will reboot your machine. The new
                   2186:               UFS file system will appear in Finder.</p>
                   2187: 
                   2188:               <p>Be aware that the permissions on the new file
                   2189:               system will be writable by root only.</p>
                   2190: 
                   2191:               <p>This note is as of 10.2 (Jaguar) and applies to
                   2192:               earlier versions. Hopefully Apple will fix Disk
                   2193:               Utility in 10.3 (Panther).</p>
                   2194:             </div>
                   2195:           </div>
                   2196: 
1.67      hubertf  2197:           <div class="sect2" lang="en">
1.1       grant    2198:             <div class="titlepage">
                   2199:               <div>
                   2200:                 <div>
1.67      hubertf  2201:                   <h3 class="title"><a name=
1.30      wiz      2202:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    2203:                 </div>
                   2204:               </div>
                   2205:             </div>
                   2206: 
                   2207:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   2208:             supported, other versions may work.</p>
                   2209: 
                   2210:             <p>Care should be taken so that the tools that this kit
                   2211:             installs do not conflict with the FreeBSD userland
                   2212:             tools. There are several steps:</p>
                   2213: 
                   2214:             <div class="orderedlist">
                   2215:               <ol type="1">
                   2216:                 <li>
                   2217:                   <p>FreeBSD stores its ports pkg database in
1.45      wiz      2218:                   <code xmlns=
                   2219:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2220:                   "filename">/var/db/pkg</code>. It is therefore
                   2221:                   recommended that you choose a different location
                   2222:                   (e.g. <code xmlns=
                   2223:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2224:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2225:                   --pkgdbdir option to the bootstrap script.</p>
                   2226:                 </li>
                   2227: 
                   2228:                 <li>
                   2229:                   <p>If you do not intend to use the FreeBSD ports
                   2230:                   tools, it's probably a good idea to move them out
                   2231:                   of the way to avoid confusion, e.g.</p>
                   2232:                   <pre class="screen">
1.14      xtraeme  2233: <code class="prompt">#</code> <strong class=
                   2234: "userinput"><code>cd /usr/sbin</code></strong>
                   2235: <code class="prompt">#</code> <strong class=
                   2236: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2237: <code class="prompt">#</code> <strong class=
                   2238: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2239: <code class="prompt">#</code> <strong class=
                   2240: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2241: <code class="prompt">#</code> <strong class=
                   2242: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2243: </pre>
                   2244:                 </li>
                   2245: 
                   2246:                 <li>
1.45      wiz      2247:                   <p>An example <code xmlns=
                   2248:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2249:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2250:                   placed in <code xmlns=
                   2251:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2252:                   "filename">/etc/mk.conf.example</code> file when
                   2253:                   you use the bootstrap script.</p>
1.1       grant    2254:                 </li>
                   2255:               </ol>
                   2256:             </div>
                   2257:           </div>
                   2258: 
1.67      hubertf  2259:           <div class="sect2" lang="en">
1.1       grant    2260:             <div class="titlepage">
                   2261:               <div>
                   2262:                 <div>
1.67      hubertf  2263:                   <h3 class="title"><a name=
1.30      wiz      2264:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    2265:                 </div>
                   2266:               </div>
                   2267:             </div>
                   2268: 
1.47      reed     2269:             <p>Interix is a POSIX-compatible subsystem for the
1.1       grant    2270:             Windows NT kernel, providing a Unix-like environment
                   2271:             with a tighter kernel integration than available with
                   2272:             Cygwin. It is part of the Windows Services for Unix
                   2273:             package, available for free for any licensed copy of
1.22      tv       2274:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   2275:             can be downloaded from <a href=
                   2276:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    2277:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   2278: 
                   2279:             <p>Services for Unix 3.5, current as of this writing,
                   2280:             has been tested. 3.0 or 3.1 may work, but are not
                   2281:             officially supported. (The main difference in 3.0/3.1
                   2282:             is lack of pthreads.)</p>
                   2283: 
1.67      hubertf  2284:             <div class="sect3" lang="en">
1.1       grant    2285:               <div class="titlepage">
                   2286:                 <div>
                   2287:                   <div>
                   2288:                     <h4 class="title"><a name=
                   2289:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  2290:                     installing Interix/SFU</h4>
1.1       grant    2291:                   </div>
                   2292:                 </div>
                   2293:               </div>
                   2294: 
                   2295:               <p>At an absolute minimum, the following packages
                   2296:               must be installed from the Windows Services for Unix
                   2297:               3.5 distribution in order to use pkgsrc:</p>
                   2298: 
                   2299:               <div class="itemizedlist">
                   2300:                 <ul type="disc">
                   2301:                   <li>
                   2302:                     <p>Utilities -&gt; Base Utilities</p>
                   2303:                   </li>
                   2304: 
                   2305:                   <li>
                   2306:                     <p>Interix GNU Components -&gt; (all)</p>
                   2307:                   </li>
                   2308: 
                   2309:                   <li>
                   2310:                     <p>Remote Connectivity</p>
                   2311:                   </li>
                   2312: 
                   2313:                   <li>
                   2314:                     <p>Interix SDK</p>
                   2315:                   </li>
                   2316:                 </ul>
                   2317:               </div>
                   2318: 
                   2319:               <p>When using pkgsrc on Interix, DO NOT install the
                   2320:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   2321:               without shared module support, installed to
                   2322:               /usr/local, and will only cause confusion. Instead,
                   2323:               install Perl 5.8 from pkgsrc (or from a binary
                   2324:               package).</p>
                   2325: 
                   2326:               <p>The Remote Connectivity subcomponent "Windows
                   2327:               Remote Shell Service" does not need to be installed,
                   2328:               but Remote Connectivity itself should be installed in
                   2329:               order to have a working inetd.</p>
                   2330: 
1.52      tv       2331:               <p>During installation you may be asked whether to
                   2332:               enable setuid behavior for Interix programs, and
                   2333:               whether to make pathnames default to case-sensitive.
                   2334:               Setuid should be enabled, and case-sensitivity MUST
                   2335:               be enabled. (Without case-sensitivity, a large number
                   2336:               of packages including perl will not build.)</p>
                   2337: 
                   2338:               <p>NOTE: Newer Windows service packs change the way
                   2339:               binary execution works (via the Data Execution
                   2340:               Prevention feature). In order to use pkgsrc and other
                   2341:               gcc-compiled binaries reliably, a hotfix containing
                   2342:               POSIX.EXE, PSXDLL.DLL, PSXRUN.EXE, and PSXSS.EXE
                   2343:               (899522 or newer) must be installed. Hotfixes are
                   2344:               available from Microsoft through a support contract;
                   2345:               however, a NetBSD developer has made most Interix
                   2346:               hotfixes available for personal use from <a href=
                   2347:               "http://www.duh.org/interix/hotfixes.php" target=
                   2348:               "_top">http://www.duh.org/interix/hotfixes.php</a>.</p>
1.1       grant    2349:             </div>
                   2350: 
1.67      hubertf  2351:             <div class="sect3" lang="en">
1.1       grant    2352:               <div class="titlepage">
                   2353:                 <div>
                   2354:                   <div>
                   2355:                     <h4 class="title"><a name=
                   2356:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2357:                     to do if Interix/SFU is already installed</h4>
                   2358:                   </div>
                   2359:                 </div>
                   2360:               </div>
                   2361: 
                   2362:               <p>If SFU is already installed and you wish to alter
                   2363:               these settings to work with pkgsrc, note the
                   2364:               following things.</p>
                   2365: 
                   2366:               <div class="itemizedlist">
                   2367:                 <ul type="disc">
                   2368:                   <li>
                   2369:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2370:                     Programs, select Microsoft Windows Services for
                   2371:                     UNIX, then click Change. In the installer,
                   2372:                     choose Add or Remove, then uncheck
                   2373:                     Utilities-&gt;UNIX Perl.</p>
                   2374:                   </li>
                   2375: 
                   2376:                   <li>
1.47      reed     2377:                     <p>To enable case-sensitivity for the file
                   2378:                     system, run REGEDIT.EXE, and change the
1.1       grant    2379:                     following registry key:</p>
                   2380: 
                   2381:                     <p>
                   2382:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2383:                     Manager\kernel</p>
                   2384: 
                   2385:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2386:                     0; then reboot.</p>
                   2387:                   </li>
                   2388: 
                   2389:                   <li>
                   2390:                     <p>To enable setuid binaries (optional), run
                   2391:                     REGEDIT.EXE, and change the following registry
                   2392:                     key:</p>
                   2393: 
                   2394:                     <p>
                   2395:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2396:                     for UNIX</p>
                   2397: 
                   2398:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2399:                     to 1; then reboot.</p>
                   2400:                   </li>
                   2401:                 </ul>
                   2402:               </div>
                   2403:             </div>
                   2404: 
1.67      hubertf  2405:             <div class="sect3" lang="en">
1.1       grant    2406:               <div class="titlepage">
                   2407:                 <div>
                   2408:                   <div>
                   2409:                     <h4 class="title"><a name=
                   2410:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2411:                     notes for using pkgsrc</h4>
                   2412:                   </div>
                   2413:                 </div>
                   2414:               </div>
                   2415: 
1.52      tv       2416:               <p>The package manager (either the pkgsrc "su" user,
1.1       grant    2417:               or the user running "pkg_add") must be a member of
                   2418:               the local Administrators group. Such a user must also
                   2419:               be used to run the bootstrap. This is slightly
                   2420:               relaxed from the normal pkgsrc requirement of
                   2421:               "root".</p>
                   2422: 
                   2423:               <p>The package manager should use a umask of 002.
                   2424:               "make install" will automatically complain if this is
                   2425:               not the case. This ensures that directories written
                   2426:               in /var/db/pkg are Administrators-group
                   2427:               writeable.</p>
                   2428: 
                   2429:               <p>The popular Interix binary packages from
                   2430:               http://www.interopsystems.com/ use an older version
                   2431:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2432:               used in conjunction with pkgsrc. If you choose to use
                   2433:               them at the same time as the pkgsrc packages, ensure
                   2434:               that you use the proper pkg_* tools for each type of
                   2435:               binary package.</p>
1.22      tv       2436: 
                   2437:               <p>The TERM setting used for DOS-type console windows
                   2438:               (including those invoked by the csh and ksh startup
                   2439:               shortcuts) is "interix". Most systems don't have a
                   2440:               termcap/terminfo entry for it, but the following
                   2441:               .termcap entry provides adequate emulation in most
                   2442:               cases:</p>
                   2443:               <pre class="programlisting">
1.51      rillig   2444:     interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
1.22      tv       2445: </pre>
1.1       grant    2446:             </div>
1.52      tv       2447: 
1.67      hubertf  2448:             <div class="sect3" lang="en">
1.52      tv       2449:               <div class="titlepage">
                   2450:                 <div>
                   2451:                   <div>
                   2452:                     <h4 class="title"><a name=
                   2453:                     "platform.interix-limits"></a>3.2.3.4.&nbsp;Limitations
                   2454:                     of the Interix platform</h4>
                   2455:                   </div>
                   2456:                 </div>
                   2457:               </div>
                   2458: 
                   2459:               <p>Though Interix suffices as a familiar and flexible
                   2460:               substitute for a full Unix-like platform, it has some
                   2461:               drawbacks that should be noted for those desiring to
                   2462:               make the most of Interix.</p>
                   2463: 
                   2464:               <div class="itemizedlist">
                   2465:                 <ul type="disc">
                   2466:                   <li>
1.54      tv       2467:                     <p><span class=
1.57      minskim  2468:                     "strong"><strong>X11:</strong></span></p>
1.52      tv       2469: 
                   2470:                     <p>Interix comes with the standard set of X11R6
1.57      minskim  2471:                     client libraries, and can run X11 based
1.52      tv       2472:                     applications, but it does <span class=
                   2473:                     "emphasis"><em>not</em></span> come with an X
                   2474:                     server. Some options are <a href=
                   2475:                     "http://www.starnet.com/products/xwin32/"
                   2476:                     target="_top">StarNet X-Win32</a>, <a href=
                   2477:                     "http://connectivity.hummingbird.com/products/nc/exceed/"
1.57      minskim  2478:                     target="_top">Hummingbird Exceed</a> (available
                   2479:                     in a trimmed version for Interix from Interop
                   2480:                     Systems as the <a href=
                   2481:                     "http://www.interopsystems.com/InteropXserver.htm"
                   2482:                     target="_top">Interop X Server</a>), and the
                   2483:                     free X11 server included with <a href=
1.52      tv       2484:                     "http://x.cygwin.com/" target=
                   2485:                     "_top">Cygwin</a>.</p>
                   2486: 
                   2487:                     <p>Also, StarNet Communications has graciously
                   2488:                     provided a free version of their X-Win32
                   2489:                     product that accepts connections only from
                   2490:                     localhost: <a href=
                   2491:                     "http://www.starnet.com/xwin32LX/get_xwin32LX.htm"
                   2492:                     target="_top">X-Win32 LX</a>, recommended by
                   2493:                     the maintainer of Interix pkgsrc support.</p>
                   2494:                   </li>
                   2495: 
                   2496:                   <li>
1.57      minskim  2497:                     <p><span class="strong"><strong>X11
1.54      tv       2498:                     acceleration:</strong></span></p>
1.52      tv       2499: 
                   2500:                     <p>Because Interix runs in a completely
                   2501:                     different NT subsystem from Win32 applications,
                   2502:                     it does not currently support various X11
                   2503:                     protocol extensions for acceleration (such as
                   2504:                     MIT-SHM or DGA). Most interactive applications
                   2505:                     to a local X server will run reasonably fast,
                   2506:                     but full motion video and other graphics
                   2507:                     intensive applications may require a
                   2508:                     faster-than-expected CPU.</p>
                   2509:                   </li>
                   2510: 
                   2511:                   <li>
1.54      tv       2512:                     <p><span class=
                   2513:                     "strong"><strong>Audio:</strong></span></p>
1.52      tv       2514: 
                   2515:                     <p>Interix has no native support for audio
1.53      tv       2516:                     output. For audio support, pkgsrc uses the
                   2517:                     <span><strong class=
1.52      tv       2518:                     "command">esound</strong></span> client/server
                   2519:                     audio system on Interix. Unlike on most
                   2520:                     platforms, the <a xmlns=
                   2521:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2522:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/esound/README.html"
                   2523:                     target="_top"><code xmlns="" class=
                   2524:                     "filename">audio/esound</code></a> package does
                   2525:                     <span class="emphasis"><em>not</em></span>
                   2526:                     contain the <span><strong class=
1.53      tv       2527:                     "command">esd</strong></span> server component.
                   2528:                     To output audio via an Interix host, the
                   2529:                     <a xmlns=
1.52      tv       2530:                     "http://www.w3.org/TR/xhtml1/transitional"
                   2531:                     href="ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/cygwin_esound/README.html"
                   2532:                     target="_top"><code xmlns="" class=
                   2533:                     "filename">emulators/cygwin_esound</code></a>
                   2534:                     package must also be installed.</p>
                   2535:                   </li>
                   2536: 
                   2537:                   <li>
1.54      tv       2538:                     <p><span class="strong"><strong>CD/DVDs, USB,
                   2539:                     and SCSI:</strong></span></p>
1.52      tv       2540: 
                   2541:                     <p>Direct device access is not currently
                   2542:                     supported in Interix, so it is not currently
                   2543:                     possible to access CD/DVD drives, USB devices,
                   2544:                     or SCSI devices through non-filesystem means.
                   2545:                     Among other things, this makes it impossible to
                   2546:                     use Interix directly for CD/DVD burning.</p>
                   2547:                   </li>
                   2548: 
                   2549:                   <li>
1.54      tv       2550:                     <p><span class="strong"><strong>Tape
                   2551:                     drives:</strong></span></p>
1.52      tv       2552: 
                   2553:                     <p>Due to the same limitations as for CD-ROMs
                   2554:                     and SCSI devices, tape drives are also not
                   2555:                     directly accessible in Interix. However,
                   2556:                     support is in work to make tape drive access
                   2557:                     possible by using Cygwin as a bridge (similarly
                   2558:                     to audio bridged via Cygwin's esound
                   2559:                     server).</p>
                   2560:                   </li>
                   2561:                 </ul>
                   2562:               </div>
                   2563:             </div>
                   2564: 
1.67      hubertf  2565:             <div class="sect3" lang="en">
1.52      tv       2566:               <div class="titlepage">
                   2567:                 <div>
                   2568:                   <div>
                   2569:                     <h4 class="title"><a name=
                   2570:                     "platform.interix-knownissues"></a>3.2.3.5.&nbsp;Known
                   2571:                     issues for pkgsrc on Interix</h4>
                   2572:                   </div>
                   2573:                 </div>
                   2574:               </div>
                   2575: 
                   2576:               <p>It is not necessary, in general, to have a "root"
                   2577:               user on the Windows system; any member of the local
                   2578:               Administrators group will suffice. However, some
                   2579:               packages currently assume that the user named "root"
                   2580:               is the privileged user. To accommodate these, you may
                   2581:               create such a user; make sure it is in the local
                   2582:               group Administrators (or your language
                   2583:               equivalent).</p>
                   2584: 
                   2585:               <p>"pkg_add" creates directories of mode 0755, not
                   2586:               0775, in $PKG_DBDIR. For the time being, install
                   2587:               packages as the local Administrator (or your language
                   2588:               equivalent), or run the following command after
                   2589:               installing a package to work around the issue:</p>
                   2590:               <pre class="screen">
                   2591: <code class="prompt">#</code> <strong class=
                   2592: "userinput"><code>chmod -R g+w $PKG_DBDIR</code></strong>
                   2593: </pre>
                   2594:             </div>
1.1       grant    2595:           </div>
                   2596: 
1.67      hubertf  2597:           <div class="sect2" lang="en">
1.1       grant    2598:             <div class="titlepage">
                   2599:               <div>
                   2600:                 <div>
1.67      hubertf  2601:                   <h3 class="title"><a name=
1.30      wiz      2602:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2603:                 </div>
                   2604:               </div>
                   2605:             </div>
                   2606: 
                   2607:             <p>You will need a working C compiler, either gcc or
                   2608:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2609:             the <code class="varname">CC</code> environment
                   2610:             variable according to your preference. If you do not
                   2611:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2612:             download a gcc tardist file from <a href=
                   2613:             "http://freeware.sgi.com/" target=
                   2614:             "_top">http://freeware.sgi.com/</a>.</p>
                   2615: 
                   2616:             <p>Please note that you will need IRIX 6.5.17 or
                   2617:             higher, as this is the earliest version of IRIX
1.24      wiz      2618:             providing support for <a href=
                   2619:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2620:             <span class="citerefentry"><span class=
                   2621:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2622:             <a href=
                   2623:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2624:             <span class="citerefentry"><span class=
                   2625:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2626:             etc.</p>
1.1       grant    2627: 
1.27      rillig   2628:             <p>At this point in time, pkgsrc only supports one ABI
                   2629:             at a time. That is, you can not switch between the old
                   2630:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2631:             you start out using "abi=n32", that's what all your
                   2632:             packages will be built with.</p>
1.1       grant    2633: 
                   2634:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2635:             conflicting <code class="varname">CFLAGS</code> in your
1.45      wiz      2636:             environment or the <code xmlns=
                   2637:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2638:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2639:             that you do not try to link n32 object files with lib64
1.45      wiz      2640:             or vice versa. Check your <code xmlns=
                   2641:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2642:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2643: 
                   2644:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2645:             from a different host, please make sure to set
1.14      xtraeme  2646:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2647:             directory, as it appears that IRIX linker occasionally
1.47      reed     2648:             runs into issues when trying to link over a
                   2649:             network-mounted file system.</p>
1.1       grant    2650: 
                   2651:             <p>The bootstrapping process should set all the right
                   2652:             options for programs such as imake(1), but you may want
                   2653:             to set some options depending on your local setup.
1.45      wiz      2654:             Please see <code xmlns=
                   2655:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2656:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2657:             course, your compiler's man pages for details.</p>
1.22      tv       2658: 
                   2659:             <p>If you are using SGI's MIPSPro compiler, please
                   2660:             set</p>
                   2661:             <pre class="programlisting">
1.51      rillig   2662:     PKGSRC_COMPILER=        mipspro
1.22      tv       2663: </pre>
                   2664: 
1.45      wiz      2665:             <p>in <code xmlns=
                   2666:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   2667:             "filename">/etc/mk.conf</code>. Otherwise, pkgsrc will
                   2668:             assume you are using gcc and may end up passing invalid
                   2669:             flags to the compiler. Note that bootstrap should
                   2670:             create an appropriate <code xmlns=
                   2671:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2672:             "filename">mk.conf.example</code> by default.</p>
                   2673: 
                   2674:             <p>If you have both the MIPSPro compiler chain
                   2675:             installed as well as gcc, but want to make sure that
                   2676:             MIPRPro is used, please set your <code class=
                   2677:             "varname">PATH</code> to <span class=
                   2678:             "emphasis"><em>not</em></span> include the location of
1.45      wiz      2679:             gcc (often <code xmlns=
                   2680:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2681:             "filename">/usr/freeware/bin</code>), and (important)
                   2682:             pass the '--preserve-path' flag.</p>
1.1       grant    2683:           </div>
                   2684: 
1.67      hubertf  2685:           <div class="sect2" lang="en">
1.1       grant    2686:             <div class="titlepage">
                   2687:               <div>
                   2688:                 <div>
1.67      hubertf  2689:                   <h3 class="title"><a name=
1.30      wiz      2690:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2691:                 </div>
                   2692:               </div>
                   2693:             </div>
                   2694: 
                   2695:             <p>Some versions of Linux (for example Debian
                   2696:             GNU/Linux) need either libtermcap or libcurses
                   2697:             (libncurses). Installing the distributions
                   2698:             libncurses-dev package (or equivalent) should fix the
                   2699:             problem.</p>
                   2700: 
                   2701:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2702:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2703:             8.0 and 8.1 on i386 have been tested.</p>
                   2704: 
                   2705:             <p>To bootstrap using icc, assuming the default icc
                   2706:             installation directory:</p>
                   2707:             <pre class="programlisting">
1.51      rillig   2708:     env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2709:             ac_cv___attribute__=yes ./bootstrap
1.22      tv       2710: </pre>
                   2711: 
                   2712:             <div class="note" style=
                   2713:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2714:               <h3 class="title">Note</h3>
                   2715: 
                   2716:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2717:               -static-libcxa.</p>
                   2718:             </div>
                   2719: 
                   2720:             <p>icc supports __attribute__, but the GNU configure
                   2721:             test uses a nested function, which icc does not
                   2722:             support. #undef'ing __attribute__ has the unfortunate
                   2723:             side-effect of breaking many of the Linux header files,
                   2724:             which cannot be compiled properly without
                   2725:             __attribute__. The test must be overridden so that
                   2726:             __attribute__ is assumed supported by the compiler.</p>
                   2727: 
                   2728:             <p>After bootstrapping, you should set <code class=
1.45      wiz      2729:             "varname">PKGSRC_COMPILER</code> in <code xmlns=
                   2730:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2731:             "filename">/etc/mk.conf</code>:</p>
                   2732:             <pre class="programlisting">
1.51      rillig   2733:     PKGSRC_COMPILER=        icc
1.22      tv       2734: </pre>
                   2735: 
                   2736:             <p>The default installation directory for icc is
1.45      wiz      2737:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2738:             class="filename">/opt/intel_cc_80</code>, which is also
                   2739:             the pkgsrc default. If you have installed it into a
                   2740:             different directory, set <code class=
                   2741:             "varname">ICCBASE</code> in <code xmlns=
                   2742:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.22      tv       2743:             "filename">/etc/mk.conf</code>:</p>
                   2744:             <pre class="programlisting">
1.51      rillig   2745:     ICCBASE=                /opt/icc
1.22      tv       2746: </pre>
                   2747: 
                   2748:             <p>pkgsrc uses the static linking method of the runtime
                   2749:             libraries provided by icc, so binaries can be run on
                   2750:             other systems which do not have the shared libraries
                   2751:             installed.</p>
                   2752: 
                   2753:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2754:             the <a href=
                   2755:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2756:             <span class="citerefentry"><span class=
                   2757:             "refentrytitle">ld</span>(1)</span></a> command run
                   2758:             when linking a C++ shared library and records it,
                   2759:             throwing away the -Bstatic and -Bdynamic options
                   2760:             interspersed between the libraries. This means that
                   2761:             libtool-linked C++ shared libraries will have a runtime
                   2762:             dependency on the icc libraries until this is fixed in
                   2763:             libtool.</p>
1.22      tv       2764:           </div>
                   2765: 
1.67      hubertf  2766:           <div class="sect2" lang="en">
1.22      tv       2767:             <div class="titlepage">
                   2768:               <div>
                   2769:                 <div>
1.67      hubertf  2770:                   <h3 class="title"><a name=
1.30      wiz      2771:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2772:                 </div>
                   2773:               </div>
                   2774:             </div>
                   2775: 
                   2776:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2777: 
                   2778:             <p>Care should be taken so that the tools that this kit
                   2779:             installs do not conflict with the OpenBSD userland
                   2780:             tools. There are several steps:</p>
                   2781: 
                   2782:             <div class="orderedlist">
                   2783:               <ol type="1">
                   2784:                 <li>
                   2785:                   <p>OpenBSD stores its ports pkg database in
1.45      wiz      2786:                   <code xmlns=
                   2787:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   2788:                   "filename">/var/db/pkg</code>. It is therefore
                   2789:                   recommended that you choose a different location
                   2790:                   (e.g. <code xmlns=
                   2791:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2792:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2793:                   --pkgdbdir option to the bootstrap script.</p>
                   2794:                 </li>
                   2795: 
                   2796:                 <li>
                   2797:                   <p>If you do not intend to use the OpenBSD ports
                   2798:                   tools, it's probably a good idea to move them out
                   2799:                   of the way to avoid confusion, e.g.</p>
                   2800:                   <pre class="screen">
1.14      xtraeme  2801: <code class="prompt">#</code> <strong class=
                   2802: "userinput"><code>cd /usr/sbin</code></strong>
                   2803: <code class="prompt">#</code> <strong class=
                   2804: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2805: <code class="prompt">#</code> <strong class=
                   2806: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2807: <code class="prompt">#</code> <strong class=
                   2808: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2809: <code class="prompt">#</code> <strong class=
                   2810: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2811: </pre>
                   2812:                 </li>
                   2813: 
                   2814:                 <li>
1.45      wiz      2815:                   <p>An example <code xmlns=
                   2816:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2817:                   "filename">/etc/mk.conf</code> file will be
1.45      wiz      2818:                   placed in <code xmlns=
                   2819:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2820:                   "filename">/etc/mk.conf.example</code> file when
                   2821:                   you use the bootstrap script. OpenBSD's make
1.45      wiz      2822:                   program uses <code xmlns=
                   2823:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  2824:                   "filename">/etc/mk.conf</code> as well. You can
1.47      reed     2825:                   work around this by enclosing all the
                   2826:                   pkgsrc-specific parts of the file with:</p>
1.1       grant    2827:                   <pre class="programlisting">
1.51      rillig   2828:     .ifdef BSD_PKG_MK
                   2829:     # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
                   2830:     .else
                   2831:     # OpenBSD stuff
                   2832:     .endif
1.1       grant    2833: </pre>
                   2834:                 </li>
                   2835:               </ol>
                   2836:             </div>
                   2837:           </div>
                   2838: 
1.67      hubertf  2839:           <div class="sect2" lang="en">
1.1       grant    2840:             <div class="titlepage">
                   2841:               <div>
                   2842:                 <div>
1.67      hubertf  2843:                   <h3 class="title"><a name=
1.30      wiz      2844:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2845:                 </div>
                   2846:               </div>
                   2847:             </div>
                   2848: 
                   2849:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2850:             sparc. You will need a working C compiler. Both gcc
                   2851:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2852: 
                   2853:             <p>The following packages are required on Solaris 8 for
                   2854:             the bootstrap process and to build packages.</p>
                   2855: 
                   2856:             <div class="itemizedlist">
                   2857:               <ul type="disc">
                   2858:                 <li>
                   2859:                   <p>SUNWsprot</p>
                   2860:                 </li>
                   2861: 
                   2862:                 <li>
                   2863:                   <p>SUNWarc</p>
                   2864:                 </li>
                   2865: 
                   2866:                 <li>
                   2867:                   <p>SUNWbtool</p>
                   2868:                 </li>
                   2869: 
                   2870:                 <li>
                   2871:                   <p>SUNWtoo</p>
                   2872:                 </li>
                   2873: 
                   2874:                 <li>
                   2875:                   <p>SUNWlibm</p>
                   2876:                 </li>
                   2877:               </ul>
                   2878:             </div>
                   2879: 
                   2880:             <p>Please note the use of GNU binutils on Solaris is
                   2881:             <span class="emphasis"><em>not</em></span>
                   2882:             supported.</p>
                   2883: 
1.70      rillig   2884:             <p>Whichever compiler you use, please ensure the
                   2885:             compiler tools and your $prefix are in your
                   2886:             <code class="varname">PATH</code>. This includes
                   2887:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2888:             class="filename">/usr/ccs/{bin,lib}</code> and e.g.
                   2889:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2890:             class="filename">/usr/pkg/{bin,sbin}</code>.</p>
                   2891: 
1.67      hubertf  2892:             <div class="sect3" lang="en">
1.1       grant    2893:               <div class="titlepage">
                   2894:                 <div>
                   2895:                   <div>
1.67      hubertf  2896:                     <h4 class="title"><a name=
                   2897:                     "solaris-gcc-note"></a>3.2.7.1.&nbsp;If you are
                   2898:                     using gcc</h4>
1.1       grant    2899:                   </div>
                   2900:                 </div>
                   2901:               </div>
                   2902: 
                   2903:               <p>It makes life much simpler if you only use the
                   2904:               same gcc consistently for building all packages.</p>
                   2905: 
                   2906:               <p>It is recommended that an external gcc be used
                   2907:               only for bootstrapping, then either build gcc from
                   2908:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2909:               href=
                   2910:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.45      wiz      2911:               target="_top"><code xmlns="" class=
                   2912:               "filename">lang/gcc</code></a> or install a binary
                   2913:               gcc package, then remove gcc used during
1.20      ben      2914:               bootstrapping.</p>
1.1       grant    2915: 
                   2916:               <p>Binary packages of gcc can be found through
                   2917:               <a href=
                   2918:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2919:               target=
                   2920:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2921:             </div>
                   2922: 
1.67      hubertf  2923:             <div class="sect3" lang="en">
1.1       grant    2924:               <div class="titlepage">
                   2925:                 <div>
                   2926:                   <div>
1.30      wiz      2927:                     <h4 class="title"><a name=
                   2928:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
                   2929:                     you are using Sun WorkShop</h4>
1.1       grant    2930:                   </div>
                   2931:                 </div>
                   2932:               </div>
                   2933: 
                   2934:               <p>You will need at least the following packages
                   2935:               installed (from WorkShop 5.0)</p>
                   2936: 
                   2937:               <div class="itemizedlist">
                   2938:                 <ul type="disc">
                   2939:                   <li>
                   2940:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2941:                   </li>
                   2942: 
                   2943:                   <li>
                   2944:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2945:                   </li>
                   2946: 
                   2947:                   <li>
                   2948:                     <p>SPROild - Sun WorkShop Incremental
                   2949:                     Linker</p>
                   2950:                   </li>
                   2951: 
                   2952:                   <li>
                   2953:                     <p>SPROlang - Sun WorkShop Compilers common
                   2954:                     components</p>
                   2955:                   </li>
                   2956:                 </ul>
                   2957:               </div>
                   2958: 
1.14      xtraeme  2959:               <p>You should set <code class="varname">CC</code>,
                   2960:               <code class="varname">CXX</code> and optionally,
1.45      wiz      2961:               <code class="varname">CPP</code> in <code xmlns=
                   2962:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     2963:               "filename">/etc/mk.conf</code>, e.g.:</p>
1.1       grant    2964:               <pre class="programlisting">
1.51      rillig   2965:     CC=     cc
                   2966:     CXX=    CC
                   2967:     CPP=    /usr/ccs/lib/cpp
1.1       grant    2968: </pre>
1.70      rillig   2969:             </div>
                   2970: 
                   2971:             <div class="sect3" lang="en">
                   2972:               <div class="titlepage">
                   2973:                 <div>
                   2974:                   <div>
                   2975:                     <h4 class="title"><a name=
                   2976:                     "solaris-sunpro-64"></a>3.2.7.3.&nbsp;Buildling
                   2977:                     64-bit binaries with SunPro</h4>
                   2978:                   </div>
                   2979:                 </div>
                   2980:               </div>
1.1       grant    2981: 
1.70      rillig   2982:               <p>Building 64-bit binaries is a little trickier.
                   2983:               First, you need to bootstrap pkgsrc in 64-bit mode.
                   2984:               One problem here is that while building one of the
                   2985:               programs in the bootstrap kit (<code xmlns=
                   2986:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2987:               "filename">bmake</code>), the <code class=
                   2988:               "varname">CFLAGS</code> variable is not honored, even
                   2989:               if it is set in the environment. To work around this
                   2990:               bug, you can create a simple shell script called
                   2991:               <code xmlns=
                   2992:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   2993:               "filename">cc64</code> and put it somewhere in the
                   2994:               <code class="varname">PATH</code>:</p>
                   2995:               <pre class="programlisting">
                   2996:     #! /bin/sh
                   2997:     exec /opt/SUNWspro/bin/cc -xtarget=ultra -xarch=v9 ${1+"$@"}
                   2998: </pre>
                   2999: 
                   3000:               <p>Then, pass the definition for <code class=
                   3001:               "varname">CC</code> in the environment of the
                   3002:               <span><strong class=
                   3003:               "command">bootstrap</strong></span> command:</p>
                   3004:               <pre class="programlisting">
                   3005:     <code class="prompt">$</code> <strong class=
                   3006: "userinput"><code>cd bootstrap</code></strong>
                   3007:     <code class="prompt">$</code> <strong class=
                   3008: "userinput"><code>CC=cc64 ./bootstrap</code></strong>
                   3009: </pre>
                   3010: 
                   3011:               <p>After bootstrapping, there are two alternative
                   3012:               ways, depending on whether you want to find bugs in
                   3013:               packages or get your system ready quickly. If you
                   3014:               just want a running system, add the following lines
                   3015:               to your <code xmlns=
                   3016:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3017:               "filename">mk.conf</code> file:</p>
1.1       grant    3018:               <pre class="programlisting">
1.70      rillig   3019:     CC=                     cc64
                   3020:     CXX=                    CC64
                   3021:     PKGSRC_COMPILER=        sunpro
1.1       grant    3022: </pre>
                   3023: 
1.70      rillig   3024:               <p>This way, all calls to the compiler will be
                   3025:               intercepted by the above wrapper and therefore get
                   3026:               the necessary ABI options automatically. (Don't
                   3027:               forget to create the shell script <code xmlns=
1.45      wiz      3028:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.70      rillig   3029:               "filename">CC64</code>, too.)</p>
                   3030: 
                   3031:               <p>To find packages that ignore the user-specified
                   3032:               <code class="varname">CFLAGS</code> and <code class=
                   3033:               "varname">CXXFLAGS</code>, add the following lines to
                   3034:               your <code xmlns=
1.45      wiz      3035:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.70      rillig   3036:               "filename">mk.conf</code> file:</p>
                   3037:               <pre class="programlisting">
                   3038:     CC=                     cc
                   3039:     CXX=                    CC
                   3040:     PKGSRC_COMPILER=        sunpro
                   3041:     CFLAGS=                 -xtarget=ultra -xarch=v9
                   3042:     CXXFLAGS=               -xtarget=ultra -xarch=v9
                   3043:     LDFLAGS=                -xtarget=ultra -xarch=v9
                   3044: </pre>
                   3045: 
                   3046:               <p>Packages that don't use the flags provided in the
                   3047:               configuration file will try to build 32-bit binaries
                   3048:               and fail during linking. Detecting this is useful to
                   3049:               prevent bugs on other platforms where the error would
                   3050:               not show up but pass silently.</p>
1.1       grant    3051:             </div>
1.68      rillig   3052: 
                   3053:             <div class="sect3" lang="en">
                   3054:               <div class="titlepage">
                   3055:                 <div>
                   3056:                   <div>
                   3057:                     <h4 class="title"><a name=
1.70      rillig   3058:                     "plat.sunos.problems"></a>3.2.7.4.&nbsp;Common
1.68      rillig   3059:                     problems</h4>
                   3060:                   </div>
                   3061:                 </div>
                   3062:               </div>
                   3063: 
                   3064:               <p>Sometimes, when using <span><strong class=
                   3065:               "command">libtool</strong></span>, <code xmlns=
                   3066:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3067:               "filename">/bin/ksh</code> crashes with a
                   3068:               segmentation fault. The workaround is to use another
                   3069:               shell for the configure scripts, for example by
                   3070:               installing <a xmlns=
                   3071:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   3072:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
                   3073:               target="_top"><code xmlns="" class=
                   3074:               "filename">shells/bash</code></a> and adding the
1.69      rillig   3075:               following lines to your <code xmlns=
1.68      rillig   3076:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   3077:               "filename">mk.conf</code>:</p>
                   3078:               <pre class="programlisting">
                   3079:     CONFIG_SHELL=   ${LOCALBASE}/bin/bash
1.69      rillig   3080:     WRAPPER_SHELL=  ${LOCALBASE}/bin/bash
1.68      rillig   3081: </pre>
1.71    ! wiz      3082: 
        !          3083:               <p>Then, rebuild the <a xmlns=
        !          3084:               "http://www.w3.org/TR/xhtml1/transitional" href=
        !          3085:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool-base/README.html"
        !          3086:               target="_top"><code xmlns="" class=
        !          3087:               "filename">devel/libtool-base</code></a> package.</p>
1.68      rillig   3088:             </div>
1.1       grant    3089:           </div>
                   3090:         </div>
                   3091:       </div>
                   3092: 
1.67      hubertf  3093:       <div class="chapter" lang="en">
1.1       grant    3094:         <div class="titlepage">
                   3095:           <div>
                   3096:             <div>
1.67      hubertf  3097:               <h2 class="title"><a name=
1.1       grant    3098:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   3099:             </div>
                   3100:           </div>
                   3101:         </div>
                   3102: 
                   3103:         <div class="toc">
                   3104:           <p><b>Table of Contents</b></p>
                   3105: 
                   3106:           <dl>
1.70      rillig   3107:             <dt><span class="sect1"><a href="#using-pkg">4.1. Using
                   3108:             binary packages</a></span></dt>
1.1       grant    3109: 
                   3110:             <dd>
                   3111:               <dl>
1.30      wiz      3112:                 <dt><span class="sect2"><a href=
1.70      rillig   3113:                 "#finding-binary-packages">4.1.1. Finding binary
                   3114:                 packages</a></span></dt>
1.1       grant    3115: 
1.30      wiz      3116:                 <dt><span class="sect2"><a href=
1.70      rillig   3117:                 "#installing-binary-packages">4.1.2. Installing
1.30      wiz      3118:                 binary packages</a></span></dt>
1.1       grant    3119: 
1.30      wiz      3120:                 <dt><span class="sect2"><a href=
                   3121:                 "#a-word-of-warning">4.1.3. A word of
                   3122:                 warning</a></span></dt>
1.1       grant    3123:               </dl>
                   3124:             </dd>
                   3125: 
1.30      wiz      3126:             <dt><span class="sect1"><a href=
                   3127:             "#building-packages-from-source">4.2. Building packages
                   3128:             from source</a></span></dt>
1.1       grant    3129: 
                   3130:             <dd>
                   3131:               <dl>
1.30      wiz      3132:                 <dt><span class="sect2"><a href=
                   3133:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    3134: 
1.30      wiz      3135:                 <dt><span class="sect2"><a href=
                   3136:                 "#fetching-distfiles">4.2.2. Fetching
                   3137:                 distfiles</a></span></dt>
1.1       grant    3138: 
1.30      wiz      3139:                 <dt><span class="sect2"><a href=
                   3140:                 "#how-to-build-and-install">4.2.3. How to build and
                   3141:                 install</a></span></dt>
1.1       grant    3142: 
1.30      wiz      3143:                 <dt><span class="sect2"><a href=
                   3144:                 "#selecting-the-compiler">4.2.4. Selecting the
                   3145:                 compiler</a></span></dt>
1.1       grant    3146:               </dl>
                   3147:             </dd>
                   3148:           </dl>
                   3149:         </div>
                   3150: 
1.70      rillig   3151:         <p>Basically, there are two ways of using pkgsrc. The first
                   3152:         is to only install the package tools and to use binary
                   3153:         packages that someone else has prepared. This is the
                   3154:         &#8220;<span class="quote">pkg</span>&#8221; in pkgsrc. The
                   3155:         second way is to install the &#8220;<span class=
                   3156:         "quote">src</span>&#8221; of pkgsrc, too. Then you are able
                   3157:         to build your own packages, and you can still use binary
                   3158:         packages from someone else.</p>
                   3159: 
1.67      hubertf  3160:         <div class="sect1" lang="en">
1.1       grant    3161:           <div class="titlepage">
                   3162:             <div>
                   3163:               <div>
                   3164:                 <h2 class="title" style="clear: both"><a name=
1.70      rillig   3165:                 "using-pkg"></a>4.1.&nbsp;Using binary
1.1       grant    3166:                 packages</h2>
                   3167:               </div>
                   3168:             </div>
                   3169:           </div>
                   3170: 
1.70      rillig   3171:           <p>To use binary packages, you need some tools to manage
                   3172:           them. On NetBSD, these tools are already installed. On
                   3173:           all other operating systems, you need to install them
                   3174:           first. For the following platforms, prebuilt versions of
                   3175:           the package tools are available and can simply be
                   3176:           downloaded and unpacked in the <code xmlns=
                   3177:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   3178:           "filename">/</code> directory:</p>
                   3179: 
                   3180:           <div class="informaltable">
                   3181:             <a name="binary-bootstrap-kits"></a>
                   3182: 
                   3183:             <table border="1">
                   3184:               <colgroup>
                   3185:                 <col />
                   3186:                 <col />
                   3187:               </colgroup>
                   3188: 
                   3189:               <thead>
                   3190:                 <tr>
                   3191:                   <th>Platform</th>
                   3192: 
                   3193:                   <th>URL</th>
                   3194:                 </tr>
                   3195:               </thead>
                   3196: 
                   3197:               <tbody>
                   3198:                 <tr>
                   3199:                   <td>Solaris 5.10</td>
                   3200: 
                   3201:                   <td><code xmlns=
                   3202:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   3203:                   "filename">http://public.enst.fr/pkgsrc/packages/bootstrap-pkgsrc/</code></td>
                   3204:                 </tr>
                   3205:               </tbody>
                   3206:             </table>
                   3207:           </div>
                   3208: 
                   3209:           <p>These prebuilt package tools use <code xmlns=
                   3210:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   3211:           "filename">/usr/pkg</code> for the base directory, and
                   3212:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3213:           class="filename">/var/db/pkg</code> for the database of
                   3214:           installed packages. If you cannot use these directories
                   3215:           for whatever reasons (maybe because you're not root), you
                   3216:           have to build the package tools yourself, which is
                   3217:           explained in <a href="#bootstrapping-pkgsrc" title=
                   3218:           "3.1.&nbsp;Bootstrapping pkgsrc">Section&nbsp;3.1,
                   3219:           &#8220;Bootstrapping pkgsrc&#8221;</a>.</p>
1.1       grant    3220: 
1.67      hubertf  3221:           <div class="sect2" lang="en">
1.1       grant    3222:             <div class="titlepage">
                   3223:               <div>
                   3224:                 <div>
1.30      wiz      3225:                   <h3 class="title"><a name=
1.70      rillig   3226:                   "finding-binary-packages"></a>4.1.1.&nbsp;Finding
                   3227:                   binary packages</h3>
1.1       grant    3228:                 </div>
                   3229:               </div>
                   3230:             </div>
                   3231: 
1.70      rillig   3232:             <p>To install binary packages, you first need to know
                   3233:             from where to get them. You can get them on CD-ROMs,
                   3234:             DVDs, or via FTP or HTTP.</p>
                   3235: 
                   3236:             <p>For NetBSD, the binary packages are made available
                   3237:             on <code xmlns=
                   3238:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3239:             "filename">ftp.NetBSD.org</code> and its mirrors, in
                   3240:             the directory <code xmlns=
1.45      wiz      3241:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.70      rillig   3242:             "filename">/pub/NetBSD/packages/<em class=
                   3243:             "replaceable"><code>OSVERSION</code></em>/<em class=
                   3244:             "replaceable"><code>ARCH</code></em>/</code>. For
                   3245:             <em class="replaceable"><code>OSVERSION</code></em>,
                   3246:             you should insert the output of <span><strong class=
                   3247:             "command">uname -r</strong></span>, and for <em class=
                   3248:             "replaceable"><code>ARCH</code></em> the output of
                   3249:             <span><strong class="command">uname
                   3250:             -p</strong></span>.</p>
                   3251: 
                   3252:             <p>For some other platforms, binary packages can be
                   3253:             found at the following locations:</p>
                   3254: 
                   3255:             <div class="informaltable">
                   3256:               <a name="binary-packages"></a>
                   3257: 
                   3258:               <table border="1">
                   3259:                 <colgroup>
                   3260:                   <col />
                   3261:                   <col />
                   3262:                 </colgroup>
                   3263: 
                   3264:                 <thead>
                   3265:                   <tr>
                   3266:                     <th>Platform</th>
                   3267: 
                   3268:                     <th>URL</th>
                   3269:                   </tr>
                   3270:                 </thead>
                   3271: 
                   3272:                 <tbody>
                   3273:                   <tr>
                   3274:                     <td>Solaris 5.10</td>
                   3275: 
                   3276:                     <td><code xmlns=
                   3277:                     "http://www.w3.org/TR/xhtml1/transitional"
                   3278:                     class=
                   3279:                     "filename">http://public.enst.fr/pkgsrc/packages/</code></td>
                   3280:                   </tr>
                   3281:                 </tbody>
                   3282:               </table>
                   3283:             </div>
                   3284: 
                   3285:             <p>In each of these directories, there is a
1.45      wiz      3286:             subdirectory <code xmlns=
                   3287:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.70      rillig   3288:             "filename">All</code> that contains all the binary
                   3289:             packages. Further, there are subdirectories for
                   3290:             categories that contain symbolic links that point to
                   3291:             the actual binary package in <code xmlns=
1.45      wiz      3292:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.70      rillig   3293:             "filename">../All</code>. This directory layout is used
                   3294:             for all package repositories, no matter if they are
                   3295:             accessed via HTTP, FTP, NFS, CD-ROM, or the local
                   3296:             filesystem.</p>
1.1       grant    3297:           </div>
                   3298: 
1.67      hubertf  3299:           <div class="sect2" lang="en">
1.1       grant    3300:             <div class="titlepage">
                   3301:               <div>
                   3302:                 <div>
1.30      wiz      3303:                   <h3 class="title"><a name=
1.70      rillig   3304:                   "installing-binary-packages"></a>4.1.2.&nbsp;Installing
                   3305:                   binary packages</h3>
1.1       grant    3306:                 </div>
                   3307:               </div>
                   3308:             </div>
                   3309: 
1.47      reed     3310:             <p>If you have the files on a CD-ROM or downloaded them
1.23      wiz      3311:             to your hard disk, you can install them with the
1.27      rillig   3312:             following command (be sure to <span><strong class=
1.14      xtraeme  3313:             "command">su</strong></span> to root first):</p>
1.1       grant    3314:             <pre class="screen">
1.14      xtraeme  3315: <code class="prompt">#</code> <strong class=
                   3316: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    3317: </pre>
                   3318: 
                   3319:             <p>If you have FTP access and you don't want to
                   3320:             download the packages via FTP prior to installation,
1.14      xtraeme  3321:             you can do this automatically by giving
                   3322:             <span><strong class="command">pkg_add</strong></span>
                   3323:             an FTP URL:</p>
1.1       grant    3324:             <pre class="screen">
1.14      xtraeme  3325: <code class="prompt">#</code> <strong class=
1.27      rillig   3326: "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    3327: </pre>
                   3328: 
1.27      rillig   3329:             <p>Note that any prerequisite packages needed to run
                   3330:             the package in question will be installed, too,
1.1       grant    3331:             assuming they are present where you install from.</p>
                   3332: 
1.23      wiz      3333:             <p>To save some typing, you can set the <code class=
                   3334:             "varname">PKG_PATH</code> environment variable to a
1.47      reed     3335:             semicolon-separated list of paths (including remote
1.23      wiz      3336:             URLs); trailing slashes are not allowed.</p>
                   3337: 
1.45      wiz      3338:             <p>Additionally to the <code xmlns=
                   3339:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      3340:             "filename">All</code> directory there exists a
1.45      wiz      3341:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3342:             class="filename">vulnerable</code> directory to which
                   3343:             binary packages with known vulnerabilities are moved,
                   3344:             since removing them could cause missing dependencies.
                   3345:             To use these packages, add the <code xmlns=
                   3346:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3347:             "filename">vulnerable</code> directory to your
                   3348:             <code class="varname">PKG_PATH</code>. However, you
                   3349:             should run <a xmlns=
1.23      wiz      3350:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   3351:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      3352:             target="_top"><code xmlns="" class=
                   3353:             "filename">security/audit-packages</code></a>
1.47      reed     3354:             regularly, especially after installing new packages,
                   3355:             and verify that the vulnerabilities are acceptable for
                   3356:             your configuration. An example <code class=
                   3357:             "varname">PKG_PATH</code> would be: <code xmlns=
                   3358:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   3359:             "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      3360:             Please note that semicolon (';') is a shell
                   3361:             meta-character, so you'll probably have to quote
                   3362:             it.</p>
                   3363: 
1.1       grant    3364:             <p>After you've installed packages, be sure to have
1.45      wiz      3365:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3366:             class="filename">/usr/pkg/bin</code> and <code xmlns=
                   3367:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3368:             "filename">/usr/pkg/sbin</code> in your <code class=
                   3369:             "varname">PATH</code> so you can actually start the
                   3370:             just installed program.</p>
1.1       grant    3371:           </div>
                   3372: 
1.67      hubertf  3373:           <div class="sect2" lang="en">
1.1       grant    3374:             <div class="titlepage">
                   3375:               <div>
                   3376:                 <div>
1.67      hubertf  3377:                   <h3 class="title"><a name=
1.30      wiz      3378:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    3379:                   warning</h3>
                   3380:                 </div>
                   3381:               </div>
                   3382:             </div>
                   3383: 
                   3384:             <p>Please pay very careful attention to the warnings
                   3385:             expressed in the <a href=
                   3386:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3387:             <span class="citerefentry"><span class=
                   3388:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   3389:             page about the inherent dangers of installing binary
                   3390:             packages which you did not create yourself, and the
                   3391:             security holes that can be introduced onto your system
                   3392:             by indiscriminate adding of such files.</p>
1.66      rillig   3393: 
                   3394:             <p>The same warning of course applies to every package
                   3395:             you install from source when you haven't completely
                   3396:             read and understood the source code of the package, the
                   3397:             compiler that is used to build the package and all the
                   3398:             other tools that are involved.</p>
1.1       grant    3399:           </div>
                   3400:         </div>
                   3401: 
1.67      hubertf  3402:         <div class="sect1" lang="en">
1.1       grant    3403:           <div class="titlepage">
                   3404:             <div>
                   3405:               <div>
                   3406:                 <h2 class="title" style="clear: both"><a name=
1.30      wiz      3407:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    3408:                 packages from source</h2>
                   3409:               </div>
                   3410:             </div>
                   3411:           </div>
                   3412: 
                   3413:           <p>This assumes that the package is already in pkgsrc. If
                   3414:           it is not, see <a href="#developers-guide" title=
1.46      gdt      3415:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   3416:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   3417:           instructions how to create your own packages.</p>
1.1       grant    3418: 
1.67      hubertf  3419:           <div class="sect2" lang="en">
1.1       grant    3420:             <div class="titlepage">
                   3421:               <div>
                   3422:                 <div>
1.67      hubertf  3423:                   <h3 class="title"><a name=
1.30      wiz      3424:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    3425:                 </div>
                   3426:               </div>
                   3427:             </div>
                   3428: 
                   3429:             <p>To build packages from source on a NetBSD system the
                   3430:             &#8220;<span class="quote">comp</span>&#8221; and the
                   3431:             &#8220;<span class="quote">text</span>&#8221;
                   3432:             distribution sets must be installed. If you want to
1.47      reed     3433:             build X11-related packages the &#8220;<span class=
1.1       grant    3434:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   3435:             "quote">xcomp</span>&#8221; distribution sets are
                   3436:             required, too.</p>
                   3437:           </div>
                   3438: 
1.67      hubertf  3439:           <div class="sect2" lang="en">
1.1       grant    3440:             <div class="titlepage">
                   3441:               <div>
                   3442:                 <div>
1.67      hubertf  3443:                   <h3 class="title"><a name=
                   3444:                   "fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    3445:                   distfiles</h3>
                   3446:                 </div>
                   3447:               </div>
                   3448:             </div>
                   3449: 
1.27      rillig   3450:             <p>The first step for building a package is downloading
                   3451:             the distfiles (i.e. the unmodified source). If they
                   3452:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    3453:             automatically.</p>
                   3454: 
                   3455:             <p>You can overwrite some of the major distribution
                   3456:             sites to fit to sites that are close to your own. Have
1.45      wiz      3457:             a look at <code xmlns=
                   3458:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3459:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   3460:             some examples &#8212; in particular, look for the
1.14      xtraeme  3461:             <code class="varname">MASTER_SORT</code>, <code class=
                   3462:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   3463:             "varname">INET_COUNTRY</code> definitions. This may
                   3464:             save some of your bandwidth and time.</p>
1.1       grant    3465: 
                   3466:             <p>You can change these settings either in your shell's
                   3467:             environment, or, if you want to keep the settings, by
1.45      wiz      3468:             editing the <code xmlns=
                   3469:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3470:             "filename">/etc/mk.conf</code> file, and adding the
                   3471:             definitions there.</p>
1.1       grant    3472: 
                   3473:             <p>If you don't have a permanent Internet connection
                   3474:             and you want to know which files to download,
1.14      xtraeme  3475:             <span><strong class="command">make
                   3476:             fetch-list</strong></span> will tell you what you'll
1.45      wiz      3477:             need. Put these distfiles into <code xmlns=
                   3478:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3479:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    3480:           </div>
                   3481: 
1.67      hubertf  3482:           <div class="sect2" lang="en">
1.1       grant    3483:             <div class="titlepage">
                   3484:               <div>
                   3485:                 <div>
1.30      wiz      3486:                   <h3 class="title"><a name=
                   3487:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
                   3488:                   build and install</h3>
1.1       grant    3489:                 </div>
                   3490:               </div>
                   3491:             </div>
                   3492: 
                   3493:             <p>Assuming that the distfile has been fetched (see
                   3494:             previous section), become root and change into the
1.47      reed     3495:             relevant directory and run <span><strong class=
                   3496:             "command">make</strong></span>.</p>
                   3497: 
                   3498:             <div class="note" style=
                   3499:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3500:               <h3 class="title">Note</h3>
                   3501: 
                   3502:               <p>If using bootstrap or pkgsrc on a non-NetBSD
                   3503:               system, use the pkgsrc <span><strong class=
                   3504:               "command">bmake</strong></span> command instead of
                   3505:               &#8220;<span class="quote">make</span>&#8221; in the
                   3506:               examples in this guide.</p>
                   3507:             </div>
                   3508: 
                   3509:             <p>For example, type</p>
1.1       grant    3510:             <pre class="screen">
1.14      xtraeme  3511: <code class="prompt">%</code> <strong class=
                   3512: "userinput"><code>cd misc/figlet</code></strong>
                   3513: <code class="prompt">%</code> <strong class=
                   3514: "userinput"><code>make</code></strong>
1.1       grant    3515: </pre>
                   3516: 
                   3517:             <p>at the shell prompt to build the various components
                   3518:             of the package, and</p>
                   3519:             <pre class="screen">
1.14      xtraeme  3520: <code class="prompt">#</code> <strong class=
                   3521: "userinput"><code>make install</code></strong>
1.1       grant    3522: </pre>
                   3523: 
                   3524:             <p>to install the various components into the correct
                   3525:             places on your system. Installing the package on your
                   3526:             system requires you to be root. However, pkgsrc has a
                   3527:             <span class="emphasis"><em>just-in-time-su</em></span>
                   3528:             feature, which allows you to only become root for the
                   3529:             actual installation step</p>
                   3530: 
                   3531:             <p>Taking the figlet utility as an example, we can
                   3532:             install it on our system by building as shown in
                   3533:             <a href="#logs" title=
1.67      hubertf  3534:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix&nbsp;B,
                   3535:             <i>Build logs</i></a>.</p>
1.1       grant    3536: 
                   3537:             <p>The program is installed under the default root of
1.45      wiz      3538:             the packages tree - <code xmlns=
                   3539:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3540:             "filename">/usr/pkg</code>. Should this not conform to
                   3541:             your tastes, set the <code class=
                   3542:             "varname">LOCALBASE</code> variable in your
1.1       grant    3543:             environment, and it will use that value as the root of
1.45      wiz      3544:             your packages tree. So, to use <code xmlns=
                   3545:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3546:             "filename">/usr/local</code>, set <code class=
                   3547:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    3548:             environment. Please note that you should use a
                   3549:             directory which is dedicated to packages and not shared
1.47      reed     3550:             with other programs (i.e., do not try and use
1.14      xtraeme  3551:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   3552:             should not try to add any of your own files or
1.45      wiz      3553:             directories (such as <code xmlns=
                   3554:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3555:             "filename">src/</code>, <code xmlns=
                   3556:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   3557:             "filename">obj/</code>, or <code xmlns=
                   3558:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3559:             "filename">pkgsrc/</code>) below the <code class=
                   3560:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    3561:             possible conflicts between programs and other files
                   3562:             installed by the package system and whatever else may
                   3563:             have been installed there.</p>
                   3564: 
1.45      wiz      3565:             <p>Some packages look in <code xmlns=
                   3566:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3567:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    3568:             configuration options at build time. Have a look at
1.45      wiz      3569:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3570:             class="filename">pkgsrc/mk/defaults/mk.conf</code> to
                   3571:             get an overview of what will be set there by default.
1.14      xtraeme  3572:             Environment variables such as <code class=
1.45      wiz      3573:             "varname">LOCALBASE</code> can be set in <code xmlns=
                   3574:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3575:             "filename">/etc/mk.conf</code> to save having to
                   3576:             remember to set them each time you want to use
                   3577:             pkgsrc.</p>
1.1       grant    3578: 
                   3579:             <p>Occasionally, people want to &#8220;<span class=
                   3580:             "quote">look under the covers</span>&#8221; to see what
                   3581:             is going on when a package is building or being
                   3582:             installed. This may be for debugging purposes, or out
                   3583:             of simple curiosity. A number of utility values have
                   3584:             been added to help with this.</p>
                   3585: 
                   3586:             <div class="orderedlist">
                   3587:               <ol type="1">
                   3588:                 <li>
                   3589:                   <p>If you invoke the <a href=
                   3590:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3591:                   <span class="citerefentry"><span class=
                   3592:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  3593:                   with <code class=
                   3594:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   3595:                   amount of information will be displayed. For
                   3596:                   example,</p>
1.1       grant    3597:                   <pre class="screen">
1.14      xtraeme  3598: <strong class=
                   3599: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    3600: </pre>
                   3601: 
                   3602:                   <p>will show all the commands that are invoked,
                   3603:                   up to and including the &#8220;<span class=
                   3604:                   "quote">patch</span>&#8221; stage.</p>
                   3605:                 </li>
                   3606: 
                   3607:                 <li>
                   3608:                   <p>If you want to know the value of a certain
1.22      tv       3609:                   <a href=
                   3610:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3611:                   <span class="citerefentry"><span class=
                   3612:                   "refentrytitle">make</span>(1)</span></a>
                   3613:                   definition, then the <code class=
1.14      xtraeme  3614:                   "varname">VARNAME</code> definition should be
                   3615:                   used, in conjunction with the show-var target.
                   3616:                   e.g. to show the expansion of the <a href=
1.1       grant    3617:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   3618:                   <span class="citerefentry"><span class=
                   3619:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  3620:                   variable <code class=
1.22      tv       3621:                   "varname">LOCALBASE</code>:</p>
1.1       grant    3622:                   <pre class="screen">
1.14      xtraeme  3623: <code class="prompt">%</code> <strong class=
                   3624: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    3625: /usr/pkg
1.14      xtraeme  3626: <code class="prompt">%</code>
1.1       grant    3627:           
                   3628: </pre>
                   3629:                 </li>
                   3630:               </ol>
                   3631:             </div>
                   3632: 
                   3633:             <p>If you want to install a binary package that you've
                   3634:             either created yourself (see next section), that you
                   3635:             put into pkgsrc/packages manually or that is located on
1.8       wiz      3636:             a remote FTP server, you can use the "bin-install"
1.1       grant    3637:             target. This target will install a binary package - if
                   3638:             available - via <a href=
                   3639:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3640:             <span class="citerefentry"><span class=
                   3641:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  3642:             <span><strong class="command">make
                   3643:             package</strong></span>. The list of remote FTP sites
                   3644:             searched is kept in the variable <code class=
                   3645:             "varname">BINPKG_SITES</code>, which defaults to
                   3646:             ftp.NetBSD.org. Any flags that should be added to
                   3647:             <a href=
1.1       grant    3648:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3649:             <span class="citerefentry"><span class=
                   3650:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  3651:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
1.45      wiz      3652:             See <code xmlns=
                   3653:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  3654:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   3655:             details.</p>
1.1       grant    3656: 
1.47      reed     3657:             <p>A final word of warning: If you set up a system that
1.14      xtraeme  3658:             has a non-standard setting for <code class=
                   3659:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    3660:             any packages are installed, as you can not use several
                   3661:             directories for the same purpose. Doing so will result
                   3662:             in pkgsrc not being able to properly detect your
                   3663:             installed packages, and fail miserably. Note also that
                   3664:             precompiled binary packages are usually built with the
1.14      xtraeme  3665:             default <code class="varname">LOCALBASE</code> of
1.45      wiz      3666:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3667:             class="filename">/usr/pkg</code>, and that you should
                   3668:             <span class="emphasis"><em>not</em></span> install any
                   3669:             if you use a non-standard <code class=
1.14      xtraeme  3670:             "varname">LOCALBASE</code>.</p>
1.1       grant    3671:           </div>
                   3672: 
1.67      hubertf  3673:           <div class="sect2" lang="en">
1.1       grant    3674:             <div class="titlepage">
                   3675:               <div>
                   3676:                 <div>
1.30      wiz      3677:                   <h3 class="title"><a name=
                   3678:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
                   3679:                   the compiler</h3>
1.1       grant    3680:                 </div>
                   3681:               </div>
                   3682:             </div>
                   3683: 
                   3684:             <p>By default, pkgsrc will use GCC to build packages.
                   3685:             This may be overridden by setting the following
                   3686:             variables in /etc/mk.conf:</p>
                   3687: 
                   3688:             <div class="variablelist">
                   3689:               <dl>
1.14      xtraeme  3690:                 <dt><span class="term"><code class=
                   3691:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    3692: 
                   3693:                 <dd>
                   3694:                   <p>This is a list of values specifying the chain
                   3695:                   of compilers to invoke when building packages.
                   3696:                   Valid values are:</p>
                   3697: 
                   3698:                   <div class="itemizedlist">
                   3699:                     <ul type="disc">
                   3700:                       <li>
1.14      xtraeme  3701:                         <p><code class="varname">distcc</code>:
1.1       grant    3702:                         distributed C/C++ (chainable)</p>
                   3703:                       </li>
                   3704: 
                   3705:                       <li>
1.14      xtraeme  3706:                         <p><code class="varname">ccache</code>:
1.1       grant    3707:                         compiler cache (chainable)</p>
                   3708:                       </li>
                   3709: 
                   3710:                       <li>
1.14      xtraeme  3711:                         <p><code class="varname">gcc</code>: GNU
                   3712:                         C/C++ Compiler</p>
1.1       grant    3713:                       </li>
                   3714: 
                   3715:                       <li>
1.14      xtraeme  3716:                         <p><code class="varname">mipspro</code>:
1.1       grant    3717:                         Silicon Graphics, Inc. MIPSpro
                   3718:                         (n32/n64)</p>
                   3719:                       </li>
                   3720: 
                   3721:                       <li>
1.14      xtraeme  3722:                         <p><code class="varname">mipspro</code>:
1.1       grant    3723:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   3724:                       </li>
                   3725: 
                   3726:                       <li>
1.64      kim      3727:                         <p><code class="varname">sunpro</code>: Sun
1.1       grant    3728:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   3729:                         Studio</p>
                   3730:                       </li>
                   3731:                     </ul>
                   3732:                   </div>
                   3733: 
                   3734:                   <p>The default is &#8220;<span class=
1.14      xtraeme  3735:                   "quote"><code class=
                   3736:                   "varname">gcc</code></span>&#8221;. You can use
                   3737:                   <code class="varname">ccache</code> and/or
                   3738:                   <code class="varname">distcc</code> with an
                   3739:                   appropriate <code class=
                   3740:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   3741:                   &#8220;<span class="quote"><code class=
                   3742:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    3743:                   variable should always be terminated with a value
                   3744:                   for a real compiler.</p>
                   3745:                 </dd>
                   3746: 
1.14      xtraeme  3747:                 <dt><span class="term"><code class=
                   3748:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    3749: 
                   3750:                 <dd>
                   3751:                   <p>This specifies the minimum version of GCC to
                   3752:                   use when building packages. If the system GCC
                   3753:                   doesn't satisfy this requirement, then pkgsrc
                   3754:                   will build and install one of the GCC packages to
                   3755:                   use instead.</p>
                   3756:                 </dd>
                   3757:               </dl>
                   3758:             </div>
                   3759:           </div>
                   3760:         </div>
                   3761:       </div>
                   3762: 
1.67      hubertf  3763:       <div class="chapter" lang="en">
1.1       grant    3764:         <div class="titlepage">
                   3765:           <div>
                   3766:             <div>
1.67      hubertf  3767:               <h2 class="title"><a name=
1.38      dillo    3768:               "configuring"></a>Chapter&nbsp;5.&nbsp;Configuring
                   3769:               pkgsrc</h2>
                   3770:             </div>
                   3771:           </div>
                   3772:         </div>
                   3773: 
                   3774:         <div class="toc">
                   3775:           <p><b>Table of Contents</b></p>
                   3776: 
                   3777:           <dl>
                   3778:             <dt><span class="sect1"><a href=
1.45      wiz      3779:             "#general-configuration">5.1. General
                   3780:             configuration</a></span></dt>
                   3781: 
                   3782:             <dt><span class="sect1"><a href=
                   3783:             "#variables-affecting-build">5.2. Variables affecting
                   3784:             the build process</a></span></dt>
                   3785: 
                   3786:             <dt><span class="sect1"><a href=
                   3787:             "#developer-advanced-settings">5.3. Developer/advanced
                   3788:             settings</a></span></dt>
                   3789: 
                   3790:             <dt><span class="sect1"><a href=
                   3791:             "#selecting-build-options">5.4. Selecting Build
1.42      dillo    3792:             Options</a></span></dt>
1.38      dillo    3793:           </dl>
                   3794:         </div>
                   3795: 
1.67      hubertf  3796:         <div class="sect1" lang="en">
1.38      dillo    3797:           <div class="titlepage">
                   3798:             <div>
                   3799:               <div>
                   3800:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      3801:                 "general-configuration"></a>5.1.&nbsp;General
                   3802:                 configuration</h2>
                   3803:               </div>
                   3804:             </div>
                   3805:           </div>
                   3806: 
1.47      reed     3807:           <p>In this section, you can find some variables that
                   3808:           apply to all pkgsrc packages. The preferred method of
                   3809:           setting these variables is by setting them in
                   3810:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   3811:           class="filename">/etc/mk.conf</code>.</p>
1.45      wiz      3812: 
                   3813:           <div class="itemizedlist">
                   3814:             <ul type="disc">
                   3815:               <li>
                   3816:                 <p><code class="varname">LOCALBASE</code>: Where
                   3817:                 packages will be installed. The default is
                   3818:                 <code xmlns=
                   3819:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3820:                 "filename">/usr/pkg</code>. Do not mix binary
                   3821:                 packages with different <code class=
                   3822:                 "varname">LOCALBASE</code>s!</p>
                   3823:               </li>
                   3824: 
                   3825:               <li>
                   3826:                 <p><code class="varname">CROSSBASE</code>: Where
                   3827:                 &#8220;<span class="quote">cross</span>&#8221;
                   3828:                 category packages will be installed. The default is
                   3829:                 <code xmlns=
                   3830:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3831:                 "filename">${LOCALBASE}/cross</code>.</p>
                   3832:               </li>
                   3833: 
                   3834:               <li>
                   3835:                 <p><code class="varname">X11BASE</code>: Where X11
                   3836:                 is installed on the system. The default is
                   3837:                 <code xmlns=
                   3838:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3839:                 "filename">/usr/X11R6</code>.</p>
                   3840:               </li>
                   3841: 
                   3842:               <li>
                   3843:                 <p><code class="varname">DISTDIR</code>: Where to
                   3844:                 store the downloaded copies of the original source
                   3845:                 distributions used for building pkgsrc packages.
                   3846:                 The default is <code xmlns=
                   3847:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3848:                 "filename">${PKGSRCDIR}/distfiles</code>.</p>
                   3849:               </li>
                   3850: 
                   3851:               <li>
                   3852:                 <p><code class=
                   3853:                 "varname">MASTER_SITE_OVERRIDE</code>: If set,
                   3854:                 override the packages' <code class=
                   3855:                 "varname">MASTER_SITES</code> with this value.</p>
                   3856:               </li>
                   3857: 
                   3858:               <li>
                   3859:                 <p><code class="varname">MASTER_SITE_BACKUP</code>:
                   3860:                 Backup location(s) for distribution files and patch
                   3861:                 files if not found locally or in <code xmlns=
                   3862:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3863:                 "filename">${MASTER_SITES}</code> or <code xmlns=
                   3864:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3865:                 "filename">${PATCH_SITES}</code> respectively. The
                   3866:                 defaults are <code xmlns=
                   3867:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3868:                 "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/</code>
                   3869:                 and <code xmlns=
                   3870:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3871:                 "filename">ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/</code>.</p>
                   3872:               </li>
                   3873: 
                   3874:               <li>
                   3875:                 <p><code class="varname">BINPKG_SITES</code>: List
                   3876:                 of sites carrying binary pkgs.</p>
                   3877:               </li>
                   3878:             </ul>
                   3879:           </div>
                   3880:         </div>
                   3881: 
1.67      hubertf  3882:         <div class="sect1" lang="en">
1.45      wiz      3883:           <div class="titlepage">
                   3884:             <div>
                   3885:               <div>
                   3886:                 <h2 class="title" style="clear: both"><a name=
                   3887:                 "variables-affecting-build"></a>5.2.&nbsp;Variables
                   3888:                 affecting the build process</h2>
                   3889:               </div>
                   3890:             </div>
                   3891:           </div>
                   3892: 
                   3893:           <p>XXX</p>
                   3894: 
                   3895:           <div class="itemizedlist">
                   3896:             <ul type="disc">
                   3897:               <li>
                   3898:                 <p><code class="varname">PACKAGES</code>: The top
                   3899:                 level directory for the binary packages. The
                   3900:                 default is <code xmlns=
                   3901:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3902:                 "filename">${PKGSRCDIR}/packages</code>.</p>
                   3903:               </li>
                   3904: 
                   3905:               <li>
                   3906:                 <p><code class="varname">WRKOBJDIR</code>: The top
                   3907:                 level directory where, if defined, the separate
                   3908:                 working directories will get created, and
                   3909:                 symbolically linked to from <code xmlns=
                   3910:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3911:                 "filename">${WRKDIR}</code> (see below). This is
                   3912:                 useful for building packages on several
                   3913:                 architectures, then <code xmlns=
                   3914:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3915:                 "filename">${PKGSRCDIR}</code> can be NFS-mounted
                   3916:                 while <code xmlns=
                   3917:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3918:                 "filename">${WRKOBJDIR}</code> is local to every
                   3919:                 architecture. (It should be noted that <code class=
                   3920:                 "varname">PKGSRCDIR</code> should not be set by the
                   3921:                 user &#8212; it is an internal definition which
                   3922:                 refers to the root of the pkgsrc tree. It is
                   3923:                 possible to have many pkgsrc tree instances.)</p>
                   3924:               </li>
                   3925: 
                   3926:               <li>
                   3927:                 <p><code class="varname">LOCALPATCHES</code>:
                   3928:                 Directory for local patches that aren't part of
                   3929:                 pkgsrc. See <a href="#components.patches" title=
                   3930:                 "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   3931:                 &#8220;patches/*&#8221;</a> for more information.
                   3932:                 <em class="replaceable"><code>rel</code></em> and
                   3933:                 <em class="replaceable"><code>arch</code></em> are
                   3934:                 replaced with OS release (&#8220;<span class=
                   3935:                 "quote">2.0</span>&#8221;, etc.) and architecture
                   3936:                 (&#8220;<span class="quote">mipsel</span>&#8221;,
                   3937:                 etc.).</p>
                   3938:               </li>
                   3939: 
                   3940:               <li>
                   3941:                 <p><code class="varname">PKGMAKECONF</code>:
                   3942:                 Location of the <code xmlns=
                   3943:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3944:                 "filename">mk.conf</code> file used by a package's
                   3945:                 BSD-style Makefile. If this is not set,
                   3946:                 <code class="varname">MAKECONF</code> is set to
                   3947:                 <code xmlns=
                   3948:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3949:                 "filename">/dev/null</code> to avoid picking up
                   3950:                 settings used by builds in <code xmlns=
                   3951:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   3952:                 "filename">/usr/src</code>.</p>
                   3953:               </li>
                   3954:             </ul>
                   3955:           </div>
                   3956:         </div>
                   3957: 
1.67      hubertf  3958:         <div class="sect1" lang="en">
1.45      wiz      3959:           <div class="titlepage">
                   3960:             <div>
                   3961:               <div>
                   3962:                 <h2 class="title" style="clear: both"><a name=
                   3963:                 "developer-advanced-settings"></a>5.3.&nbsp;Developer/advanced
                   3964:                 settings</h2>
                   3965:               </div>
                   3966:             </div>
                   3967:           </div>
                   3968: 
                   3969:           <p>XXX</p>
                   3970: 
                   3971:           <div class="itemizedlist">
                   3972:             <ul type="disc">
                   3973:               <li>
                   3974:                 <p><code class="varname">PKG_DEVELOPER</code>: Run
                   3975:                 some sanity checks that package developers
                   3976:                 want:</p>
                   3977: 
                   3978:                 <div class="itemizedlist">
                   3979:                   <ul type="circle">
                   3980:                     <li>
                   3981:                       <p>make sure patches apply with zero fuzz</p>
                   3982:                     </li>
                   3983: 
                   3984:                     <li>
                   3985:                       <p>run check-shlibs to see that all binaries
                   3986:                       will find their shared libs.</p>
                   3987:                     </li>
                   3988:                   </ul>
                   3989:                 </div>
                   3990:               </li>
                   3991: 
                   3992:               <li>
                   3993:                 <p><code class="varname">PKG_DEBUG_LEVEL</code>:
                   3994:                 The level of debugging output which is displayed
                   3995:                 whilst making and installing the package. The
                   3996:                 default value for this is 0, which will not display
                   3997:                 the commands as they are executed (normal, default,
                   3998:                 quiet operation); the value 1 will display all
                   3999:                 shell commands before their invocation, and the
                   4000:                 value 2 will display both the shell commands before
                   4001:                 their invocation, and their actual execution
                   4002:                 progress with <span><strong class="command">set
                   4003:                 -x</strong></span> will be displayed.</p>
                   4004:               </li>
1.58      erh      4005: 
                   4006:               <li>
                   4007:                 <p><code class=
                   4008:                 "varname">ALLOW_VULNERABILITIES.<em class=
                   4009:                 "replaceable"><code>pkgbase</code></em></code>: A
                   4010:                 space separated list of vulnerability IDs that may
                   4011:                 be ignored when performing the automated security
                   4012:                 checks. These IDs are listed in the
                   4013:                 pkg-vulnerabilities file and are displayed by
                   4014:                 <span><strong class=
                   4015:                 "command">audit-packages</strong></span> when it
                   4016:                 finds a vulnerable package.</p>
                   4017:               </li>
                   4018: 
                   4019:               <li>
                   4020:                 <p><code class=
                   4021:                 "varname">SKIP_AUDIT_PACKAGES</code>: If this is
                   4022:                 set to &#8220;<span class=
                   4023:                 "quote">yes</span>&#8221;, the automated security
                   4024:                 checks (which use the <a xmlns=
                   4025:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4026:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   4027:                 target="_top"><code xmlns="" class=
                   4028:                 "filename">security/audit-packages</code></a>
                   4029:                 package) will be <span class=
                   4030:                 "strong"><strong>entirely</strong></span> skipped
                   4031:                 for <span class=
                   4032:                 "strong"><strong>all</strong></span> packages
                   4033:                 built. Normally you'll want to use
                   4034:                 ALLOW_VULNERABILITIES instead of this.</p>
                   4035:               </li>
1.45      wiz      4036:             </ul>
                   4037:           </div>
                   4038:         </div>
                   4039: 
1.67      hubertf  4040:         <div class="sect1" lang="en">
1.45      wiz      4041:           <div class="titlepage">
                   4042:             <div>
                   4043:               <div>
                   4044:                 <h2 class="title" style="clear: both"><a name=
                   4045:                 "selecting-build-options"></a>5.4.&nbsp;Selecting
                   4046:                 Build Options</h2>
1.38      dillo    4047:               </div>
                   4048:             </div>
                   4049:           </div>
                   4050: 
                   4051:           <p>Some packages have build time options, usually to
                   4052:           select between different dependencies, enable optional
                   4053:           support for big dependencies or enable experimental
                   4054:           features.</p>
                   4055: 
                   4056:           <p>To see which options, if any, a package supports, and
                   4057:           which options are mutually exclusive, run
                   4058:           <span><strong class="command">make
                   4059:           show-options</strong></span>, for example:</p>
                   4060:           <pre class="programlisting">
1.51      rillig   4061:     The following options are supported by this package:
1.70      rillig   4062:         ssl      Enable SSL support.
1.51      rillig   4063:     Exactly one of the following gecko options is required:
1.70      rillig   4064:         firefox  Use firefox as gecko rendering engine.
                   4065:         mozilla  Use mozilla as gecko rendering engine.
1.51      rillig   4066:     At most one of the following database options may be selected:
1.70      rillig   4067:         mysql    Enable support for MySQL database.
                   4068:         pgsql    Enable support for PostgreSQL database.
1.51      rillig   4069: 
                   4070:     These options are enabled by default: firefox
                   4071:     These options are currently enabled: mozilla ssl
1.38      dillo    4072: </pre>
                   4073: 
1.45      wiz      4074:           <p>The following variables can be defined in <code xmlns=
                   4075:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    4076:           "filename">/etc/mk.conf</code> to select which options to
                   4077:           enable for a package: <code class=
                   4078:           "varname">PKG_DEFAULT_OPTIONS</code>, which can be used
                   4079:           to select or disable options for all packages that
                   4080:           support them, and <code class=
                   4081:           "varname">PKG_OPTIONS.<em class=
                   4082:           "replaceable"><code>pkgbase</code></em></code>, which can
                   4083:           be used to select or disable options specifically for
                   4084:           package <em class=
                   4085:           "replaceable"><code>pkgbase</code></em>. Options listed
                   4086:           in these variables are selected, options preceded by
1.67      hubertf  4087:           &#8220;<span class="quote">-</span>&#8221; are disabled.
                   4088:           A few examples:</p>
                   4089:           <pre class="screen">
                   4090: <code class="prompt">$</code> <span><strong class=
                   4091: "command">grep "PKG.*OPTION" /etc/mk.conf</strong></span>
1.68      rillig   4092: PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound
1.67      hubertf  4093: PKG_OPTIONS.kdebase=    debug -sasl
                   4094: PKG_OPTIONS.apache=     suexec 
                   4095: </pre>
1.38      dillo    4096: 
1.39      dillo    4097:           <p>The following settings are consulted in the order
                   4098:           given, and the last setting that selects or disables an
                   4099:           option is used:</p>
1.38      dillo    4100: 
                   4101:           <div class="orderedlist">
                   4102:             <ol type="1">
                   4103:               <li>
                   4104:                 <p>the default options as suggested by the package
                   4105:                 maintainer</p>
                   4106:               </li>
                   4107: 
                   4108:               <li>
                   4109:                 <p>the options implied by the settings of legacy
                   4110:                 variables (see below)</p>
                   4111:               </li>
                   4112: 
                   4113:               <li>
                   4114:                 <p><code class=
                   4115:                 "varname">PKG_DEFAULT_OPTIONS</code></p>
                   4116:               </li>
                   4117: 
                   4118:               <li>
                   4119:                 <p><code class="varname">PKG_OPTIONS.<em class=
                   4120:                 "replaceable"><code>pkgbase</code></em></code></p>
                   4121:               </li>
                   4122:             </ol>
                   4123:           </div>
                   4124: 
                   4125:           <p>For groups of mutually exclusive options, the last
                   4126:           option selected is used, all others are automatically
                   4127:           disabled. If an option of the group is explicitly
                   4128:           disabled, the previously selected option, if any, is
                   4129:           used. It is an error if no option from a required group
                   4130:           of options is selected, and building the package will
                   4131:           fail.</p>
                   4132: 
                   4133:           <p>Before the options framework was introduced, build
1.65      hubertf  4134:           options were selected by setting a variable (often named
                   4135:           <code class="varname">USE_<em class=
                   4136:           "replaceable"><code>FOO</code></em></code>) in
1.45      wiz      4137:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4138:           class="filename">/etc/mk.conf</code> for each option. To
                   4139:           ease transition to the options framework for the user,
                   4140:           these legacy variables are converted to the appropriate
1.65      hubertf  4141:           options setting (<code class=
                   4142:           "varname">PKG_OPTIONS.<em class=
                   4143:           "replaceable"><code>pkgbase</code></em></code>)
                   4144:           automatically. A warning is issued to prompt the user to
                   4145:           update <code xmlns=
1.45      wiz      4146:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.38      dillo    4147:           "filename">/etc/mk.conf</code> to use the options
1.65      hubertf  4148:           framework directly. Support for the legacy variables will
                   4149:           be removed eventually.</p>
1.38      dillo    4150:         </div>
                   4151:       </div>
                   4152: 
1.67      hubertf  4153:       <div class="chapter" lang="en">
1.38      dillo    4154:         <div class="titlepage">
                   4155:           <div>
                   4156:             <div>
1.67      hubertf  4157:               <h2 class="title"><a name=
1.38      dillo    4158:               "binary"></a>Chapter&nbsp;6.&nbsp;Creating binary
1.1       grant    4159:               packages</h2>
                   4160:             </div>
                   4161:           </div>
                   4162:         </div>
                   4163: 
                   4164:         <div class="toc">
                   4165:           <p><b>Table of Contents</b></p>
                   4166: 
                   4167:           <dl>
1.30      wiz      4168:             <dt><span class="sect1"><a href=
1.38      dillo    4169:             "#building-a-single-binary-package">6.1. Building a
1.30      wiz      4170:             single binary package</a></span></dt>
1.1       grant    4171: 
1.30      wiz      4172:             <dt><span class="sect1"><a href=
1.38      dillo    4173:             "#settings-for-creationg-of-binary-packages">6.2.
1.1       grant    4174:             Settings for creation of binary
                   4175:             packages</a></span></dt>
                   4176: 
1.38      dillo    4177:             <dt><span class="sect1"><a href="#bulkbuild">6.3. Doing
1.1       grant    4178:             a bulk build of all packages</a></span></dt>
                   4179: 
                   4180:             <dd>
                   4181:               <dl>
                   4182:                 <dt><span class="sect2"><a href=
1.38      dillo    4183:                 "#binary.configuration">6.3.1.
1.1       grant    4184:                 Configuration</a></span></dt>
                   4185: 
1.30      wiz      4186:                 <dt><span class="sect2"><a href=
1.38      dillo    4187:                 "#other-environmental-considerations">6.3.2. Other
1.30      wiz      4188:                 environmental considerations</a></span></dt>
1.1       grant    4189: 
1.38      dillo    4190:                 <dt><span class="sect2"><a href="#operation">6.3.3.
1.1       grant    4191:                 Operation</a></span></dt>
                   4192: 
1.30      wiz      4193:                 <dt><span class="sect2"><a href=
1.38      dillo    4194:                 "#what-it-does">6.3.4. What it does</a></span></dt>
1.1       grant    4195: 
1.30      wiz      4196:                 <dt><span class="sect2"><a href=
1.38      dillo    4197:                 "#disk-space-requirements">6.3.5. Disk space
1.30      wiz      4198:                 requirements</a></span></dt>
1.1       grant    4199: 
1.30      wiz      4200:                 <dt><span class="sect2"><a href=
1.38      dillo    4201:                 "#setting-up-a-sandbox">6.3.6. Setting up a sandbox
1.47      reed     4202:                 for chrooted builds</a></span></dt>
1.1       grant    4203: 
1.30      wiz      4204:                 <dt><span class="sect2"><a href=
1.38      dillo    4205:                 "#building-a-partial-set">6.3.7. Building a partial
1.30      wiz      4206:                 set of packages</a></span></dt>
1.13      hubertf  4207: 
                   4208:                 <dt><span class="sect2"><a href=
1.38      dillo    4209:                 "#bulk-upload">6.3.8. Uploading results of a bulk
1.13      hubertf  4210:                 build</a></span></dt>
1.1       grant    4211:               </dl>
                   4212:             </dd>
                   4213: 
1.38      dillo    4214:             <dt><span class="sect1"><a href="#creating-cdroms">6.4.
1.1       grant    4215:             Creating a multiple CD-ROM packages
                   4216:             collection</a></span></dt>
                   4217: 
                   4218:             <dd>
                   4219:               <dl>
1.30      wiz      4220:                 <dt><span class="sect2"><a href=
1.38      dillo    4221:                 "#cdpack-example">6.4.1. Example of
1.30      wiz      4222:                 cdpack</a></span></dt>
1.1       grant    4223:               </dl>
                   4224:             </dd>
                   4225:           </dl>
                   4226:         </div>
                   4227: 
1.67      hubertf  4228:         <div class="sect1" lang="en">
1.1       grant    4229:           <div class="titlepage">
                   4230:             <div>
                   4231:               <div>
                   4232:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4233:                 "building-a-single-binary-package"></a>6.1.&nbsp;Building
1.30      wiz      4234:                 a single binary package</h2>
1.1       grant    4235:               </div>
                   4236:             </div>
                   4237:           </div>
                   4238: 
                   4239:           <p>Once you have built and installed a package, you can
                   4240:           create a <span class="emphasis"><em>binary
                   4241:           package</em></span> which can be installed on another
                   4242:           system with <a href=
                   4243:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4244:           <span class="citerefentry"><span class=
1.47      reed     4245:           "refentrytitle">pkg_add</span>(1)</span></a>. This saves
1.1       grant    4246:           having to build the same package on a group of hosts and
                   4247:           wasting CPU time. It also provides a simple means for
                   4248:           others to install your package, should you distribute
                   4249:           it.</p>
                   4250: 
                   4251:           <p>To create a binary package, change into the
1.14      xtraeme  4252:           appropriate directory in pkgsrc, and run
                   4253:           <span><strong class="command">make
                   4254:           package</strong></span>:</p>
1.1       grant    4255:           <pre class="screen">
1.14      xtraeme  4256: <code class="prompt">#</code> <strong class=
                   4257: "userinput"><code>cd misc/figlet</code></strong>
                   4258: <code class="prompt">#</code> <strong class=
                   4259: "userinput"><code>make package</code></strong>
1.1       grant    4260: </pre>
                   4261: 
                   4262:           <p>This will build and install your package (if not
                   4263:           already done), and then build a binary package from what
1.14      xtraeme  4264:           was installed. You can then use the <span><strong class=
                   4265:           "command">pkg_*</strong></span> tools to manipulate it.
1.45      wiz      4266:           Binary packages are created by default in <code xmlns=
                   4267:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4268:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    4269:           gzipped tar file. See <a href="#logs.package" title=
1.67      hubertf  4270:           "B.2.&nbsp;Packaging figlet">Section&nbsp;B.2,
1.1       grant    4271:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   4272:           the above <a xmlns=
                   4273:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4274:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.45      wiz      4275:           target="_top"><code xmlns="" class=
                   4276:           "filename">misc/figlet</code></a> example.</p>
1.1       grant    4277: 
                   4278:           <p>See <a href="#submit" title=
1.68      rillig   4279:           "Chapter&nbsp;18.&nbsp;Submitting and Committing">Chapter&nbsp;18,
1.67      hubertf  4280:           <i>Submitting and Committing</i></a> for information on
                   4281:           how to submit such a binary package.</p>
1.1       grant    4282:         </div>
                   4283: 
1.67      hubertf  4284:         <div class="sect1" lang="en">
1.1       grant    4285:           <div class="titlepage">
                   4286:             <div>
                   4287:               <div>
                   4288:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    4289:                 "settings-for-creationg-of-binary-packages"></a>6.2.&nbsp;Settings
1.1       grant    4290:                 for creation of binary packages</h2>
                   4291:               </div>
                   4292:             </div>
                   4293:           </div>
                   4294: 
                   4295:           <p>See <a href="#build.helpful-targets" title=
1.56      rillig   4296:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    4297:           &#8220;Other helpful targets&#8221;</a>.</p>
                   4298:         </div>
                   4299: 
1.67      hubertf  4300:         <div class="sect1" lang="en">
1.1       grant    4301:           <div class="titlepage">
                   4302:             <div>
                   4303:               <div>
                   4304:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  4305:                 "bulkbuild"></a>6.3.&nbsp;Doing a bulk build of all
                   4306:                 packages</h2>
1.1       grant    4307:               </div>
                   4308:             </div>
                   4309:           </div>
                   4310: 
                   4311:           <p>If you want to get a full set of precompiled binary
                   4312:           packages, this section describes how to get them. Beware
                   4313:           that the bulk build will remove all currently installed
1.63      dillo    4314:           packages from your system!</p>
                   4315: 
                   4316:           <p>Having an FTP server configured either on the machine
                   4317:           doing the bulk builds or on a nearby NFS server can help
                   4318:           to make the packages available to other machines that can
                   4319:           then save time by installing only the binary packages.
                   4320:           See <a href=
1.1       grant    4321:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   4322:           <span class="citerefentry"><span class=
                   4323:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   4324:           information. If you use a remote NFS server's storage, be
                   4325:           sure to not actually compile on NFS storage, as this
                   4326:           slows things down a lot.</p>
                   4327: 
1.67      hubertf  4328:           <div class="sect2" lang="en">
1.1       grant    4329:             <div class="titlepage">
                   4330:               <div>
                   4331:                 <div>
1.67      hubertf  4332:                   <h3 class="title"><a name=
1.38      dillo    4333:                   "binary.configuration"></a>6.3.1.&nbsp;Configuration</h3>
1.1       grant    4334:                 </div>
                   4335:               </div>
                   4336:             </div>
                   4337: 
1.67      hubertf  4338:             <div class="sect3" lang="en">
1.1       grant    4339:               <div class="titlepage">
                   4340:                 <div>
                   4341:                   <div>
1.63      dillo    4342:                     <h4 class="title"><a name=
                   4343:                     "binary.bulk.build.conf"></a>6.3.1.1.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4344:                     class="filename">build.conf</code></h4>
                   4345:                   </div>
                   4346:                 </div>
                   4347:               </div>
                   4348: 
                   4349:               <p>The <code xmlns=
                   4350:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4351:               "filename">build.conf</code> file is the main
                   4352:               configuration file for bulk builds. You can configure
                   4353:               how your copy of pkgsrc is kept up to date, how the
                   4354:               distfiles are downloaded, how the packages are built
                   4355:               and how the report is generated. You can find an
                   4356:               annotated example file in <code xmlns=
                   4357:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4358:               "filename">pkgsrc/mk/bulk/build.conf-example</code>.
                   4359:               To use it, copy <code xmlns=
                   4360:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4361:               "filename">build.conf-example</code> to <code xmlns=
                   4362:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4363:               "filename">build.conf</code> and edit it, following
                   4364:               the comments in that file.</p>
                   4365:             </div>
                   4366: 
1.67      hubertf  4367:             <div class="sect3" lang="en">
1.63      dillo    4368:               <div class="titlepage">
                   4369:                 <div>
                   4370:                   <div>
1.67      hubertf  4371:                     <h4 class="title"><a name=
1.63      dillo    4372:                     "binary.mk.conf"></a>6.3.1.2.&nbsp;/etc/mk.conf</h4>
1.1       grant    4373:                   </div>
                   4374:                 </div>
                   4375:               </div>
                   4376: 
1.45      wiz      4377:               <p>You may want to set variables in <code xmlns=
                   4378:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4379:               "filename">/etc/mk.conf</code>. Look at <code xmlns=
                   4380:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4381:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    4382:               details of the default settings. You will want to
1.14      xtraeme  4383:               ensure that <code class=
                   4384:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   4385:               policy. As used in this example, <code class=
                   4386:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    4387:               "emphasis"><em>all</em></span> licenses.</p>
                   4388:               <pre class="programlisting">
1.51      rillig   4389:     PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   4390:     WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   4391:     BSDSRCDIR=      /usr/src
                   4392:     BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   4393:     OBJHOSTNAME?=   yes               # use work.`hostname`
                   4394:     FAILOVER_FETCH= yes               # insist on the correct checksum
                   4395:     PKG_DEVELOPER?= yes
                   4396:     _ACCEPTABLE=    yes
1.1       grant    4397: </pre>
                   4398: 
1.63      dillo    4399:               <p>Some options that are especially useful for bulk
                   4400:               builds can be found at the top lines of the file
                   4401:               <code xmlns=
                   4402:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4403:               "filename">mk/bulk/bsd.bulk-pkg.mk</code>. The most
                   4404:               useful options of these are briefly described
                   4405:               here.</p>
                   4406: 
                   4407:               <div class="itemizedlist">
                   4408:                 <ul type="disc">
                   4409:                   <li>
                   4410:                     <p>If you are on a slow machine, you may want
                   4411:                     to set <code class=
                   4412:                     "varname">USE_BULK_BROKEN_CHECK</code> to
                   4413:                     &#8220;<span class=
                   4414:                     "quote">no</span>&#8221;.</p>
                   4415:                   </li>
                   4416: 
                   4417:                   <li>
                   4418:                     <p>If you are doing bulk builds from a
                   4419:                     read-only copy of pkgsrc, you have to set
                   4420:                     <code class="varname">BULKFILESDIR</code> to
                   4421:                     the directory where all log files are created.
                   4422:                     Otherwise the log files are created in the
                   4423:                     pkgsrc directory.</p>
                   4424:                   </li>
                   4425: 
                   4426:                   <li>
                   4427:                     <p>Another important variable is <code class=
                   4428:                     "varname">BULK_PREREQ</code>, which is a list
                   4429:                     of packages that should be always available
                   4430:                     while building other packages.</p>
                   4431:                   </li>
                   4432:                 </ul>
1.1       grant    4433:               </div>
1.68      rillig   4434: 
                   4435:               <p>Some other options are scattered in the pkgsrc
                   4436:               infrastructure:</p>
                   4437: 
                   4438:               <div class="itemizedlist">
                   4439:                 <ul type="disc">
                   4440:                   <li>
1.69      rillig   4441:                     <p><code class=
                   4442:                     "varname">ALLOW_VULNERABLE_PACKAGES</code>
                   4443:                     should be set to <code class=
                   4444:                     "literal">yes</code>. The purpose of the bulk
                   4445:                     builds is creating binary packages, no matter
                   4446:                     if they are vulnerable or not. When uploading
                   4447:                     the packages to a public server, the vulnerable
                   4448:                     packages will be put into a directory of their
                   4449:                     own. Leaving this variable unset would prevent
                   4450:                     the bulk build system from even trying to build
                   4451:                     them, so possible building errors would not
                   4452:                     show up.</p>
                   4453:                   </li>
                   4454: 
                   4455:                   <li>
1.68      rillig   4456:                     <p><code class="varname">CHECK_FILES</code>
                   4457:                     (<code xmlns=
                   4458:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4459:                     class=
                   4460:                     "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
                   4461:                     can be set to &#8220;<span class=
                   4462:                     "quote">yes</span>&#8221; to check that the
                   4463:                     installed set of files matches the <code xmlns=
                   4464:                     "http://www.w3.org/TR/xhtml1/transitional"
                   4465:                     class="filename">PLIST</code>.</p>
                   4466:                   </li>
                   4467: 
                   4468:                   <li>
                   4469:                     <p><code class=
                   4470:                     "varname">CHECK_INTERPRETER</code>
                   4471:                     (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4472:                     class=
                   4473:                     "filename">pkgsrc/mk/bsd.pkg.check.mk</code>)
                   4474:                     can be set to &#8220;<span class=
                   4475:                     "quote">yes</span>&#8221; to check that the
                   4476:                     installed &#8220;<span class=
                   4477:                     "quote">#!</span>&#8221;-scripts will find
                   4478:                     their interpreter.</p>
                   4479:                   </li>
                   4480:                 </ul>
                   4481:               </div>
1.1       grant    4482:             </div>
                   4483: 
1.67      hubertf  4484:             <div class="sect3" lang="en">
1.1       grant    4485:               <div class="titlepage">
                   4486:                 <div>
                   4487:                   <div>
1.67      hubertf  4488:                     <h4 class="title"><a name=
1.45      wiz      4489:                     "pre-build.local"></a>6.3.1.3.&nbsp;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4490:                     class="filename">pre-build.local</code></h4>
1.1       grant    4491:                   </div>
                   4492:                 </div>
                   4493:               </div>
                   4494: 
                   4495:               <p>It is possible to configure the bulk build to
1.47      reed     4496:               perform certain site-specific tasks at the end of the
1.45      wiz      4497:               pre-build stage. If the file <code xmlns=
                   4498:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4499:               "filename">pre-build.local</code> exists in
1.45      wiz      4500:               <code xmlns=
                   4501:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4502:               "filename">/usr/pkgsrc/mk/bulk</code>, it will be
                   4503:               executed (as a <a href=
1.24      wiz      4504:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   4505:               <span class="citerefentry"><span class=
                   4506:               "refentrytitle">sh</span>(1)</span></a> script) at
                   4507:               the end of the usual pre-build stage. An example use
1.45      wiz      4508:               of <code xmlns=
                   4509:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   4510:               "filename">pre-build.local</code> is to have the
                   4511:               line:</p>
1.1       grant    4512:               <pre class="screen">
1.71    ! wiz      4513: echo "I do not have enough disk space to build this pig." \
        !          4514:     &gt; misc/openoffice/$BROKENF
1.1       grant    4515: </pre>
                   4516: 
                   4517:               <p>to prevent the system from trying to build a
                   4518:               particular package which requires nearly 3 GB of disk
                   4519:               space.</p>
                   4520:             </div>
                   4521:           </div>
                   4522: 
1.67      hubertf  4523:           <div class="sect2" lang="en">
1.1       grant    4524:             <div class="titlepage">
                   4525:               <div>
                   4526:                 <div>
1.30      wiz      4527:                   <h3 class="title"><a name=
1.38      dillo    4528:                   "other-environmental-considerations"></a>6.3.2.&nbsp;Other
1.30      wiz      4529:                   environmental considerations</h3>
1.1       grant    4530:                 </div>
                   4531:               </div>
                   4532:             </div>
                   4533: 
1.45      wiz      4534:             <p>As <code xmlns=
                   4535:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4536:             "filename">/usr/pkg</code> will be completely deleted
                   4537:             at the start of bulk builds, make sure your login shell
                   4538:             is placed somewhere else. Either drop it into
                   4539:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4540:             class="filename">/usr/local/bin</code> (and adjust your
                   4541:             login shell in the passwd file), or (re-)install it via
1.14      xtraeme  4542:             <a href=
1.1       grant    4543:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4544:             <span class="citerefentry"><span class=
                   4545:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.45      wiz      4546:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4547:             class="filename">/etc/rc.local</code>, so you can login
                   4548:             after a reboot (remember that your current process
                   4549:             won't die if the package is removed, you just can't
                   4550:             start any new instances of the shell any more). Also,
                   4551:             if you use NetBSD earlier than 1.5, or you still want
                   4552:             to use the pkgsrc version of ssh for some reason, be
                   4553:             sure to install ssh before starting it from
                   4554:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4555:             class="filename">rc.local</code>:</p>
1.1       grant    4556:             <pre class="programlisting">
1.51      rillig   4557:     ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   4558:     if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   4559:         /usr/pkg/etc/rc.d/sshd
                   4560:     fi
1.1       grant    4561: </pre>
                   4562: 
                   4563:             <p>Not doing so will result in you being not able to
                   4564:             log in via ssh after the bulk build is finished or if
                   4565:             the machine gets rebooted or crashes. You have been
                   4566:             warned! :)</p>
                   4567:           </div>
                   4568: 
1.67      hubertf  4569:           <div class="sect2" lang="en">
1.1       grant    4570:             <div class="titlepage">
                   4571:               <div>
                   4572:                 <div>
1.67      hubertf  4573:                   <h3 class="title"><a name=
1.38      dillo    4574:                   "operation"></a>6.3.3.&nbsp;Operation</h3>
1.1       grant    4575:                 </div>
                   4576:               </div>
                   4577:             </div>
                   4578: 
                   4579:             <p>Make sure you don't need any of the packages still
                   4580:             installed.</p>
                   4581: 
                   4582:             <div class="warning" style=
                   4583:             "margin-left: 0.5in; margin-right: 0.5in;">
                   4584:               <h3 class="title">Warning</h3>
                   4585: 
                   4586:               <p>During the bulk build, <span class=
                   4587:               "emphasis"><em>all packages will be
                   4588:               removed!</em></span></p>
                   4589:             </div>
                   4590: 
                   4591:             <p>Be sure to remove all other things that might
                   4592:             interfere with builds, like some libs installed in
1.45      wiz      4593:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4594:             class="filename">/usr/local</code>, etc. then become
                   4595:             root and type:</p>
1.1       grant    4596:             <pre class="screen">
1.14      xtraeme  4597: <code class="prompt">#</code> <strong class=
                   4598: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4599: <code class="prompt">#</code> <strong class=
                   4600: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    4601: </pre>
                   4602: 
                   4603:             <p>If for some reason your last build didn't complete
                   4604:             (power failure, system panic, ...), you can continue it
                   4605:             by running:</p>
                   4606:             <pre class="screen">
1.14      xtraeme  4607: <code class="prompt">#</code> <strong class=
                   4608: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    4609: </pre>
                   4610: 
                   4611:             <p>At the end of the bulk build, you will get a summary
                   4612:             via mail, and find build logs in the directory
1.14      xtraeme  4613:             specified by <code class="varname">FTP</code> in the
1.45      wiz      4614:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4615:             class="filename">build.conf</code> file.</p>
1.1       grant    4616:           </div>
                   4617: 
1.67      hubertf  4618:           <div class="sect2" lang="en">
1.1       grant    4619:             <div class="titlepage">
                   4620:               <div>
                   4621:                 <div>
1.67      hubertf  4622:                   <h3 class="title"><a name=
1.38      dillo    4623:                   "what-it-does"></a>6.3.4.&nbsp;What it does</h3>
1.1       grant    4624:                 </div>
                   4625:               </div>
                   4626:             </div>
                   4627: 
                   4628:             <p>The bulk builds consist of three steps:</p>
                   4629: 
                   4630:             <div class="variablelist">
                   4631:               <dl>
                   4632:                 <dt><span class="term">1. pre-build</span></dt>
                   4633: 
                   4634:                 <dd>
                   4635:                   <p>The script updates your pkgsrc tree via
                   4636:                   (anon)cvs, then cleans out any broken distfiles,
                   4637:                   and removes all packages installed.</p>
                   4638:                 </dd>
                   4639: 
                   4640:                 <dt><span class="term">2. the bulk
                   4641:                 build</span></dt>
                   4642: 
                   4643:                 <dd>
                   4644:                   <p>This is basically &#8220;<span class=
                   4645:                   "quote">make bulk-package</span>&#8221; with an
                   4646:                   optimised order in which packages will be built.
                   4647:                   Packages that don't require other packages will
                   4648:                   be built first, and packages with many
                   4649:                   dependencies will be built later.</p>
                   4650:                 </dd>
                   4651: 
                   4652:                 <dt><span class="term">3. post-build</span></dt>
                   4653: 
                   4654:                 <dd>
                   4655:                   <p>Generates a report that's placed in the
1.45      wiz      4656:                   directory specified in the <code xmlns=
                   4657:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4658:                   "filename">build.conf</code> file named
1.45      wiz      4659:                   <code xmlns=
                   4660:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4661:                   "filename">broken.html</code>, a short version of
                   4662:                   that report will also be mailed to the build's
                   4663:                   admin.</p>
1.1       grant    4664:                 </dd>
                   4665:               </dl>
                   4666:             </div>
                   4667: 
                   4668:             <p>During the build, a list of broken packages will be
1.45      wiz      4669:             compiled in <code xmlns=
                   4670:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   4671:             "filename">/usr/pkgsrc/.broken</code> (or <code xmlns=
                   4672:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4673:             "filename">.../.broken.${MACHINE}</code> if
                   4674:             <code class="varname">OBJMACHINE</code> is set),
                   4675:             individual build logs of broken builds can be found in
                   4676:             the package's directory. These files are used by the
                   4677:             bulk-targets to mark broken builds to not waste time
                   4678:             trying to rebuild them, and they can be used to debug
                   4679:             these broken package builds later.</p>
1.1       grant    4680:           </div>
                   4681: 
1.67      hubertf  4682:           <div class="sect2" lang="en">
1.1       grant    4683:             <div class="titlepage">
                   4684:               <div>
                   4685:                 <div>
1.30      wiz      4686:                   <h3 class="title"><a name=
1.38      dillo    4687:                   "disk-space-requirements"></a>6.3.5.&nbsp;Disk
1.30      wiz      4688:                   space requirements</h3>
1.1       grant    4689:                 </div>
                   4690:               </div>
                   4691:             </div>
                   4692: 
                   4693:             <p>Currently, roughly the following requirements are
                   4694:             valid for NetBSD 2.0/i386:</p>
                   4695: 
                   4696:             <div class="itemizedlist">
                   4697:               <ul type="disc">
                   4698:                 <li>
                   4699:                   <p>10 GB - distfiles (NFS ok)</p>
                   4700:                 </li>
                   4701: 
                   4702:                 <li>
                   4703:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   4704:                 </li>
                   4705: 
                   4706:                 <li>
                   4707:                   <p>5 GB - temp space for compiling (local disk
                   4708:                   recommended)</p>
                   4709:                 </li>
                   4710:               </ul>
                   4711:             </div>
                   4712: 
                   4713:             <p>Note that all pkgs will be de-installed as soon as
                   4714:             they are turned into a binary package, and that sources
                   4715:             are removed, so there is no excessively huge demand to
                   4716:             disk space. Afterwards, if the package is needed again,
                   4717:             it will be installed via <a href=
                   4718:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   4719:             <span class="citerefentry"><span class=
                   4720:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   4721:             building again, so there are no cycles wasted by
                   4722:             recompiling.</p>
                   4723:           </div>
                   4724: 
1.67      hubertf  4725:           <div class="sect2" lang="en">
1.1       grant    4726:             <div class="titlepage">
                   4727:               <div>
                   4728:                 <div>
1.67      hubertf  4729:                   <h3 class="title"><a name=
                   4730:                   "setting-up-a-sandbox"></a>6.3.6.&nbsp;Setting up
                   4731:                   a sandbox for chrooted builds</h3>
1.1       grant    4732:                 </div>
                   4733:               </div>
                   4734:             </div>
                   4735: 
1.12      agc      4736:             <p>If you don't want all the packages nuked from a
                   4737:             machine (rendering it useless for anything but pkg
1.23      wiz      4738:             compiling), there is the possibility of doing the
                   4739:             package bulk build inside a chroot environment.</p>
1.12      agc      4740: 
                   4741:             <p>The first step is to set up a chroot sandbox, e.g.
1.45      wiz      4742:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   4743:             class="filename">/usr/sandbox</code>. This can be done
                   4744:             by using null mounts, or manually.</p>
1.12      agc      4745: 
1.45      wiz      4746:             <p>There is a shell script called <code xmlns=
                   4747:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4748:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   4749:             set up the sandbox environment using null mounts. It
1.45      wiz      4750:             will also create a script called <code xmlns=
                   4751:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4752:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      4753:             environment, which will allow the null mounts to be
1.14      xtraeme  4754:             activated using the <span><strong class=
                   4755:             "command">sandbox mount</strong></span> command and
                   4756:             deactivated using the <span><strong class=
                   4757:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      4758: 
                   4759:             <p>To set up a sandbox environment by hand, after
                   4760:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  4761:             doing a <span><strong class="command">make distribution
1.45      wiz      4762:             DESTDIR=/usr/sandbox</strong></span> in <code xmlns=
                   4763:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4764:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      4765:             items are present and properly configured:</p>
1.1       grant    4766: 
                   4767:             <div class="procedure">
                   4768:               <ol type="1">
                   4769:                 <li>
                   4770:                   <p>Kernel</p>
                   4771:                   <pre class="screen">
1.14      xtraeme  4772: <code class="prompt">#</code> <strong class=
                   4773: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    4774: </pre>
                   4775:                 </li>
                   4776: 
                   4777:                 <li>
1.45      wiz      4778:                   <p><code xmlns=
                   4779:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4780:                   "filename">/dev/*</code></p>
1.1       grant    4781:                   <pre class="screen">
1.14      xtraeme  4782: <code class="prompt">#</code> <strong class=
                   4783: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    4784: </pre>
                   4785:                 </li>
                   4786: 
                   4787:                 <li>
1.45      wiz      4788:                   <p><code xmlns=
                   4789:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4790:                   "filename">/etc/resolv.conf</code> (for <a xmlns=
1.1       grant    4791:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4792:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4793:                   target="_top"><code xmlns="" class=
                   4794:                   "filename">security/smtpd</code></a> and
                   4795:                   mail):</p>
1.1       grant    4796:                   <pre class="screen">
1.14      xtraeme  4797: <code class="prompt">#</code> <strong class=
                   4798: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    4799: </pre>
                   4800:                 </li>
                   4801: 
                   4802:                 <li>
                   4803:                   <p>Working(!) mail config (hostname,
                   4804:                   sendmail.cf):</p>
                   4805:                   <pre class="screen">
1.14      xtraeme  4806: <code class="prompt">#</code> <strong class=
                   4807: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    4808: </pre>
                   4809:                 </li>
                   4810: 
                   4811:                 <li>
1.45      wiz      4812:                   <p><code xmlns=
                   4813:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4814:                   "filename">/etc/localtime</code> (for <a xmlns=
1.1       grant    4815:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4816:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.45      wiz      4817:                   target="_top"><code xmlns="" class=
                   4818:                   "filename">security/smtpd</code></a>):</p>
1.1       grant    4819:                   <pre class="screen">
1.14      xtraeme  4820: <code class="prompt">#</code> <strong class=
                   4821: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    4822: </pre>
                   4823:                 </li>
                   4824: 
                   4825:                 <li>
1.45      wiz      4826:                   <p><code xmlns=
                   4827:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.71    ! wiz      4828:                   "filename">/usr/src</code> (system sources,
        !          4829:                   e.&nbsp;g. for <a xmlns=
1.1       grant    4830:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   4831:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.45      wiz      4832:                   target="_top"><code xmlns="" class=
1.71    ! wiz      4833:                   "filename">sysutils/aperture</code></a>):</p>
1.1       grant    4834:                   <pre class="screen">
1.14      xtraeme  4835: <code class="prompt">#</code> <strong class=
                   4836: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   4837: <code class="prompt">#</code> <strong class=
1.23      wiz      4838: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    4839: </pre>
                   4840:                 </li>
                   4841: 
                   4842:                 <li>
1.45      wiz      4843:                   <p>Create <code xmlns=
                   4844:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4845:                   "filename">/var/db/pkg</code> (not part of
                   4846:                   default install):</p>
1.1       grant    4847:                   <pre class="screen">
1.14      xtraeme  4848: <code class="prompt">#</code> <strong class=
                   4849: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    4850: </pre>
                   4851:                 </li>
                   4852: 
                   4853:                 <li>
1.45      wiz      4854:                   <p>Create <code xmlns=
                   4855:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4856:                   "filename">/usr/pkg</code> (not part of default
                   4857:                   install):</p>
1.1       grant    4858:                   <pre class="screen">
1.14      xtraeme  4859: <code class="prompt">#</code> <strong class=
                   4860: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    4861: </pre>
                   4862:                 </li>
                   4863: 
                   4864:                 <li>
1.45      wiz      4865:                   <p>Checkout pkgsrc via cvs into <code xmlns=
                   4866:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4867:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    4868:                   <pre class="screen">
1.14      xtraeme  4869: <code class="prompt">#</code> <strong class=
                   4870: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   4871: <code class="prompt">#</code> <strong class=
                   4872: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    4873: </pre>
                   4874: 
                   4875:                   <p>Do not mount/link this to the copy of your
                   4876:                   pkgsrc tree you do development in, as this will
                   4877:                   likely cause problems!</p>
                   4878:                 </li>
                   4879: 
                   4880:                 <li>
1.45      wiz      4881:                   <p>Make <code xmlns=
                   4882:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4883:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.45      wiz      4884:                   and <code xmlns=
                   4885:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   4886:                   "filename">.../distfiles</code> point somewhere
                   4887:                   appropriate. NFS- and/or nullfs-mounts may come
                   4888:                   in handy!</p>
1.1       grant    4889:                 </li>
                   4890: 
                   4891:                 <li>
1.45      wiz      4892:                   <p>Edit <code xmlns=
                   4893:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4894:                   "filename">/etc/mk.conf</code>, see <a href=
                   4895:                   "#binary.mk.conf" title=
1.63      dillo    4896:                   "6.3.1.2.&nbsp;/etc/mk.conf">Section&nbsp;6.3.1.2,
1.1       grant    4897:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   4898:                 </li>
                   4899: 
                   4900:                 <li>
1.45      wiz      4901:                   <p>Adjust <code xmlns=
                   4902:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4903:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    4904:                   needs.</p>
                   4905:                 </li>
                   4906:               </ol>
                   4907:             </div>
                   4908: 
1.47      reed     4909:             <p>When the chroot sandbox is set up, you can start the
1.1       grant    4910:             build with the following steps:</p>
                   4911:             <pre class="screen">
1.14      xtraeme  4912: <code class="prompt">#</code> <strong class=
                   4913: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   4914: <code class="prompt">#</code> <strong class=
                   4915: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    4916: </pre>
                   4917: 
                   4918:             <p>This will just jump inside the sandbox and start
                   4919:             building. At the end of the build, mail will be sent
                   4920:             with the results of the build. Created binary pkgs will
1.45      wiz      4921:             be in <code xmlns=
                   4922:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4923:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    4924:             (wherever that points/mounts to/from).</p>
                   4925:           </div>
                   4926: 
1.67      hubertf  4927:           <div class="sect2" lang="en">
1.1       grant    4928:             <div class="titlepage">
                   4929:               <div>
                   4930:                 <div>
1.30      wiz      4931:                   <h3 class="title"><a name=
1.38      dillo    4932:                   "building-a-partial-set"></a>6.3.7.&nbsp;Building
1.30      wiz      4933:                   a partial set of packages</h3>
1.1       grant    4934:                 </div>
                   4935:               </div>
                   4936:             </div>
                   4937: 
                   4938:             <p>In addition to building a complete set of all
1.45      wiz      4939:             packages in pkgsrc, the <code xmlns=
                   4940:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4941:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   4942:             used to build a subset of the packages contained in
1.47      reed     4943:             pkgsrc. By setting <code class=
1.45      wiz      4944:             "varname">SPECIFIC_PKGS</code> in <code xmlns=
                   4945:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  4946:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    4947: 
                   4948:             <div class="itemizedlist">
                   4949:               <ul type="disc">
                   4950:                 <li>
                   4951:                   <p>SITE_SPECIFIC_PKGS</p>
                   4952:                 </li>
                   4953: 
                   4954:                 <li>
                   4955:                   <p>HOST_SPECIFIC_PKGS</p>
                   4956:                 </li>
                   4957: 
                   4958:                 <li>
                   4959:                   <p>GROUP_SPECIFIC_PKGS</p>
                   4960:                 </li>
                   4961: 
                   4962:                 <li>
                   4963:                   <p>USER_SPECIFIC_PKGS</p>
                   4964:                 </li>
                   4965:               </ul>
                   4966:             </div>
                   4967: 
                   4968:             <p>will define the set of packages which should be
                   4969:             built. The bulk build code will also include any
                   4970:             packages which are needed as dependencies for the
                   4971:             explicitly listed packages.</p>
                   4972: 
                   4973:             <p>One use of this is to do a bulk build with
1.14      xtraeme  4974:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    4975:             sandbox periodically to have a complete set of the
                   4976:             binary packages needed for your site available without
                   4977:             the overhead of building extra packages that are not
                   4978:             needed.</p>
                   4979:           </div>
1.13      hubertf  4980: 
1.67      hubertf  4981:           <div class="sect2" lang="en">
1.13      hubertf  4982:             <div class="titlepage">
                   4983:               <div>
                   4984:                 <div>
1.67      hubertf  4985:                   <h3 class="title"><a name=
1.38      dillo    4986:                   "bulk-upload"></a>6.3.8.&nbsp;Uploading results
1.13      hubertf  4987:                   of a bulk build</h3>
                   4988:                 </div>
                   4989:               </div>
                   4990:             </div>
                   4991: 
                   4992:             <p>This section describes how pkgsrc developers can
                   4993:             upload binary pkgs built by bulk builds to
                   4994:             ftp.NetBSD.org.</p>
                   4995: 
1.17      sketch   4996:             <p>If you would like to automatically create checksum
                   4997:             files for the binary packages you intend to upload,
                   4998:             remember to set <code class="varname">MKSUMS=yes</code>
1.45      wiz      4999:             in your <code xmlns=
                   5000:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.17      sketch   5001:             "filename">mk/bulk/build.conf</code>.</p>
                   5002: 
                   5003:             <p>If you would like to PGP sign the checksum files
                   5004:             (highly recommended!), remember to set <code class=
                   5005:             "varname">SIGN_AS=username@NetBSD.org</code> in your
1.45      wiz      5006:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5007:             class="filename">mk/bulk/build.conf</code>. This will
                   5008:             prompt you for your GPG password to sign the files
1.17      sketch   5009:             before uploading everything.</p>
                   5010: 
                   5011:             <p>Then, make sure that you have <code class=
1.14      xtraeme  5012:             "varname">RSYNC_DST</code> set properly in your
1.45      wiz      5013:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5014:             class="filename">mk/bulk/build.conf</code> file, i.e.
                   5015:             adjust it to something like one of the following:</p>
1.13      hubertf  5016:             <pre class="screen">
1.68      rillig   5017: RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
1.13      hubertf  5018: </pre>
                   5019: 
1.47      reed     5020:             <p>Please use appropriate values for "pkgsrc-200xQy",
1.13      hubertf  5021:             "NetBSD-a.b.c" and "arch" here. If your login on
1.68      rillig   5022:             ftp.NetBSD.org is different from your local login,
                   5023:             write your login directly into the variable, e.g. my
                   5024:             local account is "feyrer", but for my login "hubertf",
                   5025:             I use:</p>
1.13      hubertf  5026:             <pre class="screen">
                   5027: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   5028: </pre>
                   5029: 
1.45      wiz      5030:             <p>A separate <code xmlns=
                   5031:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5032:             "filename">upload</code> directory is used here to
                   5033:             allow "closing" the directory during upload. To do so,
                   5034:             run the following command on ftp.NetBSD.org next:</p>
1.13      hubertf  5035:             <pre class="screen">
1.14      xtraeme  5036: nbftp% <strong class=
                   5037: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  5038: </pre>
                   5039: 
1.45      wiz      5040:             <p>Please note that <code xmlns=
                   5041:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5042:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  5043:             appropriate for packages for the NetBSD operating
                   5044:             system. Binary packages for other operating systems
1.45      wiz      5045:             should go into <code xmlns=
                   5046:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5047:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  5048: 
                   5049:             <p>Before uploading the binary pkgs, ssh authentication
1.47      reed     5050:             needs to be set up. This example shows how to set up
1.13      hubertf  5051:             temporary keys for the root account <span class=
                   5052:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   5053:             that no keys should be present there usually):</p>
                   5054:             <pre class="screen">
1.14      xtraeme  5055: <code class="prompt">#</code> <strong class=
1.68      rillig   5056: "userinput"><code>chroot /usr/sandbox</code></strong>
1.14      xtraeme  5057: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   5058: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>
1.14      xtraeme  5059: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   5060: "userinput"><code>ssh-keygen -t dsa</code></strong>
1.14      xtraeme  5061: chroot-<code class="prompt">#</code> <strong class=
                   5062: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  5063: </pre>
                   5064: 
1.45      wiz      5065:             <p>Now take the output of <code xmlns=
                   5066:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5067:             "filename">id-dsa.pub</code> and append it to your
1.45      wiz      5068:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5069:             class="filename">~/.ssh/authorized_keys</code> file on
                   5070:             ftp.NetBSD.org. You can remove the key after the upload
                   5071:             is done!</p>
1.13      hubertf  5072: 
                   5073:             <p>Next, test if your ssh connection really works:</p>
                   5074:             <pre class="screen">
1.14      xtraeme  5075: chroot-<code class="prompt">#</code> <strong class=
                   5076: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  5077: </pre>
                   5078: 
                   5079:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   5080: 
                   5081:             <p>Now after all this works, you can exit the sandbox
                   5082:             and start the upload:</p>
                   5083:             <pre class="screen">
1.14      xtraeme  5084: chroot-<code class="prompt">#</code> <strong class=
1.68      rillig   5085: "userinput"><code>exit</code></strong>
1.14      xtraeme  5086: <code class="prompt">#</code> <strong class=
1.68      rillig   5087: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
1.14      xtraeme  5088: <code class="prompt">#</code> <strong class=
                   5089: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  5090: </pre>
                   5091: 
                   5092:             <p>The upload process may take quite some time. Use
1.24      wiz      5093:             <a href=
                   5094:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   5095:             <span class="citerefentry"><span class=
                   5096:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   5097:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   5098:             <span class="citerefentry"><span class=
                   5099:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   5100:             server to monitor progress of the upload. The upload
                   5101:             script will take care of not uploading restricted
                   5102:             packages and putting vulnerable packages into the
1.45      wiz      5103:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5104:             class="filename">vulnerable</code> subdirectory.</p>
1.13      hubertf  5105: 
                   5106:             <p>After the upload has ended, first thing is to revoke
                   5107:             ssh access:</p>
                   5108:             <pre class="screen">
1.14      xtraeme  5109: nbftp% <strong class=
                   5110: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  5111: Gdd:x! 
                   5112: </pre>
                   5113: 
                   5114:             <p>Use whatever is needed to remove the key you've
                   5115:             entered before! Last, move the uploaded packages out of
1.45      wiz      5116:             the <code xmlns=
                   5117:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5118:             "filename">upload</code> directory to have them
                   5119:             accessible to everyone:</p>
1.13      hubertf  5120:             <pre class="screen">
1.14      xtraeme  5121: nbftp% <strong class=
                   5122: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   5123: nbftp% <strong class=
                   5124: "userinput"><code>mv upload/* .</code></strong>
                   5125: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   5126: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  5127: </pre>
                   5128:           </div>
1.1       grant    5129:         </div>
                   5130: 
1.67      hubertf  5131:         <div class="sect1" lang="en">
1.1       grant    5132:           <div class="titlepage">
                   5133:             <div>
                   5134:               <div>
                   5135:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5136:                 "creating-cdroms"></a>6.4.&nbsp;Creating a multiple
1.30      wiz      5137:                 CD-ROM packages collection</h2>
1.1       grant    5138:               </div>
                   5139:             </div>
                   5140:           </div>
                   5141: 
                   5142:           <p>After your pkgsrc bulk-build has completed, you may
                   5143:           wish to create a CD-ROM set of the resulting binary
                   5144:           packages to assist in installing packages on other
                   5145:           machines. The <a xmlns=
                   5146:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5147:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.45      wiz      5148:           target="_top"><code xmlns="" class=
                   5149:           "filename">pkgtools/cdpack</code></a> package provides a
1.20      ben      5150:           simple tool for creating the ISO 9660 images.
                   5151:           <span><strong class="command">cdpack</strong></span>
                   5152:           arranges the packages on the CD-ROMs in a way that keeps
1.47      reed     5153:           all the dependencies for a given package on the same CD
                   5154:           as that package.</p>
1.1       grant    5155: 
1.67      hubertf  5156:           <div class="sect2" lang="en">
1.1       grant    5157:             <div class="titlepage">
                   5158:               <div>
                   5159:                 <div>
1.67      hubertf  5160:                   <h3 class="title"><a name=
1.38      dillo    5161:                   "cdpack-example"></a>6.4.1.&nbsp;Example of
1.1       grant    5162:                   cdpack</h3>
                   5163:                 </div>
                   5164:               </div>
                   5165:             </div>
                   5166: 
                   5167:             <p>Complete documentation for cdpack is found in the
1.47      reed     5168:             cdpack(1) man page. The following short example assumes
1.45      wiz      5169:             that the binary packages are left in <code xmlns=
                   5170:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5171:             "filename">/usr/pkgsrc/packages/All</code> and that
1.45      wiz      5172:             sufficient disk space exists in <code xmlns=
                   5173:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5174:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    5175:             <pre class="screen">
1.14      xtraeme  5176: <code class="prompt">#</code> <strong class=
                   5177: "userinput"><code>mkdir /u2/images</code></strong>
                   5178: <code class="prompt">#</code> <strong class=
                   5179: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   5180: <code class="prompt">#</code> <strong class=
                   5181: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    5182: </pre>
                   5183: 
                   5184:             <p>If you wish to include a common set of files
1.45      wiz      5185:             (<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5186:             class="filename">COPYRIGHT</code>, <code xmlns=
                   5187:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5188:             "filename">README</code>, etc.) on each CD in the
1.1       grant    5189:             collection, then you need to create a directory which
                   5190:             contains these files. e.g.</p>
                   5191:             <pre class="screen">
1.14      xtraeme  5192: <code class="prompt">#</code> <strong class=
                   5193: "userinput"><code>mkdir /tmp/common</code></strong>
                   5194: <code class="prompt">#</code> <strong class=
                   5195: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   5196: <code class="prompt">#</code> <strong class=
                   5197: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   5198: <code class="prompt">#</code> <strong class=
                   5199: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   5200: <code class="prompt">#</code> <strong class=
                   5201: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   5202: <code class="prompt">#</code> <strong class=
                   5203: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   5204: <code class="prompt">#</code> <strong class=
                   5205: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    5206: </pre>
                   5207: 
                   5208:             <p>Now create the images:</p>
                   5209:             <pre class="screen">
1.14      xtraeme  5210: <code class="prompt">#</code> <strong class=
                   5211: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    5212: </pre>
                   5213: 
1.45      wiz      5214:             <p>Each image will contain <code xmlns=
                   5215:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5216:             "filename">README</code>, <code xmlns=
                   5217:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   5218:             "filename">COPYING</code>, and <code xmlns=
                   5219:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5220:             "filename">bin/myscript</code> in their root
1.1       grant    5221:             directories.</p>
                   5222:           </div>
                   5223:         </div>
                   5224:       </div>
                   5225: 
1.67      hubertf  5226:       <div class="chapter" lang="en">
1.1       grant    5227:         <div class="titlepage">
                   5228:           <div>
                   5229:             <div>
1.67      hubertf  5230:               <h2 class="title"><a name=
1.38      dillo    5231:               "faq"></a>Chapter&nbsp;7.&nbsp;Frequently Asked
1.1       grant    5232:               Questions</h2>
                   5233:             </div>
                   5234:           </div>
                   5235:         </div>
                   5236: 
                   5237:         <div class="toc">
                   5238:           <p><b>Table of Contents</b></p>
                   5239: 
                   5240:           <dl>
1.30      wiz      5241:             <dt><span class="sect1"><a href=
1.38      dillo    5242:             "#mailing-list-pointers">7.1. Are there any mailing
1.30      wiz      5243:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    5244: 
1.38      dillo    5245:             <dt><span class="sect1"><a href="#pkgviews-docs">7.2.
1.1       grant    5246:             Where's the pkgviews documentation?</a></span></dt>
                   5247: 
1.38      dillo    5248:             <dt><span class="sect1"><a href="#faq-pkgtools">7.3.
1.1       grant    5249:             Utilities for package management
                   5250:             (pkgtools)</a></span></dt>
                   5251: 
1.38      dillo    5252:             <dt><span class="sect1"><a href="#non-root-pkgsrc">7.4.
1.30      wiz      5253:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    5254: 
1.30      wiz      5255:             <dt><span class="sect1"><a href=
1.38      dillo    5256:             "#resume-transfers">7.5. How to resume transfers when
1.30      wiz      5257:             fetching distfiles?</a></span></dt>
1.14      xtraeme  5258: 
1.30      wiz      5259:             <dt><span class="sect1"><a href=
1.38      dillo    5260:             "#XFree86-from-pkgsrc">7.6. How can I install/use
1.30      wiz      5261:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    5262: 
1.30      wiz      5263:             <dt><span class="sect1"><a href=
1.38      dillo    5264:             "#x.org-from-pkgsrc">7.7. How can I install/use X.org
1.30      wiz      5265:             from pkgsrc?</a></span></dt>
1.1       grant    5266: 
1.30      wiz      5267:             <dt><span class="sect1"><a href=
1.38      dillo    5268:             "#fetch-behind-firewall">7.8. How to fetch files from
1.30      wiz      5269:             behind a firewall</a></span></dt>
1.1       grant    5270: 
1.38      dillo    5271:             <dt><span class="sect1"><a href="#passive-ftp">7.9. How
1.14      xtraeme  5272:             do I tell <span><strong class="command">make
                   5273:             fetch</strong></span> to do passive
                   5274:             FTP?</a></span></dt>
1.1       grant    5275: 
1.30      wiz      5276:             <dt><span class="sect1"><a href=
1.38      dillo    5277:             "#fetching-all-distfiles">7.10. How to fetch all
1.30      wiz      5278:             distfiles at once</a></span></dt>
1.1       grant    5279: 
1.30      wiz      5280:             <dt><span class="sect1"><a href=
1.38      dillo    5281:             "#tmac.andoc-missing">7.11. What does
1.30      wiz      5282:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  5283:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    5284:             mean?</a></span></dt>
                   5285: 
1.30      wiz      5286:             <dt><span class="sect1"><a href=
1.38      dillo    5287:             "#bsd.own.mk-missing">7.12. What does
1.30      wiz      5288:             &#8220;<span class="quote">Could not find
1.14      xtraeme  5289:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    5290: 
1.30      wiz      5291:             <dt><span class="sect1"><a href=
1.38      dillo    5292:             "#using-sudo-with-pkgsrc">7.13. Using 'sudo' with
1.30      wiz      5293:             pkgsrc</a></span></dt>
1.1       grant    5294: 
1.38      dillo    5295:             <dt><span class="sect1"><a href="#faq.conf">7.14. How
1.35      jmmv     5296:             do I change the location of configuration
                   5297:             files?</a></span></dt>
1.1       grant    5298: 
1.38      dillo    5299:             <dt><span class="sect1"><a href="#audit-packages">7.15.
1.1       grant    5300:             Automated security checks</a></span></dt>
                   5301:           </dl>
                   5302:         </div>
                   5303: 
                   5304:         <p>This section contains hints, tips &amp; tricks on
                   5305:         special things in pkgsrc that we didn't find a better place
                   5306:         for in the previous chapters, and it contains items for
                   5307:         both pkgsrc users and developers.</p>
                   5308: 
1.67      hubertf  5309:         <div class="sect1" lang="en">
1.1       grant    5310:           <div class="titlepage">
                   5311:             <div>
                   5312:               <div>
                   5313:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5314:                 "mailing-list-pointers"></a>7.1.&nbsp;Are there any
1.30      wiz      5315:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    5316:               </div>
                   5317:             </div>
                   5318:           </div>
                   5319: 
1.18      xtraeme  5320:           <p>The following mailing lists may be of interest to
                   5321:           pkgsrc users:</p>
                   5322: 
                   5323:           <div class="itemizedlist">
                   5324:             <ul type="disc">
                   5325:               <li>
                   5326:                 <p><a href=
                   5327:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.71    ! wiz      5328:                 target="_top">pkgsrc-bugs</a>: All bug reports in
        !          5329:                 category "pkg" sent with <a href=
        !          5330:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
        !          5331:                 <span class="citerefentry"><span class=
        !          5332:                 "refentrytitle">send-pr</span>(1)</span></a> appear
        !          5333:                 here. Please do not report your bugs here directly;
        !          5334:                 use one of the other mailing lists. discussed.</p>
1.18      xtraeme  5335:               </li>
                   5336: 
                   5337:               <li>
                   5338:                 <p><a href=
                   5339:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.34      wiz      5340:                 target="_top">pkgsrc-bulk</a>: A list where the
1.20      ben      5341:                 results of pkgsrc bulk builds are sent and
1.34      wiz      5342:                 discussed.</p>
1.18      xtraeme  5343:               </li>
                   5344: 
                   5345:               <li>
                   5346:                 <p><a href=
                   5347:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.71    ! wiz      5348:                 target="_top">pkgsrc-changes</a>: This list is for
        !          5349:                 those who are interested in getting a commit
        !          5350:                 message for every change committed to pkgsrc. It is
        !          5351:                 also available in digest form, meaning one daily
        !          5352:                 message containing all commit messages for changes
        !          5353:                 to the package source tree in that 24 hour
        !          5354:                 period.</p>
1.18      xtraeme  5355:               </li>
                   5356: 
                   5357:               <li>
                   5358:                 <p><a href=
                   5359:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.71    ! wiz      5360:                 target="_top">pkgsrc-users</a>: This is a general
        !          5361:                 purpose list for most issues regarding pkgsrc,
        !          5362:                 regardless of platform, e.g. soliciting user help
        !          5363:                 for pkgsrc configuration, unexpected build
        !          5364:                 failures, using particular packages, upgrading
        !          5365:                 pkgsrc installations, questions regarding the
        !          5366:                 pkgsrc release branches, etc. General announcements
        !          5367:                 or proposals for changes that impact the pkgsrc
        !          5368:                 user community, e.g. major infrastructure changes,
        !          5369:                 new features, package removals, etc., may also be
        !          5370:                 posted.</p>
        !          5371:               </li>
        !          5372: 
        !          5373:               <li>
        !          5374:                 <p><a href=
        !          5375:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
        !          5376:                 target="_top">tech-pkg</a>: This is a list for
        !          5377:                 technical discussions related to pkgsrc
        !          5378:                 development, e.g. soliciting feedback for changes
        !          5379:                 to pkgsrc infrastructure, proposed new features,
        !          5380:                 questions related to porting pkgsrc to a new
        !          5381:                 platform, advice for maintaining a package, patches
        !          5382:                 that affect many packages, help requests moved from
        !          5383:                 pkgsrc-users when an infrastructure bug is found,
        !          5384:                 etc.</p>
1.18      xtraeme  5385:               </li>
                   5386:             </ul>
                   5387:           </div>
                   5388: 
                   5389:           <p>To subscribe, do:</p>
1.1       grant    5390:           <pre class="programlisting">
1.51      rillig   5391:     <code class="prompt">%</code> echo subscribe <em class=
1.18      xtraeme  5392: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    5393: </pre>
                   5394: 
1.18      xtraeme  5395:           <p>Archives for all these mailing lists are available
                   5396:           from <a href="http://mail-index.NetBSD.org/" target=
                   5397:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    5398:         </div>
                   5399: 
1.67      hubertf  5400:         <div class="sect1" lang="en">
1.1       grant    5401:           <div class="titlepage">
                   5402:             <div>
                   5403:               <div>
                   5404:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5405:                 "pkgviews-docs"></a>7.2.&nbsp;Where's the pkgviews
1.30      wiz      5406:                 documentation?</h2>
1.1       grant    5407:               </div>
                   5408:             </div>
                   5409:           </div>
                   5410: 
                   5411:           <p>Pkgviews is tightly integrated with buildlink. You can
1.45      wiz      5412:           find a pkgviews User's guide in <code xmlns=
                   5413:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5414:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    5415:         </div>
                   5416: 
1.67      hubertf  5417:         <div class="sect1" lang="en">
1.1       grant    5418:           <div class="titlepage">
                   5419:             <div>
                   5420:               <div>
                   5421:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5422:                 "faq-pkgtools"></a>7.3.&nbsp;Utilities for package
1.5       hubertf  5423:                 management (pkgtools)</h2>
1.1       grant    5424:               </div>
                   5425:             </div>
                   5426:           </div>
                   5427: 
1.45      wiz      5428:           <p>The <code xmlns=
                   5429:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5430:           "filename">pkgsrc/pkgtools</code> directory pkgtools
                   5431:           contains a number of useful utilities for both users and
                   5432:           developers of pkgsrc. This section attempts only to make
                   5433:           the reader aware of the utilities and when they might be
                   5434:           useful, and not to duplicate the documentation that comes
                   5435:           with each package.</p>
1.1       grant    5436: 
                   5437:           <p>Utilities used by pkgsrc (automatically installed when
                   5438:           needed):</p>
                   5439: 
                   5440:           <div class="itemizedlist">
                   5441:             <ul type="disc">
                   5442:               <li>
                   5443:                 <p><a xmlns=
                   5444:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5445:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.45      wiz      5446:                 target="_top"><code xmlns="" class=
                   5447:                 "filename">pkgtools/x11-links</code></a>: Symlinks
1.34      wiz      5448:                 for use by buildlink.</p>
1.1       grant    5449:               </li>
                   5450:             </ul>
                   5451:           </div>
                   5452: 
                   5453:           <p>OS tool augmentation (automatically installed when
                   5454:           needed):</p>
                   5455: 
                   5456:           <div class="itemizedlist">
                   5457:             <ul type="disc">
                   5458:               <li>
                   5459:                 <p><a xmlns=
                   5460:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5461:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.45      wiz      5462:                 target="_top"><code xmlns="" class=
                   5463:                 "filename">pkgtools/digest</code></a>: Calculates
1.34      wiz      5464:                 various kinds of checksums (including SHA1).</p>
1.1       grant    5465:               </li>
                   5466: 
                   5467:               <li>
                   5468:                 <p><a xmlns=
                   5469:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5470:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.45      wiz      5471:                 target="_top"><code xmlns="" class=
                   5472:                 "filename">pkgtools/libnbcompat</code></a>:
1.34      wiz      5473:                 Compatibility library for pkgsrc tools.</p>
1.1       grant    5474:               </li>
                   5475: 
                   5476:               <li>
                   5477:                 <p><a xmlns=
                   5478:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5479:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.45      wiz      5480:                 target="_top"><code xmlns="" class=
                   5481:                 "filename">pkgtools/mtree</code></a>: Installed on
1.34      wiz      5482:                 non-BSD systems due to lack of native mtree.</p>
1.1       grant    5483:               </li>
                   5484: 
                   5485:               <li>
                   5486:                 <p><a xmlns=
                   5487:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5488:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5489:                 target="_top"><code xmlns="" class=
                   5490:                 "filename">pkgtools/pkg_install</code></a>:
                   5491:                 Up-to-date replacement for <code xmlns=
                   5492:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5493:                 "filename">/usr/sbin/pkg_install</code>, or for use
                   5494:                 on operating systems where pkg_install is not
                   5495:                 present.</p>
1.1       grant    5496:               </li>
                   5497:             </ul>
                   5498:           </div>
                   5499: 
                   5500:           <p>Utilities used by pkgsrc (not automatically
                   5501:           installed):</p>
                   5502: 
                   5503:           <div class="itemizedlist">
                   5504:             <ul type="disc">
                   5505:               <li>
                   5506:                 <p><a xmlns=
                   5507:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5508:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.45      wiz      5509:                 target="_top"><code xmlns="" class=
                   5510:                 "filename">pkgtools/pkg_tarup</code></a>: Create a
1.20      ben      5511:                 binary package from an already-installed package.
1.34      wiz      5512:                 Used by <span><strong class="command">make
                   5513:                 replace</strong></span> to save the old
                   5514:                 package.</p>
1.1       grant    5515:               </li>
                   5516: 
                   5517:               <li>
                   5518:                 <p><a xmlns=
                   5519:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  5520:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.45      wiz      5521:                 target="_top"><code xmlns="" class=
                   5522:                 "filename">pkgtools/dfdisk</code></a>: Adds extra
1.20      ben      5523:                 functionality to pkgsrc, allowing it to fetch
                   5524:                 distfiles from multiple locations. It currently
                   5525:                 supports the following methods: multiple CD-ROMs
                   5526:                 and network FTP/HTTP connections.</p>
1.5       hubertf  5527:               </li>
                   5528: 
                   5529:               <li>
                   5530:                 <p><a xmlns=
                   5531:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5532:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      5533:                 target="_top"><code xmlns="" class=
                   5534:                 "filename">pkgtools/xpkgwedge</code></a>: Put X11
1.34      wiz      5535:                 packages someplace else (enabled by default).</p>
1.1       grant    5536:               </li>
1.5       hubertf  5537: 
                   5538:               <li>
                   5539:                 <p><a xmlns=
                   5540:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5541:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      5542:                 target="_top"><code xmlns="" class=
                   5543:                 "filename">devel/cpuflags</code></a>: Determine the
1.34      wiz      5544:                 best compiler flags to optimise code for your
1.20      ben      5545:                 current CPU and compiler.</p>
1.5       hubertf  5546:               </li>
1.1       grant    5547:             </ul>
                   5548:           </div>
                   5549: 
                   5550:           <p>Utilities for keeping track of installed packages,
                   5551:           being up to date, etc:</p>
                   5552: 
                   5553:           <div class="itemizedlist">
                   5554:             <ul type="disc">
                   5555:               <li>
                   5556:                 <p><a xmlns=
                   5557:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5558:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.45      wiz      5559:                 target="_top"><code xmlns="" class=
                   5560:                 "filename">pkgtools/pkg_chk</code></a>: Reports on
1.27      rillig   5561:                 packages whose installed versions do not match the
1.34      wiz      5562:                 latest pkgsrc entries.</p>
1.1       grant    5563:               </li>
                   5564: 
                   5565:               <li>
                   5566:                 <p><a xmlns=
                   5567:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5568:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5569:                 target="_top"><code xmlns="" class=
                   5570:                 "filename">pkgtools/pkgdep</code></a>: Makes
1.20      ben      5571:                 dependency graphs of packages, to aid in choosing a
1.34      wiz      5572:                 strategy for updating.</p>
1.1       grant    5573:               </li>
                   5574: 
                   5575:               <li>
                   5576:                 <p><a xmlns=
                   5577:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5578:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.45      wiz      5579:                 target="_top"><code xmlns="" class=
                   5580:                 "filename">pkgtools/pkgdepgraph</code></a>: Makes
1.27      rillig   5581:                 graphs from the output of <a xmlns=
                   5582:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5583:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.45      wiz      5584:                 target="_top"><code xmlns="" class=
                   5585:                 "filename">pkgtools/pkgdep</code></a> (uses
1.34      wiz      5586:                 graphviz).</p>
1.1       grant    5587:               </li>
                   5588: 
                   5589:               <li>
                   5590:                 <p><a xmlns=
                   5591:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5592:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      5593:                 target="_top"><code xmlns="" class=
                   5594:                 "filename">pkgtools/pkglint</code></a>: The
1.27      rillig   5595:                 pkglint(1) program checks a pkgsrc entry for
                   5596:                 errors, lintpkgsrc(1) does various checks on the
                   5597:                 complete pkgsrc system.</p>
1.1       grant    5598:               </li>
                   5599: 
                   5600:               <li>
                   5601:                 <p><a xmlns=
                   5602:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5603:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.45      wiz      5604:                 target="_top"><code xmlns="" class=
                   5605:                 "filename">pkgtools/pkgsurvey</code></a>: Report
                   5606:                 what packages you have installed.</p>
1.1       grant    5607:               </li>
                   5608:             </ul>
                   5609:           </div>
                   5610: 
                   5611:           <p>Utilities for people maintaining or creating
                   5612:           individual packages:</p>
                   5613: 
                   5614:           <div class="itemizedlist">
                   5615:             <ul type="disc">
                   5616:               <li>
                   5617:                 <p><a xmlns=
                   5618:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5619:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      5620:                 target="_top"><code xmlns="" class=
                   5621:                 "filename">pkgtools/pkgdiff</code></a>: Automate
1.20      ben      5622:                 making and maintaining patches for a package
1.34      wiz      5623:                 (includes pkgdiff, pkgvi, mkpatches, etc.).</p>
1.1       grant    5624:               </li>
                   5625: 
                   5626:               <li>
                   5627:                 <p><a xmlns=
                   5628:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5629:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.45      wiz      5630:                 target="_top"><code xmlns="" class=
                   5631:                 "filename">pkgtools/rpm2pkg</code></a>, <a xmlns=
1.20      ben      5632:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5633:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      5634:                 target="_top"><code xmlns="" class=
                   5635:                 "filename">pkgtools/url2pkg</code></a>: Aids in
1.34      wiz      5636:                 converting to pkgsrc.</p>
1.1       grant    5637:               </li>
                   5638: 
                   5639:               <li>
                   5640:                 <p><a xmlns=
                   5641:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5642:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.45      wiz      5643:                 target="_top"><code xmlns="" class=
                   5644:                 "filename">pkgtools/gensolpkg</code></a>: Convert
1.34      wiz      5645:                 pkgsrc to a Solaris package.</p>
1.1       grant    5646:               </li>
                   5647:             </ul>
                   5648:           </div>
                   5649: 
1.47      reed     5650:           <p>Utilities for people maintaining pkgsrc (or: more
1.1       grant    5651:           obscure pkg utilities)</p>
                   5652: 
                   5653:           <div class="itemizedlist">
                   5654:             <ul type="disc">
                   5655:               <li>
                   5656:                 <p><a xmlns=
                   5657:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5658:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.45      wiz      5659:                 target="_top"><code xmlns="" class=
                   5660:                 "filename">pkgtools/pkg_comp</code></a>: Build
1.34      wiz      5661:                 packages in a chrooted area.</p>
1.1       grant    5662:               </li>
                   5663: 
                   5664:               <li>
                   5665:                 <p><a xmlns=
                   5666:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5667:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.45      wiz      5668:                 target="_top"><code xmlns="" class=
                   5669:                 "filename">pkgtools/libkver</code></a>: Spoof
                   5670:                 kernel version for chrooted cross builds.</p>
1.1       grant    5671:               </li>
                   5672:             </ul>
                   5673:           </div>
                   5674:         </div>
                   5675: 
1.67      hubertf  5676:         <div class="sect1" lang="en">
1.1       grant    5677:           <div class="titlepage">
                   5678:             <div>
                   5679:               <div>
                   5680:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5681:                 "non-root-pkgsrc"></a>7.4.&nbsp;How to use pkgsrc
1.30      wiz      5682:                 as non-root</h2>
1.1       grant    5683:               </div>
                   5684:             </div>
                   5685:           </div>
                   5686: 
                   5687:           <p>If you want to use pkgsrc as non-root user, you can
                   5688:           set some variables to make pkgsrc work under these
1.33      jmmv     5689:           conditions. At the very least, you need to set
                   5690:           <code class="varname">UNPRIVILEGED</code> to
                   5691:           &#8220;<span class="quote">yes</span>&#8221;; this will
                   5692:           turn on unprivileged mode and set multiple related
                   5693:           variables to allow installation of packages as
                   5694:           non-root.</p>
                   5695: 
                   5696:           <p>In case the defaults are not enough, you may want to
                   5697:           tune some other variables used. For example, if the
                   5698:           automatic user/group detection leads to incorrect values
                   5699:           (or not the ones you would like to use), you can change
                   5700:           them by setting <code class=
                   5701:           "varname">UNPRIVILEGED_USER</code> and <code class=
                   5702:           "varname">UNPRIVILEGED_GROUP</code> respectively.</p>
                   5703: 
                   5704:           <p>As regards bootstrapping, please note that the
                   5705:           <span><strong class="command">bootstrap</strong></span>
                   5706:           script will ease non-root configuration when given the
                   5707:           &#8220;<span class=
                   5708:           "quote">--ignore-user-check</span>&#8221; flag, as it
                   5709:           will choose and use multiple default directories under
1.45      wiz      5710:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5711:           class="filename">~/pkg</code> as the installation
1.33      jmmv     5712:           targets. These directories can be overriden by the
                   5713:           &#8220;<span class="quote">--prefix</span>&#8221; flag
                   5714:           provided by the script, as well as some others that allow
                   5715:           finer tuning of the tree layout.</p>
1.14      xtraeme  5716:         </div>
                   5717: 
1.67      hubertf  5718:         <div class="sect1" lang="en">
1.14      xtraeme  5719:           <div class="titlepage">
                   5720:             <div>
                   5721:               <div>
                   5722:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5723:                 "resume-transfers"></a>7.5.&nbsp;How to resume
1.30      wiz      5724:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  5725:               </div>
                   5726:             </div>
                   5727:           </div>
                   5728: 
1.47      reed     5729:           <p>By default, resuming transfers in pkgsrc is disabled,
1.15      xtraeme  5730:           but you can enable this feature by adding the option
                   5731:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
1.45      wiz      5732:           into <code xmlns=
                   5733:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5734:           "filename">/etc/mk.conf</code>. If, during a fetch step,
                   5735:           an incomplete distfile is found, pkgsrc will try to
                   5736:           resume it.</p>
1.15      xtraeme  5737: 
                   5738:           <p>You can also use a different program than the default
1.24      wiz      5739:           <a href=
                   5740:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5741:           <span class="citerefentry"><span class=
                   5742:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   5743:           <code class="varname">FETCH_CMD</code> variable. Don't
                   5744:           forget to set <code class=
                   5745:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   5746:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   5747:           default values.</p>
1.14      xtraeme  5748: 
1.45      wiz      5749:           <p>For example, if you want to use <code xmlns=
                   5750:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5751:           "filename">wget</code> to resume downloads, you'll have
                   5752:           to use something like:</p>
                   5753:           <pre class="programlisting">
1.51      rillig   5754:     FETCH_CMD=             wget
                   5755:     FETCH_BEFORE_ARGS=     --passive-ftp
                   5756:     FETCH_RESUME_ARGS=     -c
                   5757:     FETCH_OUTPUT_ARGS=     -O
1.14      xtraeme  5758: </pre>
1.1       grant    5759:         </div>
                   5760: 
1.67      hubertf  5761:         <div class="sect1" lang="en">
1.1       grant    5762:           <div class="titlepage">
                   5763:             <div>
                   5764:               <div>
                   5765:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5766:                 "XFree86-from-pkgsrc"></a>7.6.&nbsp;How can I
1.1       grant    5767:                 install/use XFree86 from pkgsrc?</h2>
                   5768:               </div>
                   5769:             </div>
                   5770:           </div>
                   5771: 
                   5772:           <p>If you want to use XFree86 from pkgsrc instead of your
1.45      wiz      5773:           system's own X11 (<code xmlns=
                   5774:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5775:           "filename">/usr/X11R6</code>, <code xmlns=
                   5776:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5777:           "filename">/usr/openwin</code>, ...), you will have to
1.45      wiz      5778:           add the following line into <code xmlns=
                   5779:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5780:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5781:           <pre class="programlisting">
1.51      rillig   5782:     X11_TYPE=XFree86
1.1       grant    5783: </pre>
                   5784:         </div>
                   5785: 
1.67      hubertf  5786:         <div class="sect1" lang="en">
1.1       grant    5787:           <div class="titlepage">
                   5788:             <div>
                   5789:               <div>
                   5790:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5791:                 "x.org-from-pkgsrc"></a>7.7.&nbsp;How can I
1.1       grant    5792:                 install/use X.org from pkgsrc?</h2>
                   5793:               </div>
                   5794:             </div>
                   5795:           </div>
                   5796: 
                   5797:           <p>If you want to use X.org from pkgsrc instead of your
1.45      wiz      5798:           system's own X11 (<code xmlns=
                   5799:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5800:           "filename">/usr/X11R6</code>, <code xmlns=
                   5801:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5802:           "filename">/usr/openwin</code>, ...) you will have to add
1.45      wiz      5803:           the following line into <code xmlns=
                   5804:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.15      xtraeme  5805:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    5806:           <pre class="programlisting">
1.51      rillig   5807:     X11_TYPE=xorg
1.1       grant    5808: </pre>
1.70      rillig   5809: 
                   5810:           <div class="note" style=
                   5811:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5812:             <h3 class="title">Note</h3>
                   5813: 
                   5814:             <p>The DragonFly operating system defaults to using
                   5815:             this X.org X11 implementation from pkgsrc.</p>
                   5816:           </div>
1.1       grant    5817:         </div>
                   5818: 
1.67      hubertf  5819:         <div class="sect1" lang="en">
1.1       grant    5820:           <div class="titlepage">
                   5821:             <div>
                   5822:               <div>
                   5823:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5824:                 "fetch-behind-firewall"></a>7.8.&nbsp;How to fetch
1.30      wiz      5825:                 files from behind a firewall</h2>
1.1       grant    5826:               </div>
                   5827:             </div>
                   5828:           </div>
                   5829: 
                   5830:           <p>If you are sitting behind a firewall which does not
                   5831:           allow direct connections to Internet hosts (i.e.
                   5832:           non-NAT), you may specify the relevant proxy hosts. This
                   5833:           is done using an environment variable in the form of a
1.47      reed     5834:           URL, e.g. in Amdahl, the machine &#8220;<span class=
1.1       grant    5835:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   5836:           firewalls, and it uses port 80 as the proxy port number.
                   5837:           So the proxy environment variables are:</p>
                   5838:           <pre class="programlisting">
1.51      rillig   5839:     ftp_proxy=ftp://orpheus.amdahl.com:80/
                   5840:     http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    5841: </pre>
                   5842:         </div>
                   5843: 
1.67      hubertf  5844:         <div class="sect1" lang="en">
1.1       grant    5845:           <div class="titlepage">
                   5846:             <div>
                   5847:               <div>
                   5848:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  5849:                 "passive-ftp"></a>7.9.&nbsp;How do I tell
                   5850:                 <span><strong class="command">make
1.14      xtraeme  5851:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    5852:               </div>
                   5853:             </div>
                   5854:           </div>
                   5855: 
                   5856:           <p>This depends on which utility is used to retrieve
1.45      wiz      5857:           distfiles. From <code xmlns=
                   5858:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5859:           "filename">bsd.pkg.mk</code>, <code class=
                   5860:           "varname">FETCH_CMD</code> is assigned the first
                   5861:           available command from the following list:</p>
1.34      wiz      5862: 
                   5863:           <div class="itemizedlist">
                   5864:             <ul type="disc">
                   5865:               <li>
1.45      wiz      5866:                 <p><code xmlns=
                   5867:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      5868:                 "filename">${LOCALBASE}/bin/ftp</code></p>
                   5869:               </li>
                   5870: 
                   5871:               <li>
1.45      wiz      5872:                 <p><code xmlns=
                   5873:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   5874:                 "filename">/usr/bin/ftp</code></p>
1.34      wiz      5875:               </li>
                   5876:             </ul>
                   5877:           </div>
1.1       grant    5878: 
                   5879:           <p>On a default NetBSD installation, this will be
1.45      wiz      5880:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5881:           class="filename">/usr/bin/ftp</code>, which automatically
                   5882:           tries passive connections first, and falls back to active
                   5883:           connections if the server refuses to do passive. For the
                   5884:           other tools, add the following to your <code xmlns=
                   5885:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   5886:           "filename">/etc/mk.conf</code> file: <code class=
                   5887:           "varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    5888: 
1.45      wiz      5889:           <p>Having that option present will prevent <code xmlns=
                   5890:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5891:           "filename">/usr/bin/ftp</code> from falling back to
                   5892:           active transfers.</p>
1.1       grant    5893:         </div>
                   5894: 
1.67      hubertf  5895:         <div class="sect1" lang="en">
1.1       grant    5896:           <div class="titlepage">
                   5897:             <div>
                   5898:               <div>
                   5899:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5900:                 "fetching-all-distfiles"></a>7.10.&nbsp;How to
1.1       grant    5901:                 fetch all distfiles at once</h2>
                   5902:               </div>
                   5903:             </div>
                   5904:           </div>
                   5905: 
                   5906:           <p>You would like to download all the distfiles in a
                   5907:           single batch from work or university, where you can't run
1.14      xtraeme  5908:           a <span><strong class="command">make
                   5909:           fetch</strong></span>. There is an archive of distfiles
                   5910:           on <a href=
1.1       grant    5911:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   5912:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   5913:           entire directory may not be appropriate.</p>
                   5914: 
1.14      xtraeme  5915:           <p>The answer here is to do a <span><strong class=
1.45      wiz      5916:           "command">make fetch-list</strong></span> in <code xmlns=
                   5917:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     5918:           "filename">/usr/pkgsrc</code> or one of its
1.1       grant    5919:           subdirectories, carry the resulting list to your machine
1.23      wiz      5920:           at work/school and use it there. If you don't have a
1.24      wiz      5921:           NetBSD-compatible <a href=
                   5922:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   5923:           <span class="citerefentry"><span class=
                   5924:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   5925:           at work, don't forget to set <code class=
                   5926:           "varname">FETCH_CMD</code> to something that fetches a
                   5927:           URL:</p>
1.1       grant    5928: 
                   5929:           <p>At home:</p>
                   5930:           <pre class="screen">
1.14      xtraeme  5931: <code class="prompt">%</code> <strong class=
                   5932: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   5933: <code class="prompt">%</code> <strong class=
                   5934: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   5935: <code class="prompt">%</code> <strong class=
                   5936: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    5937: </pre>
                   5938: 
                   5939:           <p>At work:</p>
                   5940:           <pre class="screen">
1.14      xtraeme  5941: <code class="prompt">%</code> <strong class=
                   5942: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    5943: </pre>
                   5944: 
1.45      wiz      5945:           <p>then tar up <code xmlns=
                   5946:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  5947:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    5948: 
                   5949:           <p>If you have a machine running NetBSD, and you want to
                   5950:           get <span class="emphasis"><em>all</em></span> distfiles
                   5951:           (even ones that aren't for your machine architecture),
                   5952:           you can do so by using the above-mentioned
1.14      xtraeme  5953:           <span><strong class="command">make
                   5954:           fetch-list</strong></span> approach, or fetch the
                   5955:           distfiles directly by running:</p>
1.1       grant    5956:           <pre class="screen">
1.14      xtraeme  5957: <code class="prompt">%</code> <strong class=
                   5958: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    5959: </pre>
                   5960: 
1.14      xtraeme  5961:           <p>If you even decide to ignore <code class=
                   5962:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   5963:           can get everything by running:</p>
1.1       grant    5964:           <pre class="screen">
1.14      xtraeme  5965: <code class="prompt">%</code> <strong class=
                   5966: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    5967: </pre>
                   5968:         </div>
                   5969: 
1.67      hubertf  5970:         <div class="sect1" lang="en">
1.1       grant    5971:           <div class="titlepage">
                   5972:             <div>
                   5973:               <div>
                   5974:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    5975:                 "tmac.andoc-missing"></a>7.11.&nbsp;What does
1.1       grant    5976:                 &#8220;<span class="quote">Don't know how to make
                   5977:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   5978:               </div>
                   5979:             </div>
                   5980:           </div>
                   5981: 
                   5982:           <p>When compiling the <a xmlns=
                   5983:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5984:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5985:           target="_top"><code xmlns="" class=
                   5986:           "filename">pkgtools/pkg_install</code></a> package, you
                   5987:           get the error from make that it doesn't know how to make
                   5988:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5989:           class="filename">/usr/share/tmac/tmac.andoc</code>? This
                   5990:           indicates that you don't have installed the
1.23      wiz      5991:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   5992:           ...) from the NetBSD base distribution on your machine.
1.47      reed     5993:           It is recommended to do that to format man pages.</p>
1.1       grant    5994: 
                   5995:           <p>In the case of the <a xmlns=
                   5996:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5997:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.45      wiz      5998:           target="_top"><code xmlns="" class=
                   5999:           "filename">pkgtools/pkg_install</code></a> package, you
                   6000:           can get away with setting <code class=
1.20      ben      6001:           "varname">NOMAN=YES</code> either in the environment or
1.45      wiz      6002:           in <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6003:           class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6004:         </div>
                   6005: 
1.67      hubertf  6006:         <div class="sect1" lang="en">
1.1       grant    6007:           <div class="titlepage">
                   6008:             <div>
                   6009:               <div>
                   6010:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6011:                 "bsd.own.mk-missing"></a>7.12.&nbsp;What does
1.1       grant    6012:                 &#8220;<span class="quote">Could not find
                   6013:                 bsd.own.mk</span>&#8221; mean?</h2>
                   6014:               </div>
                   6015:             </div>
                   6016:           </div>
                   6017: 
1.45      wiz      6018:           <p>You didn't install the compiler set, <code xmlns=
                   6019:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6020:           "filename">comp.tgz</code>, when you installed your
1.47      reed     6021:           NetBSD machine. Please get and install it, by extracting
                   6022:           it in <code xmlns=
1.45      wiz      6023:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6024:           "filename">/</code>:</p>
1.1       grant    6025:           <pre class="screen">
1.14      xtraeme  6026: <code class="prompt">#</code> <strong class=
                   6027: "userinput"><code>cd /</code></strong>
                   6028: <code class="prompt">#</code> <strong class=
                   6029: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    6030: </pre>
                   6031: 
1.45      wiz      6032:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6033:           class="filename">comp.tgz</code> is part of every NetBSD
                   6034:           release. Get the one that corresponds to your release
                   6035:           (determine via <span><strong class="command">uname
                   6036:           -r</strong></span>).</p>
1.1       grant    6037:         </div>
                   6038: 
1.67      hubertf  6039:         <div class="sect1" lang="en">
1.1       grant    6040:           <div class="titlepage">
                   6041:             <div>
                   6042:               <div>
                   6043:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6044:                 "using-sudo-with-pkgsrc"></a>7.13.&nbsp;Using
1.1       grant    6045:                 'sudo' with pkgsrc</h2>
                   6046:               </div>
                   6047:             </div>
                   6048:           </div>
                   6049: 
                   6050:           <p>When installing packages as non-root user and using
1.24      wiz      6051:           the just-in-time <a href=
                   6052:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   6053:           <span class="citerefentry"><span class=
                   6054:           "refentrytitle">su</span>(1)</span></a> feature of
                   6055:           pkgsrc, it can become annoying to type in the root
                   6056:           password for each required package installed. To avoid
                   6057:           this, the sudo package can be used, which does password
                   6058:           caching over a limited time. To use it, install sudo
                   6059:           (either as binary package or from <a xmlns=
                   6060:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6061:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.45      wiz      6062:           target="_top"><code xmlns="" class=
                   6063:           "filename">security/sudo</code></a>) and then put the
                   6064:           following into your <code xmlns=
                   6065:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      6066:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    6067:           <pre class="programlisting">
1.51      rillig   6068:     .if exists(${LOCALBASE}/bin/sudo)
                   6069:     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   6070:     .endif
1.1       grant    6071: </pre>
                   6072:         </div>
                   6073: 
1.67      hubertf  6074:         <div class="sect1" lang="en">
1.1       grant    6075:           <div class="titlepage">
                   6076:             <div>
                   6077:               <div>
                   6078:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  6079:                 "faq.conf"></a>7.14.&nbsp;How do I change the
                   6080:                 location of configuration files?</h2>
1.1       grant    6081:               </div>
                   6082:             </div>
                   6083:           </div>
                   6084: 
1.35      jmmv     6085:           <p>As the system administrator, you can choose where
                   6086:           configuration files are installed. The default settings
1.45      wiz      6087:           make all these files go into <code xmlns=
                   6088:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     6089:           "filename">${PREFIX}/etc</code> or some of its
                   6090:           subdirectories; this may be suboptimal depending on your
                   6091:           expectations (e.g., a read-only, NFS-exported
                   6092:           <code class="varname">PREFIX</code> with a need of
                   6093:           per-machine configuration of the provided packages).</p>
                   6094: 
                   6095:           <p>In order to change the defaults, you can modify the
                   6096:           <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.45      wiz      6097:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6098:           class="filename">/etc/mk.conf</code>) to point to your
                   6099:           preferred configuration directory; some common examples
                   6100:           include <code xmlns=
                   6101:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6102:           "filename">/etc</code> or <code xmlns=
                   6103:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6104:           "filename">/etc/pkg</code>.</p>
1.35      jmmv     6105: 
                   6106:           <p>Furthermore, you can change this value on a
                   6107:           per-package basis by setting the <code class=
                   6108:           "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   6109:           variable. <code class="varname">PKG_SYSCONFVAR</code>'s
                   6110:           value usually matches the name of the package you would
                   6111:           like to modify, that is, the contents of <code class=
                   6112:           "varname">PKGBASE</code>.</p>
1.1       grant    6113: 
1.47      reed     6114:           <p>Note that after changing these settings, you must
1.35      jmmv     6115:           rebuild and reinstall any affected packages.</p>
1.1       grant    6116:         </div>
                   6117: 
1.67      hubertf  6118:         <div class="sect1" lang="en">
1.1       grant    6119:           <div class="titlepage">
                   6120:             <div>
                   6121:               <div>
                   6122:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    6123:                 "audit-packages"></a>7.15.&nbsp;Automated security
1.1       grant    6124:                 checks</h2>
                   6125:               </div>
                   6126:             </div>
                   6127:           </div>
                   6128: 
                   6129:           <p>Please be aware that there can often be bugs in
                   6130:           third-party software, and some of these bugs can leave a
                   6131:           machine vulnerable to exploitation by attackers. In an
                   6132:           effort to lessen the exposure, the NetBSD packages team
                   6133:           maintains a database of known-exploits to packages which
                   6134:           have at one time been included in pkgsrc. The database
                   6135:           can be downloaded automatically, and a security audit of
                   6136:           all packages installed on a system can take place. To do
                   6137:           this, install the <a xmlns=
                   6138:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6139:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      6140:           target="_top"><code xmlns="" class=
                   6141:           "filename">security/audit-packages</code></a> package. It
1.20      ben      6142:           has two components:</p>
1.1       grant    6143: 
                   6144:           <div class="orderedlist">
                   6145:             <ol type="1">
                   6146:               <li>
1.34      wiz      6147:                 <p><span><strong class=
                   6148:                 "command">download-vulnerability-list</strong></span>,
1.1       grant    6149:                 an easy way to download a list of the security
                   6150:                 vulnerabilities information. This list is kept up
                   6151:                 to date by the NetBSD security officer and the
                   6152:                 NetBSD packages team, and is distributed from the
                   6153:                 NetBSD ftp server:</p>
                   6154: 
                   6155:                 <p><a href=
                   6156:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      6157:                 target=
                   6158:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    6159:               </li>
                   6160: 
                   6161:               <li>
1.34      wiz      6162:                 <p><span><strong class=
                   6163:                 "command">audit-packages</strong></span>, an easy
                   6164:                 way to audit the current machine, checking each
1.1       grant    6165:                 vulnerability which is known. If a vulnerable
                   6166:                 package is installed, it will be shown by output to
                   6167:                 stdout, including a description of the type of
                   6168:                 vulnerability, and a URL containing more
                   6169:                 information.</p>
                   6170:               </li>
                   6171:             </ol>
                   6172:           </div>
                   6173: 
1.23      wiz      6174:           <p>Use of the <a xmlns=
                   6175:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6176:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.45      wiz      6177:           target="_top"><code xmlns="" class=
                   6178:           "filename">security/audit-packages</code></a> package is
1.23      wiz      6179:           strongly recommended! After &#8220;<span class=
                   6180:           "quote">audit-packages</span>&#8221; is installed, please
                   6181:           read the package's message, which you can get by running
                   6182:           <strong class="userinput"><code>pkg_info -D
1.65      hubertf  6183:           audit-packages</code></strong>.</p>
1.58      erh      6184: 
                   6185:           <p>If this package is installed, pkgsrc builds will use
                   6186:           it to perform a security check before building any
                   6187:           package. See <a href="#variables-affecting-build" title=
                   6188:           "5.2.&nbsp;Variables affecting the build process">Section&nbsp;5.2,
                   6189:           &#8220;Variables affecting the build process&#8221;</a>
1.59      rillig   6190:           for ways to control this check.</p>
1.1       grant    6191:         </div>
                   6192:       </div>
                   6193:     </div>
                   6194: 
1.67      hubertf  6195:     <div class="part" lang="en">
1.1       grant    6196:       <div class="titlepage">
                   6197:         <div>
                   6198:           <div>
1.67      hubertf  6199:             <h1 class="title"><a name=
1.48      dillo    6200:             "developers-guide"></a>Part&nbsp;II.&nbsp;The pkgsrc
                   6201:             developer's guide</h1>
1.1       grant    6202:           </div>
                   6203:         </div>
                   6204:       </div>
                   6205: 
                   6206:       <div class="toc">
                   6207:         <p><b>Table of Contents</b></p>
                   6208: 
                   6209:         <dl>
1.38      dillo    6210:           <dt><span class="chapter"><a href="#components">8.
1.27      rillig   6211:           Package components - files, directories and
                   6212:           contents</a></span></dt>
                   6213: 
                   6214:           <dd>
                   6215:             <dl>
                   6216:               <dt><span class="sect1"><a href=
1.45      wiz      6217:               "#components.Makefile">8.1. <code xmlns=
                   6218:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6219:               "filename">Makefile</code></a></span></dt>
                   6220: 
                   6221:               <dt><span class="sect1"><a href=
1.45      wiz      6222:               "#components.distinfo">8.2. <code xmlns=
                   6223:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6224:               "filename">distinfo</code></a></span></dt>
                   6225: 
                   6226:               <dt><span class="sect1"><a href=
1.38      dillo    6227:               "#components.patches">8.3. patches/*</a></span></dt>
1.27      rillig   6228: 
1.30      wiz      6229:               <dt><span class="sect1"><a href=
1.38      dillo    6230:               "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6231:               files</a></span></dt>
1.27      rillig   6232: 
                   6233:               <dt><span class="sect1"><a href=
1.38      dillo    6234:               "#components.optional">8.5. Optional
1.27      rillig   6235:               files</a></span></dt>
                   6236: 
1.38      dillo    6237:               <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6238:               <code xmlns=
                   6239:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6240:               "filename">work*</code></a></span></dt>
1.27      rillig   6241: 
1.38      dillo    6242:               <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6243:               <code xmlns=
                   6244:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6245:               "filename">files/*</code></a></span></dt>
1.27      rillig   6246:             </dl>
                   6247:           </dd>
                   6248: 
1.38      dillo    6249:           <dt><span class="chapter"><a href="#makefile">9.
1.45      wiz      6250:           Programming in <code xmlns=
                   6251:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6252:           "filename">Makefile</code>s</a></span></dt>
                   6253: 
                   6254:           <dd>
                   6255:             <dl>
                   6256:               <dt><span class="sect1"><a href=
1.45      wiz      6257:               "#makefile.variables">9.1. <code xmlns=
                   6258:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.25      rillig   6259:               "filename">Makefile</code> variables</a></span></dt>
                   6260: 
1.27      rillig   6261:               <dd>
                   6262:                 <dl>
                   6263:                   <dt><span class="sect2"><a href=
1.38      dillo    6264:                   "#makefile.variables.names">9.1.1. Naming
1.27      rillig   6265:                   conventions</a></span></dt>
                   6266:                 </dl>
                   6267:               </dd>
                   6268: 
1.38      dillo    6269:               <dt><span class="sect1"><a href="#makefile.code">9.2.
1.25      rillig   6270:               Code snippets</a></span></dt>
                   6271: 
                   6272:               <dd>
                   6273:                 <dl>
                   6274:                   <dt><span class="sect2"><a href=
1.38      dillo    6275:                   "#adding-to-list">9.2.1. Adding things to a
1.25      rillig   6276:                   list</a></span></dt>
                   6277: 
                   6278:                   <dt><span class="sect2"><a href=
1.38      dillo    6279:                   "#converting-internal-to-external">9.2.2.
1.30      wiz      6280:                   Converting an internal list into an external
                   6281:                   list</a></span></dt>
1.25      rillig   6282: 
                   6283:                   <dt><span class="sect2"><a href=
1.38      dillo    6284:                   "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      6285:                   variables to a shell command</a></span></dt>
1.27      rillig   6286: 
                   6287:                   <dt><span class="sect2"><a href=
1.38      dillo    6288:                   "#quoting-guideline">9.2.4. Quoting
1.27      rillig   6289:                   guideline</a></span></dt>
                   6290: 
                   6291:                   <dt><span class="sect2"><a href=
1.38      dillo    6292:                   "#bsd-make-bug-workaround">9.2.5. Workaround for
1.30      wiz      6293:                   a bug in BSD Make</a></span></dt>
1.25      rillig   6294:                 </dl>
                   6295:               </dd>
                   6296:             </dl>
                   6297:           </dd>
                   6298: 
1.38      dillo    6299:           <dt><span class="chapter"><a href="#plist">10. PLIST
1.1       grant    6300:           issues</a></span></dt>
                   6301: 
                   6302:           <dd>
                   6303:             <dl>
1.38      dillo    6304:               <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    6305:               ID</a></span></dt>
                   6306: 
1.30      wiz      6307:               <dt><span class="sect1"><a href=
1.38      dillo    6308:               "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      6309:               <code xmlns=
                   6310:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   6311:               "filename">PLIST</code> generation</a></span></dt>
1.1       grant    6312: 
1.38      dillo    6313:               <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  6314:               Tweaking output of <span><strong class="command">make
                   6315:               print-PLIST</strong></span></a></span></dt>
1.1       grant    6316: 
1.38      dillo    6317:               <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    6318:               Variable substitution in PLIST</a></span></dt>
                   6319: 
1.30      wiz      6320:               <dt><span class="sect1"><a href=
1.48      dillo    6321:               "#manpage-compression">10.5. Man page
                   6322:               compression</a></span></dt>
1.1       grant    6323: 
1.30      wiz      6324:               <dt><span class="sect1"><a href=
1.38      dillo    6325:               "#using-PLIST_SRC">10.6. Changing PLIST source with
1.30      wiz      6326:               <code class=
1.14      xtraeme  6327:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6328: 
1.30      wiz      6329:               <dt><span class="sect1"><a href=
1.47      reed     6330:               "#platform-specific-plist">10.7. Platform-specific
1.38      dillo    6331:               and differing PLISTs</a></span></dt>
1.1       grant    6332: 
                   6333:               <dt><span class="sect1"><a href=
1.38      dillo    6334:               "#faq.common-dirs">10.8. Sharing directories between
1.1       grant    6335:               packages</a></span></dt>
                   6336:             </dl>
                   6337:           </dd>
                   6338: 
1.38      dillo    6339:           <dt><span class="chapter"><a href="#buildlink">11.
1.1       grant    6340:           Buildlink methodology</a></span></dt>
                   6341: 
                   6342:           <dd>
                   6343:             <dl>
1.30      wiz      6344:               <dt><span class="sect1"><a href=
1.38      dillo    6345:               "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      6346:               to use buildlink3</a></span></dt>
1.1       grant    6347: 
1.30      wiz      6348:               <dt><span class="sect1"><a href=
1.45      wiz      6349:               "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   6350:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6351:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6352: 
                   6353:               <dd>
                   6354:                 <dl>
                   6355:                   <dt><span class="sect2"><a href=
1.38      dillo    6356:                   "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      6357:                   buildlink3.mk file</a></span></dt>
1.1       grant    6358: 
                   6359:                   <dt><span class="sect2"><a href=
1.38      dillo    6360:                   "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      6361:                   <code class=
1.67      hubertf  6362:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6363:                   in <code xmlns=
1.45      wiz      6364:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6365:                   "filename">buildlink3.mk</code>
1.1       grant    6366:                   files</a></span></dt>
                   6367:                 </dl>
                   6368:               </dd>
                   6369: 
1.30      wiz      6370:               <dt><span class="sect1"><a href=
1.45      wiz      6371:               "#writing-builtin.mk">11.3. Writing <code xmlns=
                   6372:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      6373:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6374: 
                   6375:               <dd>
                   6376:                 <dl>
                   6377:                   <dt><span class="sect2"><a href=
1.38      dillo    6378:                   "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      6379:                   <code xmlns=
                   6380:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   6381:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6382: 
                   6383:                   <dt><span class="sect2"><a href=
1.38      dillo    6384:                   "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      6385:                   preferences for native or pkgsrc
                   6386:                   software</a></span></dt>
1.1       grant    6387:                 </dl>
                   6388:               </dd>
                   6389:             </dl>
                   6390:           </dd>
                   6391: 
1.38      dillo    6392:           <dt><span class="chapter"><a href="#pkginstall">12. The
1.35      jmmv     6393:           pkginstall framework</a></span></dt>
                   6394: 
                   6395:           <dd>
                   6396:             <dl>
                   6397:               <dt><span class="sect1"><a href=
1.38      dillo    6398:               "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     6399:               directories outside the installation
                   6400:               prefix</a></span></dt>
                   6401: 
                   6402:               <dd>
                   6403:                 <dl>
                   6404:                   <dt><span class="sect2"><a href=
1.38      dillo    6405:                   "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     6406:                   manipulation</a></span></dt>
                   6407: 
                   6408:                   <dt><span class="sect2"><a href=
1.38      dillo    6409:                   "#files-outside-prefix">12.1.2. File
1.35      jmmv     6410:                   manipulation</a></span></dt>
                   6411:                 </dl>
                   6412:               </dd>
                   6413: 
1.38      dillo    6414:               <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     6415:               Configuration files</a></span></dt>
                   6416: 
                   6417:               <dd>
                   6418:                 <dl>
                   6419:                   <dt><span class="sect2"><a href=
1.38      dillo    6420:                   "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     6421:                   "varname">PKG_SYSCONFDIR</code> is
                   6422:                   set</a></span></dt>
                   6423: 
                   6424:                   <dt><span class="sect2"><a href=
1.38      dillo    6425:                   "#conf-files-configure">12.2.2. Telling the
1.47      reed     6426:                   software where configuration files
1.35      jmmv     6427:                   are</a></span></dt>
                   6428: 
                   6429:                   <dt><span class="sect2"><a href=
1.38      dillo    6430:                   "#conf-files-patching">12.2.3. Patching
1.35      jmmv     6431:                   installations</a></span></dt>
                   6432: 
                   6433:                   <dt><span class="sect2"><a href=
1.38      dillo    6434:                   "#conf-files-disable">12.2.4. Disabling handling
1.35      jmmv     6435:                   of configuration files</a></span></dt>
                   6436:                 </dl>
                   6437:               </dd>
                   6438: 
1.38      dillo    6439:               <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     6440:               System startup scripts</a></span></dt>
                   6441: 
                   6442:               <dd>
                   6443:                 <dl>
                   6444:                   <dt><span class="sect2"><a href=
1.38      dillo    6445:                   "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     6446:                   of system startup scripts</a></span></dt>
                   6447:                 </dl>
                   6448:               </dd>
                   6449: 
                   6450:               <dt><span class="sect1"><a href=
1.38      dillo    6451:               "#users-and-groups">12.4. System users and
1.35      jmmv     6452:               groups</a></span></dt>
                   6453: 
1.38      dillo    6454:               <dt><span class="sect1"><a href="#shells">12.5.
1.35      jmmv     6455:               System shells</a></span></dt>
                   6456: 
                   6457:               <dd>
                   6458:                 <dl>
                   6459:                   <dt><span class="sect2"><a href=
1.65      hubertf  6460:                   "#shells-disable">12.5.1. Disabling shell
                   6461:                   registration</a></span></dt>
                   6462:                 </dl>
                   6463:               </dd>
                   6464: 
                   6465:               <dt><span class="sect1"><a href="#fonts">12.6.
                   6466:               Fonts</a></span></dt>
                   6467: 
                   6468:               <dd>
                   6469:                 <dl>
                   6470:                   <dt><span class="sect2"><a href=
                   6471:                   "#fonts-disable">12.6.1. Disabling automatic
                   6472:                   update of the fonts databases</a></span></dt>
1.35      jmmv     6473:                 </dl>
                   6474:               </dd>
                   6475:             </dl>
                   6476:           </dd>
                   6477: 
1.38      dillo    6478:           <dt><span class="chapter"><a href="#options">13. Options
1.1       grant    6479:           handling</a></span></dt>
                   6480: 
                   6481:           <dd>
                   6482:             <dl>
1.30      wiz      6483:               <dt><span class="sect1"><a href=
1.38      dillo    6484:               "#global-default-options">13.1. Global default
1.30      wiz      6485:               options</a></span></dt>
1.1       grant    6486: 
1.30      wiz      6487:               <dt><span class="sect1"><a href=
1.38      dillo    6488:               "#converting-to-options">13.2. Converting packages to
1.45      wiz      6489:               use <code xmlns=
                   6490:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  6491:               "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    6492: 
                   6493:               <dt><span class="sect1"><a href="#option-names">13.3.
                   6494:               Option Names</a></span></dt>
1.1       grant    6495:             </dl>
                   6496:           </dd>
                   6497: 
1.38      dillo    6498:           <dt><span class="chapter"><a href="#build">14. The build
1.1       grant    6499:           process</a></span></dt>
                   6500: 
                   6501:           <dd>
                   6502:             <dl>
1.56      rillig   6503:               <dt><span class="sect1"><a href="#build.intro">14.1.
                   6504:               Introduction</a></span></dt>
                   6505: 
                   6506:               <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    6507:               Program location</a></span></dt>
                   6508: 
1.56      rillig   6509:               <dt><span class="sect1"><a href=
                   6510:               "#build.builddirs">14.3. Directories used during the
                   6511:               build process</a></span></dt>
1.1       grant    6512: 
                   6513:               <dt><span class="sect1"><a href=
1.56      rillig   6514:               "#build.running">14.4. Running a
                   6515:               phase</a></span></dt>
                   6516: 
                   6517:               <dt><span class="sect1"><a href="#build.fetch">14.5.
                   6518:               The <span class="emphasis"><em>fetch</em></span>
                   6519:               phase</a></span></dt>
                   6520: 
                   6521:               <dt><span class="sect1"><a href=
                   6522:               "#build.checksum">14.6. The <span class=
                   6523:               "emphasis"><em>checksum</em></span>
                   6524:               phase</a></span></dt>
                   6525: 
                   6526:               <dt><span class="sect1"><a href=
                   6527:               "#build.extract">14.7. The <span class=
                   6528:               "emphasis"><em>extract</em></span>
                   6529:               phase</a></span></dt>
                   6530: 
                   6531:               <dt><span class="sect1"><a href="#build.patch">14.8.
                   6532:               The <span class="emphasis"><em>patch</em></span>
                   6533:               phase</a></span></dt>
                   6534: 
                   6535:               <dt><span class="sect1"><a href="#build.tools">14.9.
                   6536:               The <span class="emphasis"><em>tools</em></span>
                   6537:               phase</a></span></dt>
                   6538: 
                   6539:               <dt><span class="sect1"><a href=
                   6540:               "#build.wrapper">14.10. The <span class=
                   6541:               "emphasis"><em>wrapper</em></span>
                   6542:               phase</a></span></dt>
                   6543: 
                   6544:               <dt><span class="sect1"><a href=
                   6545:               "#build.configure">14.11. The <span class=
                   6546:               "emphasis"><em>configure</em></span>
                   6547:               phase</a></span></dt>
                   6548: 
                   6549:               <dt><span class="sect1"><a href="#build.build">14.12.
                   6550:               The <span class="emphasis"><em>build</em></span>
                   6551:               phase</a></span></dt>
                   6552: 
                   6553:               <dt><span class="sect1"><a href="#build.test">14.13.
                   6554:               The <span class="emphasis"><em>test</em></span>
                   6555:               phase</a></span></dt>
                   6556: 
                   6557:               <dt><span class="sect1"><a href=
                   6558:               "#build.install">14.14. The <span class=
                   6559:               "emphasis"><em>install</em></span>
                   6560:               phase</a></span></dt>
                   6561: 
                   6562:               <dt><span class="sect1"><a href=
                   6563:               "#build.package">14.15. The <span class=
                   6564:               "emphasis"><em>package</em></span>
                   6565:               phase</a></span></dt>
                   6566: 
                   6567:               <dt><span class="sect1"><a href=
                   6568:               "#build.helpful-targets">14.16. Other helpful
1.1       grant    6569:               targets</a></span></dt>
                   6570:             </dl>
                   6571:           </dd>
                   6572: 
1.68      rillig   6573:           <dt><span class="chapter"><a href="#tools">15. Tools
                   6574:           needed for building or running</a></span></dt>
                   6575: 
                   6576:           <dd>
                   6577:             <dl>
                   6578:               <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
                   6579:               Tools for pkgsrc builds</a></span></dt>
                   6580: 
                   6581:               <dt><span class="sect1"><a href=
                   6582:               "#package-tools">15.2. Tools needed by
                   6583:               packages</a></span></dt>
                   6584: 
                   6585:               <dt><span class="sect1"><a href=
                   6586:               "#platform-tools">15.3. Tools provided by
                   6587:               platforms</a></span></dt>
                   6588:             </dl>
                   6589:           </dd>
                   6590: 
                   6591:           <dt><span class="chapter"><a href="#fixes">16. Making
1.55      rillig   6592:           your package work</a></span></dt>
1.1       grant    6593: 
                   6594:           <dd>
                   6595:             <dl>
1.30      wiz      6596:               <dt><span class="sect1"><a href=
1.68      rillig   6597:               "#general-operation">16.1. General
1.30      wiz      6598:               operation</a></span></dt>
1.1       grant    6599: 
                   6600:               <dd>
                   6601:                 <dl>
                   6602:                   <dt><span class="sect2"><a href=
1.68      rillig   6603:                   "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz      6604:                   pull in variables from
                   6605:                   /etc/mk.conf</a></span></dt>
1.1       grant    6606: 
                   6607:                   <dt><span class="sect2"><a href=
1.68      rillig   6608:                   "#where-to-install-documentation">16.1.2. Where
1.31      wiz      6609:                   to install documentation</a></span></dt>
                   6610: 
                   6611:                   <dt><span class="sect2"><a href=
1.68      rillig   6612:                   "#restricted-packages">16.1.3. Restricted
1.1       grant    6613:                   packages</a></span></dt>
                   6614: 
                   6615:                   <dt><span class="sect2"><a href=
1.68      rillig   6616:                   "#dependencies">16.1.4. Handling
1.1       grant    6617:                   dependencies</a></span></dt>
                   6618: 
                   6619:                   <dt><span class="sect2"><a href=
1.68      rillig   6620:                   "#conflicts">16.1.5. Handling conflicts with
1.1       grant    6621:                   other packages</a></span></dt>
                   6622: 
                   6623:                   <dt><span class="sect2"><a href=
1.68      rillig   6624:                   "#not-building-packages">16.1.6. Packages that
1.30      wiz      6625:                   cannot or should not be built</a></span></dt>
1.1       grant    6626: 
                   6627:                   <dt><span class="sect2"><a href=
1.68      rillig   6628:                   "#undeletable-packages">16.1.7. Packages which
1.30      wiz      6629:                   should not be deleted, once
                   6630:                   installed</a></span></dt>
1.1       grant    6631: 
                   6632:                   <dt><span class="sect2"><a href=
1.68      rillig   6633:                   "#security-handling">16.1.8. Handling packages
1.1       grant    6634:                   with security problems</a></span></dt>
                   6635: 
                   6636:                   <dt><span class="sect2"><a href=
1.68      rillig   6637:                   "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant    6638:                   bugs</a></span></dt>
                   6639: 
                   6640:                   <dt><span class="sect2"><a href=
1.68      rillig   6641:                   "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz      6642:                   incrementing versions when fixing an existing
1.1       grant    6643:                   package</a></span></dt>
                   6644: 
                   6645:                   <dt><span class="sect2"><a href=
1.68      rillig   6646:                   "#portability-of-packages">16.1.11. Portability
1.30      wiz      6647:                   of packages</a></span></dt>
1.1       grant    6648:                 </dl>
                   6649:               </dd>
                   6650: 
1.30      wiz      6651:               <dt><span class="sect1"><a href=
1.68      rillig   6652:               "#downloading-issues">16.2. Possible downloading
1.30      wiz      6653:               issues</a></span></dt>
1.1       grant    6654: 
                   6655:               <dd>
                   6656:                 <dl>
                   6657:                   <dt><span class="sect2"><a href=
1.68      rillig   6658:                   "#no-plain-download">16.2.1. Packages whose
1.30      wiz      6659:                   distfiles aren't available for plain
1.1       grant    6660:                   downloading</a></span></dt>
                   6661: 
                   6662:                   <dt><span class="sect2"><a href=
1.68      rillig   6663:                   "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz      6664:                   handle modified distfiles with the 'old'
                   6665:                   name</a></span></dt>
1.1       grant    6666:                 </dl>
                   6667:               </dd>
                   6668: 
1.30      wiz      6669:               <dt><span class="sect1"><a href=
1.68      rillig   6670:               "#configuration-gotchas">16.3. Configuration
1.30      wiz      6671:               gotchas</a></span></dt>
1.1       grant    6672: 
                   6673:               <dd>
                   6674:                 <dl>
                   6675:                   <dt><span class="sect2"><a href=
1.68      rillig   6676:                   "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant    6677:                   libtool</a></span></dt>
                   6678: 
                   6679:                   <dt><span class="sect2"><a href=
1.68      rillig   6680:                   "#using-libtool">16.3.2. Using libtool on GNU
1.1       grant    6681:                   packages that already support
                   6682:                   libtool</a></span></dt>
                   6683: 
                   6684:                   <dt><span class="sect2"><a href=
1.68      rillig   6685:                   "#autoconf-automake">16.3.3. GNU
1.1       grant    6686:                   Autoconf/Automake</a></span></dt>
                   6687:                 </dl>
                   6688:               </dd>
                   6689: 
1.68      rillig   6690:               <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55      rillig   6691:               Building the package</a></span></dt>
1.1       grant    6692: 
                   6693:               <dd>
                   6694:                 <dl>
                   6695:                   <dt><span class="sect2"><a href=
1.68      rillig   6696:                   "#cpp-defines">16.4.1. CPP
1.30      wiz      6697:                   defines</a></span></dt>
1.51      rillig   6698: 
                   6699:                   <dt><span class="sect2"><a href=
1.68      rillig   6700:                   "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig   6701:                   defines for some platforms</a></span></dt>
                   6702: 
                   6703:                   <dt><span class="sect2"><a href=
1.68      rillig   6704:                   "#cpp-list">16.4.3. Getting a list of CPP
1.51      rillig   6705:                   defines</a></span></dt>
1.1       grant    6706:                 </dl>
                   6707:               </dd>
                   6708: 
1.30      wiz      6709:               <dt><span class="sect1"><a href=
1.68      rillig   6710:               "#package-specific-actions">16.5. Package specific
1.30      wiz      6711:               actions</a></span></dt>
1.1       grant    6712: 
                   6713:               <dd>
                   6714:                 <dl>
                   6715:                   <dt><span class="sect2"><a href=
1.68      rillig   6716:                   "#user-interaction">16.5.1. User
1.2       hubertf  6717:                   interaction</a></span></dt>
1.1       grant    6718: 
                   6719:                   <dt><span class="sect2"><a href=
1.68      rillig   6720:                   "#handling-licenses">16.5.2. Handling
1.1       grant    6721:                   licenses</a></span></dt>
                   6722: 
                   6723:                   <dt><span class="sect2"><a href=
1.68      rillig   6724:                   "#installing-score-files">16.5.3. Installing
1.30      wiz      6725:                   score files</a></span></dt>
1.1       grant    6726: 
                   6727:                   <dt><span class="sect2"><a href=
1.68      rillig   6728:                   "#perl-scripts">16.5.4. Packages containing perl
1.1       grant    6729:                   scripts</a></span></dt>
                   6730: 
                   6731:                   <dt><span class="sect2"><a href=
1.68      rillig   6732:                   "#hardcoded-paths">16.5.5. Packages with
1.30      wiz      6733:                   hardcoded paths to other
                   6734:                   interpreters</a></span></dt>
1.1       grant    6735: 
                   6736:                   <dt><span class="sect2"><a href=
1.68      rillig   6737:                   "#perl-modules">16.5.6. Packages installing perl
1.1       grant    6738:                   modules</a></span></dt>
                   6739: 
                   6740:                   <dt><span class="sect2"><a href=
1.68      rillig   6741:                   "#faq.info-files">16.5.7. Packages installing
1.1       grant    6742:                   info files</a></span></dt>
                   6743: 
                   6744:                   <dt><span class="sect2"><a href=
1.68      rillig   6745:                   "#manpages">16.5.8. Packages installing man
1.57      minskim  6746:                   pages</a></span></dt>
                   6747: 
                   6748:                   <dt><span class="sect2"><a href=
1.68      rillig   6749:                   "#gconf2-data-files">16.5.9. Packages installing
1.30      wiz      6750:                   GConf2 data files</a></span></dt>
1.1       grant    6751: 
                   6752:                   <dt><span class="sect2"><a href=
1.68      rillig   6753:                   "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz      6754:                   installing scrollkeeper data
                   6755:                   files</a></span></dt>
1.1       grant    6756: 
                   6757:                   <dt><span class="sect2"><a href=
1.68      rillig   6758:                   "#x11-fonts">16.5.11. Packages installing X11
1.1       grant    6759:                   fonts</a></span></dt>
                   6760: 
                   6761:                   <dt><span class="sect2"><a href=
1.68      rillig   6762:                   "#gtk2-modules">16.5.12. Packages installing GTK2
1.1       grant    6763:                   modules</a></span></dt>
                   6764: 
                   6765:                   <dt><span class="sect2"><a href=
1.68      rillig   6766:                   "#sgml-xml-data">16.5.13. Packages installing
1.30      wiz      6767:                   SGML or XML data</a></span></dt>
1.1       grant    6768: 
                   6769:                   <dt><span class="sect2"><a href=
1.68      rillig   6770:                   "#mime-database">16.5.14. Packages installing
1.1       grant    6771:                   extensions to the MIME database</a></span></dt>
                   6772: 
                   6773:                   <dt><span class="sect2"><a href=
1.68      rillig   6774:                   "#intltool">16.5.15. Packages using
1.1       grant    6775:                   intltool</a></span></dt>
1.18      xtraeme  6776: 
                   6777:                   <dt><span class="sect2"><a href=
1.68      rillig   6778:                   "#startup-scripts">16.5.16. Packages installing
1.30      wiz      6779:                   startup scripts</a></span></dt>
1.57      minskim  6780: 
                   6781:                   <dt><span class="sect2"><a href=
1.68      rillig   6782:                   "#tex-packages">16.5.17. Packages installing TeX
1.57      minskim  6783:                   modules</a></span></dt>
1.1       grant    6784:                 </dl>
                   6785:               </dd>
                   6786: 
1.30      wiz      6787:               <dt><span class="sect1"><a href=
1.68      rillig   6788:               "#feedback-to-author">16.6. Feedback to the
1.30      wiz      6789:               author</a></span></dt>
1.1       grant    6790:             </dl>
                   6791:           </dd>
                   6792: 
1.68      rillig   6793:           <dt><span class="chapter"><a href="#debug">17.
1.1       grant    6794:           Debugging</a></span></dt>
                   6795: 
1.68      rillig   6796:           <dt><span class="chapter"><a href="#submit">18.
1.1       grant    6797:           Submitting and Committing</a></span></dt>
                   6798: 
                   6799:           <dd>
                   6800:             <dl>
1.30      wiz      6801:               <dt><span class="sect1"><a href=
1.68      rillig   6802:               "#submitting-your-package">18.1. Submitting your
1.30      wiz      6803:               packages</a></span></dt>
1.1       grant    6804: 
1.30      wiz      6805:               <dt><span class="sect1"><a href=
1.68      rillig   6806:               "#general-notes-for-changes">18.2. General notes when
1.41      wiz      6807:               adding, updating, or removing
                   6808:               packages</a></span></dt>
                   6809: 
                   6810:               <dt><span class="sect1"><a href=
1.68      rillig   6811:               "#committing-importing">18.3. Committing: Importing a
1.30      wiz      6812:               package into CVS</a></span></dt>
1.1       grant    6813: 
1.30      wiz      6814:               <dt><span class="sect1"><a href=
1.68      rillig   6815:               "#updating-package">18.4. Updating a package to a
1.30      wiz      6816:               newer version</a></span></dt>
1.1       grant    6817: 
1.30      wiz      6818:               <dt><span class="sect1"><a href=
1.68      rillig   6819:               "#moving-package">18.5. Moving a package in
1.30      wiz      6820:               pkgsrc</a></span></dt>
1.1       grant    6821:             </dl>
                   6822:           </dd>
1.69      rillig   6823: 
                   6824:           <dt><span class="chapter"><a href="#porting">19. Porting
                   6825:           pkgsrc</a></span></dt>
                   6826: 
                   6827:           <dd>
                   6828:             <dl>
                   6829:               <dt><span class="sect1"><a href=
                   6830:               "#porting.opsys">19.1. Porting pkgsrc to a new
                   6831:               operating system</a></span></dt>
                   6832: 
                   6833:               <dt><span class="sect1"><a href=
                   6834:               "#porting.compiler">19.2. Adding support for a new
                   6835:               compiler</a></span></dt>
                   6836:             </dl>
                   6837:           </dd>
1.1       grant    6838:         </dl>
                   6839:       </div>
                   6840: 
1.67      hubertf  6841:       <div class="chapter" lang="en">
1.1       grant    6842:         <div class="titlepage">
                   6843:           <div>
                   6844:             <div>
1.67      hubertf  6845:               <h2 class="title"><a name=
1.38      dillo    6846:               "components"></a>Chapter&nbsp;8.&nbsp;Package
1.27      rillig   6847:               components - files, directories and contents</h2>
1.25      rillig   6848:             </div>
                   6849:           </div>
                   6850:         </div>
                   6851: 
                   6852:         <div class="toc">
                   6853:           <p><b>Table of Contents</b></p>
                   6854: 
                   6855:           <dl>
                   6856:             <dt><span class="sect1"><a href=
1.45      wiz      6857:             "#components.Makefile">8.1. <code xmlns=
                   6858:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6859:             "filename">Makefile</code></a></span></dt>
                   6860: 
                   6861:             <dt><span class="sect1"><a href=
1.45      wiz      6862:             "#components.distinfo">8.2. <code xmlns=
                   6863:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6864:             "filename">distinfo</code></a></span></dt>
                   6865: 
                   6866:             <dt><span class="sect1"><a href=
1.38      dillo    6867:             "#components.patches">8.3. patches/*</a></span></dt>
1.25      rillig   6868: 
1.30      wiz      6869:             <dt><span class="sect1"><a href=
1.38      dillo    6870:             "#other-mandatory-files">8.4. Other mandatory
1.30      wiz      6871:             files</a></span></dt>
1.25      rillig   6872: 
1.27      rillig   6873:             <dt><span class="sect1"><a href=
1.38      dillo    6874:             "#components.optional">8.5. Optional
1.27      rillig   6875:             files</a></span></dt>
1.25      rillig   6876: 
1.38      dillo    6877:             <dt><span class="sect1"><a href="#work-dir">8.6.
1.45      wiz      6878:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6879:             class="filename">work*</code></a></span></dt>
1.25      rillig   6880: 
1.38      dillo    6881:             <dt><span class="sect1"><a href="#files-dir">8.7.
1.45      wiz      6882:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6883:             class="filename">files/*</code></a></span></dt>
1.25      rillig   6884:           </dl>
                   6885:         </div>
                   6886: 
1.27      rillig   6887:         <p>Whenever you're preparing a package, there are a number
                   6888:         of files involved which are described in the following
                   6889:         sections.</p>
1.25      rillig   6890: 
1.67      hubertf  6891:         <div class="sect1" lang="en">
1.25      rillig   6892:           <div class="titlepage">
                   6893:             <div>
                   6894:               <div>
                   6895:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      6896:                 "components.Makefile"></a>8.1.&nbsp;<code xmlns=
                   6897:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6898:                 "filename">Makefile</code></h2>
1.25      rillig   6899:               </div>
                   6900:             </div>
                   6901:           </div>
                   6902: 
1.27      rillig   6903:           <p>Building, installation and creation of a binary
1.45      wiz      6904:           package are all controlled by the package's <code xmlns=
                   6905:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6906:           "filename">Makefile</code>. The <code xmlns=
                   6907:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   6908:           "filename">Makefile</code> describes various things about
                   6909:           a package, for example from where to get it, how to
                   6910:           configure, build, and install it.</p>
                   6911: 
1.45      wiz      6912:           <p>A package <code xmlns=
                   6913:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   6914:           "filename">Makefile</code> contains several sections that
                   6915:           describe the package.</p>
1.25      rillig   6916: 
1.27      rillig   6917:           <p>In the first section there are the following
                   6918:           variables, which should appear exactly in the order given
                   6919:           here.</p>
1.25      rillig   6920: 
                   6921:           <div class="itemizedlist">
                   6922:             <ul type="disc">
                   6923:               <li>
1.27      rillig   6924:                 <p><code class="varname">DISTNAME</code> is the
                   6925:                 basename of the distribution file to be downloaded
                   6926:                 from the package's website.</p>
                   6927:               </li>
                   6928: 
                   6929:               <li>
                   6930:                 <p><code class="varname">PKGNAME</code> is the name
                   6931:                 of the package, as used by pkgsrc. You only need to
1.50      rillig   6932:                 provide it if it differs from <code class=
                   6933:                 "varname">DISTNAME</code>. Usually it is the
                   6934:                 directory name together with the version number. It
                   6935:                 must match the regular expression <code class=
1.27      rillig   6936:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   6937:                 that is, it starts with a letter or digit, and
                   6938:                 contains only letters, digits, dashes, underscores,
                   6939:                 dots and plus signs.</p>
1.25      rillig   6940:               </li>
                   6941: 
                   6942:               <li>
1.27      rillig   6943:                 <p><code class="varname">CATEGORIES</code> is a
                   6944:                 list of categories which the package fits in. You
                   6945:                 can choose any of the top-level directories of
                   6946:                 pkgsrc for it.</p>
1.45      wiz      6947: 
                   6948:                 <p>Currently the following values are available for
                   6949:                 <code class="varname">CATEGORIES</code>. If more
                   6950:                 than one is used, they need to be separated by
                   6951:                 spaces:</p>
                   6952:                 <pre class="programlisting">
1.51      rillig   6953:     archivers     cross         geography     meta-pkgs     security
                   6954:     audio         databases     graphics      misc          shells
                   6955:     benchmarks    devel         ham           multimedia    sysutils
                   6956:     biology       editors       inputmethod   net           textproc
                   6957:     cad           emulators     lang          news          time
                   6958:     chat          finance       mail          parallel      wm
                   6959:     comms         fonts         math          pkgtools      www
                   6960:     converters    games         mbone         print         x11
1.45      wiz      6961: </pre>
1.25      rillig   6962:               </li>
                   6963: 
                   6964:               <li>
1.27      rillig   6965:                 <p><code class="varname">MASTER_SITES</code> is a
                   6966:                 list of URLs where the distribution files can be
                   6967:                 downloaded. Each URL must end with a slash.</p>
1.45      wiz      6968: 
                   6969:                 <p>The <code class="varname">MASTER_SITES</code>
                   6970:                 may make use of the following predefined sites:</p>
                   6971:                 <pre class="programlisting">
1.51      rillig   6972:     ${MASTER_SITE_APACHE}
                   6973:     ${MASTER_SITE_BACKUP}
                   6974:     ${MASTER_SITE_CYGWIN}
                   6975:     ${MASTER_SITE_DEBIAN}
                   6976:     ${MASTER_SITE_FREEBSD}
                   6977:     ${MASTER_SITE_FREEBSD_LOCAL}
                   6978:     ${MASTER_SITE_GNOME}
                   6979:     ${MASTER_SITE_GNU}
                   6980:     ${MASTER_SITE_GNUSTEP}
                   6981:     ${MASTER_SITE_IFARCHIVE}
                   6982:     ${MASTER_SITE_MOZILLA}
                   6983:     ${MASTER_SITE_OPENOFFICE}
                   6984:     ${MASTER_SITE_PERL_CPAN}
                   6985:     ${MASTER_SITE_R_CRAN}
                   6986:     ${MASTER_SITE_SOURCEFORGE}
                   6987:     ${MASTER_SITE_SUNSITE}
                   6988:     ${MASTER_SITE_SUSE}
                   6989:     ${MASTER_SITE_TEX_CTAN}
                   6990:     ${MASTER_SITE_XCONTRIB}
                   6991:     ${MASTER_SITE_XEMACS}
1.45      wiz      6992: </pre>
                   6993: 
                   6994:                 <p>If one of these predefined sites is chosen, you
                   6995:                 may want to specify a subdirectory of that site.
                   6996:                 Since these macros may expand to more than one
                   6997:                 actual site, you <span class=
                   6998:                 "emphasis"><em>must</em></span> use the following
                   6999:                 construct to specify a subdirectory:</p>
                   7000:                 <pre class="programlisting">
1.51      rillig   7001:     ${MASTER_SITE_GNU:=subdirectory/name/}
                   7002:     ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.45      wiz      7003: </pre>
                   7004: 
                   7005:                 <p>Note the trailing slash after the subdirectory
                   7006:                 name.</p>
                   7007: 
                   7008:                 <p>If the package has multiple <code class=
                   7009:                 "varname">DISTFILES</code> or multiple <code class=
                   7010:                 "varname">PATCHFILES</code> from different sites,
                   7011:                 set <code class="varname">SITES_foo</code> to a
1.47      reed     7012:                 list of URIs where file &#8220;<span class=
1.45      wiz      7013:                 "quote">foo</span>&#8221; may be found.
                   7014:                 &#8220;<span class="quote">foo</span>&#8221;
1.47      reed     7015:                 includes the suffix, e.g.:</p>
1.45      wiz      7016:                 <pre class="programlisting">
1.51      rillig   7017:     DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   7018:     DISTFILES+=     foo-file.tar.gz
1.69      rillig   7019:     SITES_foo-file.tar.gz= \
                   7020:             http://www.somewhere.com/somehow/ \
1.51      rillig   7021:             http://www.somewhereelse.com/mirror/somehow/
1.45      wiz      7022: </pre>
                   7023:               </li>
                   7024: 
                   7025:               <li>
                   7026:                 <p><code class="varname">DISTFILES</code>: Name(s)
                   7027:                 of archive file(s) containing distribution. The
                   7028:                 default is <code xmlns=
                   7029:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7030:                 "filename">${DISTNAME}${EXTRACT_SUFX}</code>.
                   7031:                 Should only be set if you have more than one
                   7032:                 distfile.</p>
                   7033: 
                   7034:                 <p>Note that the normal default setting of
                   7035:                 <code class="varname">DISTFILES</code> must be made
                   7036:                 explicit if you want to add to it (rather than
                   7037:                 replace it), as you usually would.</p>
                   7038:               </li>
                   7039: 
                   7040:               <li>
                   7041:                 <p><code class="varname">EXTRACT_SUFX</code>:
                   7042:                 Suffix of the distribution file, will be appended
                   7043:                 to <code class="varname">DISTNAME</code>. Defaults
                   7044:                 to <code xmlns=
                   7045:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7046:                 "filename">.tar.gz</code>.</p>
                   7047:               </li>
                   7048:             </ul>
                   7049:           </div>
                   7050: 
                   7051:           <p>The second section contains information about
                   7052:           separately downloaded patches, if any.</p>
                   7053: 
                   7054:           <div class="itemizedlist">
                   7055:             <ul type="disc">
                   7056:               <li>
1.47      reed     7057:                 <p><code class="varname">PATCHFILES:</code> Name(s)
1.45      wiz      7058:                 of additional files that contain distribution
                   7059:                 patches. There is no default. pkgsrc will look for
                   7060:                 them at <code class="varname">PATCH_SITES</code>.
                   7061:                 They will automatically be uncompressed before
                   7062:                 patching if the names end with <code xmlns=
                   7063:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7064:                 "filename">.gz</code> or <code xmlns=
                   7065:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7066:                 "filename">.Z</code>.</p>
                   7067:               </li>
                   7068: 
                   7069:               <li>
                   7070:                 <p><code class="varname">PATCH_SITES</code>:
                   7071:                 Primary location(s) for distribution patch files
                   7072:                 (see <code class="varname">PATCHFILES</code> below)
                   7073:                 if not found locally.</p>
1.25      rillig   7074:               </li>
                   7075:             </ul>
                   7076:           </div>
                   7077: 
1.45      wiz      7078:           <p>The third section contains the following
1.27      rillig   7079:           variables.</p>
1.25      rillig   7080: 
1.27      rillig   7081:           <div class="itemizedlist">
                   7082:             <ul type="disc">
                   7083:               <li>
                   7084:                 <p><code class="varname">MAINTAINER</code> is the
1.50      rillig   7085:                 email address of the person who feels responsible
                   7086:                 for this package, and who is most likely to look at
                   7087:                 problems or questions regarding this package which
                   7088:                 have been reported with <a href=
1.45      wiz      7089:                 "http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-current">
                   7090:                 <span class="citerefentry"><span class=
1.50      rillig   7091:                 "refentrytitle">send-pr</span>(1)</span></a>. Other
                   7092:                 developers should contact the <code class=
                   7093:                 "varname">MAINTAINER</code> before making major
                   7094:                 changes to the package. When packaging a new
                   7095:                 program, set <code class=
                   7096:                 "varname">MAINTAINER</code> to yourself. If you
                   7097:                 really can't maintain the package for future
                   7098:                 updates, set it to <code class="email">&lt;<a href=
1.71    ! wiz      7099:                 "mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>&gt;</code>.</p>
1.27      rillig   7100:               </li>
1.25      rillig   7101: 
1.27      rillig   7102:               <li>
                   7103:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   7104:                 where users can find more information about the
1.23      wiz      7105:                 package.</p>
                   7106:               </li>
1.1       grant    7107: 
1.23      wiz      7108:               <li>
                   7109:                 <p><code class="varname">COMMENT</code> is a
1.45      wiz      7110:                 one-line description of the package (should not
                   7111:                 include the package name).</p>
1.23      wiz      7112:               </li>
                   7113:             </ul>
                   7114:           </div>
1.1       grant    7115: 
1.45      wiz      7116:           <p>Other variables that affect the build:</p>
1.1       grant    7117: 
1.45      wiz      7118:           <div class="itemizedlist">
                   7119:             <ul type="disc">
                   7120:               <li>
                   7121:                 <p><code class="varname">WRKSRC</code>: The
1.50      rillig   7122:                 directory where the interesting distribution files
                   7123:                 of the package are found. The default is
                   7124:                 <code xmlns=
                   7125:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7126:                 "filename">${WRKDIR}/${DISTNAME}</code>, which
                   7127:                 works for most packages.</p>
                   7128: 
                   7129:                 <p>If a package doesn't create a subdirectory for
                   7130:                 itself (most GNU software does, for instance), but
                   7131:                 extracts itself in the current directory, you
                   7132:                 should set <code class="varname">WRKSRC=
                   7133:                 ${WRKDIR}</code>.</p>
                   7134: 
                   7135:                 <p>If a package doesn't create a subdirectory with
                   7136:                 the name of <code class="varname">DISTNAME</code>
                   7137:                 but some different name, set <code class=
                   7138:                 "varname">WRKSRC</code> to point to the proper name
                   7139:                 in <code xmlns=
                   7140:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7141:                 "filename">${WRKDIR}</code>, for example
                   7142:                 <code class="varname">WRKSRC=
                   7143:                 ${WRKDIR}/${DISTNAME}/unix</code>. See <a xmlns=
                   7144:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7145:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   7146:                 target="_top"><code xmlns="" class=
                   7147:                 "filename">lang/tcl</code></a> and <a xmlns=
                   7148:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7149:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   7150:                 target="_top"><code xmlns="" class=
                   7151:                 "filename">x11/tk</code></a> for other
                   7152:                 examples.</p>
                   7153: 
                   7154:                 <p>The name of the working directory created by
                   7155:                 pkgsrc is taken from the <code class=
                   7156:                 "varname">WRKDIR_BASENAME</code> variable. By
                   7157:                 default, its value is <code xmlns=
                   7158:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7159:                 "filename">work</code>. If you want to use the same
                   7160:                 pkgsrc tree for building different kinds of binary
                   7161:                 packages, you can change the variable according to
                   7162:                 your needs. Two other variables handle common cases
                   7163:                 of setting <code class=
                   7164:                 "varname">WRKDIR_BASENAME</code> individually. If
                   7165:                 <code class="varname">OBJHOSTNAME</code> is defined
                   7166:                 in <code xmlns=
1.45      wiz      7167:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   7168:                 "filename">/etc/mk.conf</code>, the first component
                   7169:                 of the host's name is attached to the directory
                   7170:                 name. If <code class="varname">OBJMACHINE</code> is
                   7171:                 defined, the platform name is attached, which might
                   7172:                 look like <code xmlns=
                   7173:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7174:                 "filename">work.i386</code> or <code xmlns=
1.45      wiz      7175:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   7176:                 "filename">work.sparc</code>.</p>
1.45      wiz      7177:               </li>
                   7178:             </ul>
1.1       grant    7179:           </div>
                   7180: 
                   7181:           <p>Please pay attention to the following gotchas:</p>
                   7182: 
                   7183:           <div class="itemizedlist">
                   7184:             <ul type="disc">
                   7185:               <li>
1.14      xtraeme  7186:                 <p>Add <code class="varname">MANCOMPRESSED</code>
1.47      reed     7187:                 if man pages are installed in compressed form by
                   7188:                 the package; see comment in <code xmlns=
1.45      wiz      7189:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7190:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    7191:               </li>
                   7192: 
                   7193:               <li>
1.45      wiz      7194:                 <p>Replace <code xmlns=
                   7195:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7196:                 "filename">/usr/local</code> with
                   7197:                 &#8220;<span class="quote">${PREFIX}</span>&#8221;
                   7198:                 in all files (see patches, below).</p>
1.1       grant    7199:               </li>
                   7200: 
                   7201:               <li>
                   7202:                 <p>If the package installs any info files, see
                   7203:                 <a href="#faq.info-files" title=
1.68      rillig   7204:                 "16.5.7.&nbsp;Packages installing info files">Section&nbsp;16.5.7,
1.45      wiz      7205:                 &#8220;Packages installing info
1.1       grant    7206:                 files&#8221;</a>.</p>
                   7207:               </li>
                   7208:             </ul>
                   7209:           </div>
                   7210:         </div>
                   7211: 
1.67      hubertf  7212:         <div class="sect1" lang="en">
1.1       grant    7213:           <div class="titlepage">
                   7214:             <div>
                   7215:               <div>
                   7216:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7217:                 "components.distinfo"></a>8.2.&nbsp;<code xmlns=
                   7218:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7219:                 "filename">distinfo</code></h2>
1.1       grant    7220:               </div>
                   7221:             </div>
                   7222:           </div>
                   7223: 
1.50      rillig   7224:           <p>The <code xmlns=
                   7225:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7226:           "filename">distinfo</code> file contains the message
                   7227:           digest, or checksum, of each distfile needed for the
                   7228:           package. This ensures that the distfiles retrieved from
                   7229:           the Internet have not been corrupted during transfer or
                   7230:           altered by a malign force to introduce a security hole.
                   7231:           Due to recent rumor about weaknesses of digest
                   7232:           algorithms, all distfiles are protected using both SHA1
                   7233:           and RMD160 message digests, as well as the file size.</p>
                   7234: 
                   7235:           <p>The <code xmlns=
                   7236:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7237:           "filename">distinfo</code> file also contains the
                   7238:           checksums for all the patches found in the <code xmlns=
                   7239:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7240:           "filename">patches</code> directory (see <a href=
                   7241:           "#components.patches" title=
                   7242:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   7243:           &#8220;patches/*&#8221;</a>).</p>
                   7244: 
                   7245:           <p>To regenerate the <code xmlns=
                   7246:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7247:           "filename">distinfo</code> file, use the
1.14      xtraeme  7248:           <span><strong class="command">make
1.50      rillig   7249:           makedistinfo</strong></span> or <span><strong class=
                   7250:           "command">make mdi</strong></span> command.</p>
1.1       grant    7251: 
1.50      rillig   7252:           <p>Some packages have different sets of distfiles
                   7253:           depending on the platform, for example <a xmlns=
1.1       grant    7254:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7255:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.45      wiz      7256:           target="_top"><code xmlns="" class=
                   7257:           "filename">www/navigator</code></a>). These are kept in
1.50      rillig   7258:           the same <code xmlns=
1.45      wiz      7259:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.50      rillig   7260:           "filename">distinfo</code> file and care should be taken
                   7261:           when upgrading such a package to ensure distfile
                   7262:           information is not lost.</p>
1.1       grant    7263:         </div>
                   7264: 
1.67      hubertf  7265:         <div class="sect1" lang="en">
1.1       grant    7266:           <div class="titlepage">
                   7267:             <div>
                   7268:               <div>
                   7269:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7270:                 "components.patches"></a>8.3.&nbsp;patches/*</h2>
1.1       grant    7271:               </div>
                   7272:             </div>
                   7273:           </div>
                   7274: 
                   7275:           <p>This directory contains files that are used by the
                   7276:           <a href=
                   7277:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   7278:           <span class="citerefentry"><span class=
                   7279:           "refentrytitle">patch</span>(1)</span></a> command to
                   7280:           modify the sources as distributed in the distribution
                   7281:           file into a form that will compile and run perfectly on
                   7282:           NetBSD. The files are applied successively in alphabetic
                   7283:           order (as returned by a shell &#8220;<span class=
                   7284:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.45      wiz      7285:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7286:           class="filename">patch-aa</code> is applied before
                   7287:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7288:           class="filename">patch-ab</code>, etc.</p>
                   7289: 
                   7290:           <p>The <code xmlns=
                   7291:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7292:           "filename">patch-*</code> files should be in
                   7293:           <span><strong class="command">diff -bu</strong></span>
                   7294:           format, and apply without a fuzz to avoid problems. (To
                   7295:           force patches to apply with fuzz you can set <code class=
1.14      xtraeme  7296:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    7297:           not put changes for more than one file into a single
1.47      reed     7298:           patch file, as this will make future modifications more
1.1       grant    7299:           difficult.</p>
                   7300: 
                   7301:           <p>Similar, a file should be patched at most once, not
                   7302:           several times by several different patches. If a file
                   7303:           needs several patches, they should be combined into one
                   7304:           file.</p>
                   7305: 
                   7306:           <p>One important thing to mention is to pay attention
                   7307:           that no RCS IDs get stored in the patch files, as these
                   7308:           will cause problems when later checked into the NetBSD
1.14      xtraeme  7309:           CVS tree. Use the <span><strong class=
                   7310:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    7311:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7312:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      7313:           target="_top"><code xmlns="" class=
                   7314:           "filename">pkgtools/pkgdiff</code></a> package to avoid
1.20      ben      7315:           these problems.</p>
1.1       grant    7316: 
                   7317:           <p>For even more automation, we recommend using
1.14      xtraeme  7318:           <span><strong class="command">mkpatches</strong></span>
                   7319:           from the same package to make a whole set of patches. You
                   7320:           just have to backup files before you edit them to
1.45      wiz      7321:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7322:           class="filename">filename.orig</code>, e.g. with
1.14      xtraeme  7323:           <span><strong class="command">cp -p filename
                   7324:           filename.orig</strong></span> or, easier, by using
                   7325:           <span><strong class="command">pkgvi</strong></span> again
                   7326:           from the same package. If you upgrade a package this way,
                   7327:           you can easily compare the new set of patches with the
                   7328:           previously existing one with <span><strong class=
                   7329:           "command">patchdiff</strong></span>.</p>
1.1       grant    7330: 
                   7331:           <p>When you have finished a package, remember to generate
                   7332:           the checksums for the patch files by using the
1.14      xtraeme  7333:           <span><strong class="command">make
                   7334:           makepatchsum</strong></span> command, see <a href=
                   7335:           "#components.distinfo" title=
1.38      dillo    7336:           "8.2.&nbsp;distinfo">Section&nbsp;8.2,
1.45      wiz      7337:           &#8220;<code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7338:           class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    7339: 
1.46      gdt      7340:           <p>When adding a patch that corrects a problem in the
                   7341:           distfile (rather than e.g. enforcing pkgsrc's view of
                   7342:           where man pages should go), send the patch as a bug
                   7343:           report to the maintainer. This benefits non-pkgsrc users
                   7344:           of the package, and usually enables removing the patch in
                   7345:           future version.</p>
                   7346: 
1.1       grant    7347:           <p>Patch files that are distributed by the author or
1.14      xtraeme  7348:           other maintainers can be listed in <code class=
                   7349:           "varname">$PATCHFILES</code>.</p>
1.1       grant    7350: 
                   7351:           <p>If it is desired to store any patches that should not
                   7352:           be committed into pkgsrc, they can be kept outside the
1.45      wiz      7353:           pkgsrc tree in the <code xmlns=
                   7354:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7355:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    7356:           tree there is expected to have the same
                   7357:           &#8220;<span class="quote">category/package</span>&#8221;
                   7358:           structure as pkgsrc, and patches are expected to be
1.45      wiz      7359:           stored inside these dirs (also known as <code xmlns=
                   7360:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     7361:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example,
                   7362:           if you want to keep a private patch for <code xmlns=
1.45      wiz      7363:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  7364:           "filename">pkgsrc/graphics/png</code>, keep it in
1.45      wiz      7365:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7366:           class=
1.14      xtraeme  7367:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   7368:           files in the named directory are expected to be patch
1.1       grant    7369:           files, and <span class="emphasis"><em>they are applied
                   7370:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   7371:         </div>
                   7372: 
1.67      hubertf  7373:         <div class="sect1" lang="en">
1.27      rillig   7374:           <div class="titlepage">
                   7375:             <div>
                   7376:               <div>
                   7377:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7378:                 "other-mandatory-files"></a>8.4.&nbsp;Other
1.27      rillig   7379:                 mandatory files</h2>
                   7380:               </div>
                   7381:             </div>
                   7382:           </div>
                   7383: 
                   7384:           <div class="variablelist">
                   7385:             <dl>
1.45      wiz      7386:               <dt><span class="term"><code xmlns=
                   7387:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7388:               "filename">DESCR</code></span></dt>
                   7389: 
                   7390:               <dd>
                   7391:                 <p>A multi-line description of the piece of
                   7392:                 software. This should include any credits where
                   7393:                 they are due. Please bear in mind that others do
                   7394:                 not share your sense of humour (or spelling
                   7395:                 idiosyncrasies), and that others will read
                   7396:                 everything that you write here.</p>
                   7397:               </dd>
                   7398: 
1.45      wiz      7399:               <dt><span class="term"><code xmlns=
                   7400:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7401:               "filename">PLIST</code></span></dt>
                   7402: 
                   7403:               <dd>
                   7404:                 <p>This file governs the files that are installed
                   7405:                 on your system: all the binaries, manual pages,
                   7406:                 etc. There are other directives which may be
                   7407:                 entered in this file, to control the creation and
                   7408:                 deletion of directories, and the location of
                   7409:                 inserted files. See <a href="#plist" title=
1.38      dillo    7410:                 "Chapter&nbsp;10.&nbsp;PLIST issues">Chapter&nbsp;10,
1.27      rillig   7411:                 <i>PLIST issues</i></a> for more information.</p>
                   7412:               </dd>
                   7413:             </dl>
                   7414:           </div>
                   7415:         </div>
                   7416: 
1.67      hubertf  7417:         <div class="sect1" lang="en">
1.27      rillig   7418:           <div class="titlepage">
                   7419:             <div>
                   7420:               <div>
                   7421:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7422:                 "components.optional"></a>8.5.&nbsp;Optional
1.27      rillig   7423:                 files</h2>
                   7424:               </div>
                   7425:             </div>
                   7426:           </div>
                   7427: 
                   7428:           <div class="variablelist">
                   7429:             <dl>
1.45      wiz      7430:               <dt><span class="term"><code xmlns=
                   7431:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7432:               "filename">INSTALL</code></span></dt>
                   7433: 
                   7434:               <dd>
                   7435:                 <p>This shell script is invoked twice by <a href=
                   7436:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7437:                 <span class="citerefentry"><span class=
                   7438:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   7439:                 time after package extraction and before files are
                   7440:                 moved in place, the second time after the files to
                   7441:                 install are moved in place. This can be used to do
                   7442:                 any custom procedures not possible with @exec
1.45      wiz      7443:                 commands in <code xmlns=
                   7444:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7445:                 "filename">PLIST</code>. See <a href=
1.27      rillig   7446:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7447:                 <span class="citerefentry"><span class=
                   7448:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   7449:                 <a href=
                   7450:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7451:                 <span class="citerefentry"><span class=
                   7452:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7453:                 more information.</p>
                   7454:               </dd>
                   7455: 
1.45      wiz      7456:               <dt><span class="term"><code xmlns=
                   7457:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7458:               "filename">DEINSTALL</code></span></dt>
                   7459: 
                   7460:               <dd>
                   7461:                 <p>This script is executed before and after any
                   7462:                 files are removed. It is this script's
                   7463:                 responsibility to clean up any additional messy
                   7464:                 details around the package's installation, since
                   7465:                 all pkg_delete knows is how to delete the files
                   7466:                 created in the original distribution. See <a href=
                   7467:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7468:                 <span class="citerefentry"><span class=
                   7469:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   7470:                 <a href=
                   7471:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   7472:                 <span class="citerefentry"><span class=
                   7473:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   7474:                 more information.</p>
                   7475:               </dd>
                   7476: 
1.45      wiz      7477:               <dt><span class="term"><code xmlns=
                   7478:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7479:               "filename">MESSAGE</code></span></dt>
                   7480: 
                   7481:               <dd>
1.50      rillig   7482:                 <p>This file is displayed after installation of the
1.27      rillig   7483:                 package. Useful for things like legal notices on
                   7484:                 almost-free software and hints for updating config
                   7485:                 files after installing modules for apache, PHP etc.
                   7486:                 Please note that you can modify variables in it
                   7487:                 easily by using <code class=
                   7488:                 "varname">MESSAGE_SUBST</code> in the package's
1.45      wiz      7489:                 <code xmlns=
                   7490:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   7491:                 "filename">Makefile</code>:</p>
1.27      rillig   7492:                 <pre class="programlisting">
1.51      rillig   7493:     MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.27      rillig   7494: </pre>
                   7495: 
                   7496:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.45      wiz      7497:                 "quote">somevalue</span>&#8221; in <code xmlns=
                   7498:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7499:                 "filename">MESSAGE</code>.</p>
                   7500:               </dd>
                   7501:             </dl>
                   7502:           </div>
                   7503:         </div>
                   7504: 
1.67      hubertf  7505:         <div class="sect1" lang="en">
1.27      rillig   7506:           <div class="titlepage">
                   7507:             <div>
                   7508:               <div>
                   7509:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  7510:                 "work-dir"></a>8.6.&nbsp;<code xmlns=
1.45      wiz      7511:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7512:                 "filename">work*</code></h2>
                   7513:               </div>
                   7514:             </div>
                   7515:           </div>
                   7516: 
                   7517:           <p>When you type <span><strong class=
1.47      reed     7518:           "command">make</strong></span>, the distribution files
                   7519:           are unpacked into the directory denoted by <code class=
1.45      wiz      7520:           "varname">WRKDIR</code>. It can be removed by running
                   7521:           <span><strong class="command">make clean</strong></span>.
                   7522:           Besides the sources, this directory is also used to keep
                   7523:           various timestamp files. The directory gets <span class=
                   7524:           "emphasis"><em>removed completely</em></span> on clean.
                   7525:           The default is <code xmlns=
                   7526:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7527:           "filename">${.CURDIR}/work</code> or <code xmlns=
                   7528:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   7529:           "filename">${.CURDIR}/work.${MACHINE_ARCH}</code> if
                   7530:           <code class="varname">OBJMACHINE</code> is set.</p>
1.27      rillig   7531:         </div>
                   7532: 
1.67      hubertf  7533:         <div class="sect1" lang="en">
1.27      rillig   7534:           <div class="titlepage">
                   7535:             <div>
                   7536:               <div>
                   7537:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7538:                 "files-dir"></a>8.7.&nbsp;<code xmlns=
                   7539:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7540:                 "filename">files/*</code></h2>
                   7541:               </div>
                   7542:             </div>
                   7543:           </div>
                   7544: 
                   7545:           <p>If you have any files that you wish to be placed in
                   7546:           the package prior to configuration or building, you could
                   7547:           place these files here and use a &#8220;<span class=
                   7548:           "quote">${CP}</span>&#8221; command in the
                   7549:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   7550:           target to achieve this. Alternatively, you could simply
1.45      wiz      7551:           diff the file against <code xmlns=
                   7552:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7553:           "filename">/dev/null</code> and use the patch mechanism
                   7554:           to manage the creation of this file.</p>
                   7555:         </div>
                   7556:       </div>
                   7557: 
1.67      hubertf  7558:       <div class="chapter" lang="en">
1.27      rillig   7559:         <div class="titlepage">
                   7560:           <div>
                   7561:             <div>
1.67      hubertf  7562:               <h2 class="title"><a name=
1.38      dillo    7563:               "makefile"></a>Chapter&nbsp;9.&nbsp;Programming in
1.45      wiz      7564:               <code xmlns=
                   7565:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   7566:               "filename">Makefile</code>s</h2>
1.27      rillig   7567:             </div>
                   7568:           </div>
                   7569:         </div>
                   7570: 
                   7571:         <div class="toc">
                   7572:           <p><b>Table of Contents</b></p>
                   7573: 
                   7574:           <dl>
                   7575:             <dt><span class="sect1"><a href=
1.45      wiz      7576:             "#makefile.variables">9.1. <code xmlns=
                   7577:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7578:             "filename">Makefile</code> variables</a></span></dt>
                   7579: 
                   7580:             <dd>
                   7581:               <dl>
                   7582:                 <dt><span class="sect2"><a href=
1.38      dillo    7583:                 "#makefile.variables.names">9.1.1. Naming
1.27      rillig   7584:                 conventions</a></span></dt>
                   7585:               </dl>
                   7586:             </dd>
                   7587: 
1.38      dillo    7588:             <dt><span class="sect1"><a href="#makefile.code">9.2.
1.27      rillig   7589:             Code snippets</a></span></dt>
                   7590: 
                   7591:             <dd>
                   7592:               <dl>
1.30      wiz      7593:                 <dt><span class="sect2"><a href=
1.38      dillo    7594:                 "#adding-to-list">9.2.1. Adding things to a
1.30      wiz      7595:                 list</a></span></dt>
1.27      rillig   7596: 
1.30      wiz      7597:                 <dt><span class="sect2"><a href=
1.38      dillo    7598:                 "#converting-internal-to-external">9.2.2.
1.27      rillig   7599:                 Converting an internal list into an external
                   7600:                 list</a></span></dt>
                   7601: 
1.30      wiz      7602:                 <dt><span class="sect2"><a href=
1.38      dillo    7603:                 "#passing-variable-to-shell">9.2.3. Passing
1.30      wiz      7604:                 variables to a shell command</a></span></dt>
1.27      rillig   7605: 
1.30      wiz      7606:                 <dt><span class="sect2"><a href=
1.38      dillo    7607:                 "#quoting-guideline">9.2.4. Quoting
1.30      wiz      7608:                 guideline</a></span></dt>
1.27      rillig   7609: 
1.30      wiz      7610:                 <dt><span class="sect2"><a href=
1.38      dillo    7611:                 "#bsd-make-bug-workaround">9.2.5. Workaround for a
1.30      wiz      7612:                 bug in BSD Make</a></span></dt>
1.27      rillig   7613:               </dl>
                   7614:             </dd>
                   7615:           </dl>
                   7616:         </div>
                   7617: 
1.45      wiz      7618:         <p>Pkgsrc consists of many <code xmlns=
                   7619:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7620:         "filename">Makefile</code> fragments, each of which forms a
                   7621:         well-defined part of the pkgsrc system. Using the <a href=
                   7622:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7623:         <span class="citerefentry"><span class=
                   7624:         "refentrytitle">make</span>(1)</span></a> system as a
                   7625:         programming language for a big system like pkgsrc requires
                   7626:         some discipline to keep the code correct and
                   7627:         understandable.</p>
                   7628: 
1.45      wiz      7629:         <p>The basic ingredients for <code xmlns=
                   7630:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7631:         "filename">Makefile</code> programming are variables (which
                   7632:         are actually macros) and shell commands. Among these shell
                   7633:         commands may even be more complex ones like <a href=
                   7634:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   7635:         <span class="citerefentry"><span class=
                   7636:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   7637:         sure that every shell command runs as intended it is
                   7638:         necessary to quote all variables correctly when they are
                   7639:         used.</p>
                   7640: 
                   7641:         <p>This chapter describes some patterns, that appear quite
1.45      wiz      7642:         often in <code xmlns=
                   7643:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   7644:         "filename">Makefile</code>s, including the pitfalls that
                   7645:         come along with them.</p>
1.27      rillig   7646: 
1.67      hubertf  7647:         <div class="sect1" lang="en">
1.27      rillig   7648:           <div class="titlepage">
                   7649:             <div>
                   7650:               <div>
                   7651:                 <h2 class="title" style="clear: both"><a name=
1.45      wiz      7652:                 "makefile.variables"></a>9.1.&nbsp;<code xmlns=
                   7653:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7654:                 "filename">Makefile</code> variables</h2>
                   7655:               </div>
                   7656:             </div>
                   7657:           </div>
                   7658: 
1.45      wiz      7659:           <p><code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7660:           class="filename">Makefile</code> variables contain
                   7661:           strings that can be processed using the five operators
                   7662:           ``='', ``+='', ``?='', ``:='', and ``!='', which are
                   7663:           described in the <a href=
1.27      rillig   7664:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7665:           <span class="citerefentry"><span class=
                   7666:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   7667: 
1.45      wiz      7668:           <p>When a variable's value is parsed from a <code xmlns=
                   7669:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.27      rillig   7670:           "filename">Makefile</code>, the hash character ``#'' and
                   7671:           the backslash character ``\'' are handled specially. If a
                   7672:           backslash is followed by a newline, any whitespace
                   7673:           immediately in front of the backslash, the backslash, the
                   7674:           newline, and any whitespace immediately behind the
                   7675:           newline are replaced with a single space. A backspace
                   7676:           character and an immediately following hash character are
1.47      reed     7677:           replaced with a single hash character. Otherwise, the
1.27      rillig   7678:           backslash is passed as is. In a variable assignment, any
                   7679:           hash character that is not preceded by a backslash starts
                   7680:           a comment that continues upto the end of the logical
                   7681:           line.</p>
                   7682: 
                   7683:           <p><span class="emphasis"><em>Note:</em></span> Because
                   7684:           of this parsing algorithm the only way to create a
                   7685:           variable consisting of a single backslash is using the
                   7686:           ``!='' operator, for example: <code class=
                   7687:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   7688: 
                   7689:           <p>So far for defining variables. The other thing you can
                   7690:           do with variables is evaluating them. A variable is
                   7691:           evaluated when it is part of the right side of the ``:=''
                   7692:           or the ``!='' operator, or directly before executing a
                   7693:           shell command which the variable is part of. In all other
1.47      reed     7694:           cases, <a href=
1.27      rillig   7695:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7696:           <span class="citerefentry"><span class=
                   7697:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   7698:           evaluation, that is, variables are not evaluated until
                   7699:           there's no other way. The ``modifiers'' mentioned in the
                   7700:           man page also evaluate the variable.</p>
                   7701: 
                   7702:           <p>Some of the modifiers split the string into words and
                   7703:           then operate on the words, others operate on the string
1.47      reed     7704:           as a whole. When a string is split into words, it is
                   7705:           split as you would expect it from <a href=
1.27      rillig   7706:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   7707:           <span class="citerefentry"><span class=
                   7708:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   7709: 
                   7710:           <p>No rule without exception&#8212;the
                   7711:           <span><strong class="command">.for</strong></span> loop
                   7712:           does not follow the shell quoting rules but splits at
                   7713:           sequences of whitespace.</p>
                   7714: 
                   7715:           <p>There are several types of variables that should be
                   7716:           handled differently. Strings and two types of lists.</p>
                   7717: 
                   7718:           <div class="itemizedlist">
                   7719:             <ul type="disc">
                   7720:               <li>
                   7721:                 <p><span class="emphasis"><em>Strings</em></span>
1.47      reed     7722:                 can contain arbitrary characters. Nevertheless, you
1.27      rillig   7723:                 should restrict yourself to only using printable
                   7724:                 characters. Examples are <code class=
                   7725:                 "varname">PREFIX</code> and <code class=
                   7726:                 "varname">COMMENT</code>.</p>
                   7727:               </li>
                   7728: 
                   7729:               <li>
                   7730:                 <p><span class="emphasis"><em>Internal
                   7731:                 lists</em></span> are lists that are never exported
                   7732:                 to any shell command. Their elements are separated
1.47      reed     7733:                 by whitespace. Therefore, the elements themselves
1.27      rillig   7734:                 cannot have embedded whitespace. Any other
                   7735:                 characters are allowed. Internal lists can be used
                   7736:                 in <span><strong class=
                   7737:                 "command">.for</strong></span> loops. Examples are
                   7738:                 <code class="varname">DEPENDS</code> and
                   7739:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   7740:               </li>
                   7741: 
                   7742:               <li>
                   7743:                 <p><span class="emphasis"><em>External
                   7744:                 lists</em></span> are lists that may be exported to
                   7745:                 a shell command. Their elements can contain any
                   7746:                 characters, including whitespace. That's why they
                   7747:                 cannot be used in <span><strong class=
                   7748:                 "command">.for</strong></span> loops. Examples are
                   7749:                 <code class="varname">DISTFILES</code> and
                   7750:                 <code class="varname">MASTER_SITES</code>.</p>
                   7751:               </li>
                   7752:             </ul>
                   7753:           </div>
                   7754: 
1.67      hubertf  7755:           <div class="sect2" lang="en">
1.27      rillig   7756:             <div class="titlepage">
                   7757:               <div>
                   7758:                 <div>
                   7759:                   <h3 class="title"><a name=
1.38      dillo    7760:                   "makefile.variables.names"></a>9.1.1.&nbsp;Naming
1.27      rillig   7761:                   conventions</h3>
                   7762:                 </div>
                   7763:               </div>
                   7764:             </div>
                   7765: 
                   7766:             <div class="itemizedlist">
                   7767:               <ul type="disc">
                   7768:                 <li>
                   7769:                   <p>All variable names starting with an underscore
                   7770:                   are reserved for use by the pkgsrc
                   7771:                   infrastructure. They shall not be used by package
1.45      wiz      7772:                   <code xmlns=
                   7773:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   7774:                   "filename">Makefile</code>s.</p>
1.27      rillig   7775:                 </li>
                   7776: 
                   7777:                 <li>
                   7778:                   <p>In <span><strong class=
                   7779:                   "command">.for</strong></span> loops you should
                   7780:                   use lowercase variable names for the iteration
                   7781:                   variables.</p>
                   7782:                 </li>
                   7783: 
                   7784:                 <li>
                   7785:                   <p>All list variables should have a ``plural''
                   7786:                   name, e.g. <code class=
                   7787:                   "varname">PKG_OPTIONS</code> or <code class=
                   7788:                   "varname">DISTFILES</code>.</p>
                   7789:                 </li>
                   7790:               </ul>
                   7791:             </div>
                   7792:           </div>
                   7793:         </div>
                   7794: 
1.67      hubertf  7795:         <div class="sect1" lang="en">
1.27      rillig   7796:           <div class="titlepage">
                   7797:             <div>
                   7798:               <div>
                   7799:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    7800:                 "makefile.code"></a>9.2.&nbsp;Code snippets</h2>
1.27      rillig   7801:               </div>
                   7802:             </div>
                   7803:           </div>
                   7804: 
                   7805:           <p>This section presents you with some code snippets you
                   7806:           should use in your own code. If you don't find anything
                   7807:           appropriate here, you should test your code and add it
                   7808:           here.</p>
                   7809: 
1.67      hubertf  7810:           <div class="sect2" lang="en">
1.27      rillig   7811:             <div class="titlepage">
                   7812:               <div>
                   7813:                 <div>
1.67      hubertf  7814:                   <h3 class="title"><a name=
1.38      dillo    7815:                   "adding-to-list"></a>9.2.1.&nbsp;Adding things to
1.30      wiz      7816:                   a list</h3>
1.27      rillig   7817:                 </div>
                   7818:               </div>
                   7819:             </div>
                   7820:             <pre class="programlisting">
1.51      rillig   7821:     STRING=                 foo * bar `date`
                   7822:     INT_LIST=               # empty
                   7823:     ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   7824:     EXT_LIST=               # empty
                   7825:     ANOTHER_EXT_LIST=       a=b c=d
                   7826: 
                   7827:     INT_LIST+=              ${STRING}               # 1
                   7828:     INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   7829:     EXT_LIST+=              ${STRING:Q}             # 3
                   7830:     EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
1.27      rillig   7831: </pre>
                   7832: 
                   7833:             <p>When you add a string to an external list (example
                   7834:             3), it must be quoted. In all other cases, you must not
                   7835:             add a quoting level. You must not merge internal and
                   7836:             external lists, unless you are sure that all entries
                   7837:             are correctly interpreted in both lists.</p>
                   7838:           </div>
                   7839: 
1.67      hubertf  7840:           <div class="sect2" lang="en">
1.27      rillig   7841:             <div class="titlepage">
                   7842:               <div>
                   7843:                 <div>
1.30      wiz      7844:                   <h3 class="title"><a name=
1.38      dillo    7845:                   "converting-internal-to-external"></a>9.2.2.&nbsp;Converting
1.30      wiz      7846:                   an internal list into an external list</h3>
1.27      rillig   7847:                 </div>
                   7848:               </div>
                   7849:             </div>
                   7850:             <pre class="programlisting">
1.51      rillig   7851:     EXT_LIST=       # empty
                   7852:     .for i in ${INT_LIST}
                   7853:     EXT_LIST+=      ${i:Q}""
                   7854:     .endfor
1.27      rillig   7855: </pre>
                   7856: 
                   7857:             <p>This code converts the internal list <code class=
                   7858:             "varname">INT_LIST</code> into the external list
                   7859:             <code class="varname">EXT_LIST</code>. As the elements
                   7860:             of an internal list are unquoted they must be quoted
                   7861:             here. The reason for appending <code class=
                   7862:             "varname">""</code> is explained below.</p>
                   7863:           </div>
1.1       grant    7864: 
1.67      hubertf  7865:           <div class="sect2" lang="en">
1.27      rillig   7866:             <div class="titlepage">
1.1       grant    7867:               <div>
1.27      rillig   7868:                 <div>
1.30      wiz      7869:                   <h3 class="title"><a name=
1.38      dillo    7870:                   "passing-variable-to-shell"></a>9.2.3.&nbsp;Passing
1.30      wiz      7871:                   variables to a shell command</h3>
1.27      rillig   7872:                 </div>
1.1       grant    7873:               </div>
                   7874:             </div>
1.27      rillig   7875:             <pre class="programlisting">
1.51      rillig   7876:     STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   7877:     EXT_LIST=       string=${STRING:Q} x=second\ item
1.27      rillig   7878: 
1.51      rillig   7879:     all:
                   7880:             echo ${STRING}                  # 1
                   7881:             echo "${STRING}"                # 2
                   7882:             echo "${STRING:Q}"              # 3
                   7883:             echo ${STRING:Q}                # 4
                   7884:             echo x${STRING:Q} | sed 1s,.,,  # 5
                   7885:             env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
1.27      rillig   7886: </pre>
                   7887: 
                   7888:             <p>Example 1 leads to a syntax error in the shell, as
                   7889:             the characters are just copied.</p>
                   7890: 
                   7891:             <p>Example 2 leads to a syntax error too, and if you
                   7892:             leave out the last " character from <code class=
                   7893:             "varname">${STRING}</code>, <a href=
                   7894:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   7895:             <span class="citerefentry"><span class=
                   7896:             "refentrytitle">date</span>(1)</span></a> will be
                   7897:             executed. The <code class="varname">$HOME</code> shell
                   7898:             variable would be evaluated, too.</p>
                   7899: 
                   7900:             <p>Example 3 outputs each space character preceded by a
                   7901:             backslash (or not), depending on the implementation of
                   7902:             the <a href=
                   7903:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7904:             <span class="citerefentry"><span class=
                   7905:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    7906: 
1.27      rillig   7907:             <p>Example 4 handles correctly every string that does
                   7908:             not start with a dash. In that case, the result depends
                   7909:             on the implementation of the <a href=
                   7910:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   7911:             <span class="citerefentry"><span class=
                   7912:             "refentrytitle">echo</span>(1)</span></a> command. As
                   7913:             long as you can guarantee that your input does not
1.47      reed     7914:             start with a dash, this form is appropriate.</p>
1.1       grant    7915: 
1.27      rillig   7916:             <p>Example 5 handles even the case of a leading dash
                   7917:             correctly.</p>
1.1       grant    7918: 
1.27      rillig   7919:             <p>The <code class="varname">EXT_LIST</code> does not
1.47      reed     7920:             need to be quoted because the quoting has already been
1.27      rillig   7921:             done when adding elements to the list.</p>
1.1       grant    7922: 
1.27      rillig   7923:             <p>As internal lists shall not be passed to the shell,
                   7924:             there is no example for it.</p>
1.1       grant    7925:           </div>
                   7926: 
1.67      hubertf  7927:           <div class="sect2" lang="en">
1.27      rillig   7928:             <div class="titlepage">
1.1       grant    7929:               <div>
1.27      rillig   7930:                 <div>
1.67      hubertf  7931:                   <h3 class="title"><a name=
1.38      dillo    7932:                   "quoting-guideline"></a>9.2.4.&nbsp;Quoting
1.27      rillig   7933:                   guideline</h3>
                   7934:                 </div>
1.1       grant    7935:               </div>
                   7936:             </div>
                   7937: 
1.27      rillig   7938:             <p>There are many possible sources of wrongly quoted
                   7939:             variables. This section lists some of the commonly
                   7940:             known ones.</p>
1.1       grant    7941: 
1.27      rillig   7942:             <div class="itemizedlist">
                   7943:               <ul type="disc">
                   7944:                 <li>
                   7945:                   <p>Whenever you use the value of a list, think
                   7946:                   about what happens to leading or trailing
                   7947:                   whitespace. If the list is a well-formed shell
1.47      reed     7948:                   expression, you can apply the <code class=
1.27      rillig   7949:                   "varname">:M*</code> modifier to strip leading
                   7950:                   and trailing whitespace from each word. The
                   7951:                   <code class="varname">:M</code> operator first
                   7952:                   splits its argument according to the rules of the
                   7953:                   shell, and then creates a new list consisting of
                   7954:                   all words that match the shell glob expression
                   7955:                   <code class="varname">*</code>, that is: all. One
                   7956:                   class of situations where this is needed is when
                   7957:                   adding a variable like <code class=
                   7958:                   "varname">CPPFLAGS</code> to <code class=
                   7959:                   "varname">CONFIGURE_ARGS</code>. If the configure
1.47      reed     7960:                   script invokes other configure scripts, it strips
1.27      rillig   7961:                   the leading and trailing whitespace from the
                   7962:                   variable and then passes it to the other
                   7963:                   configure scripts. But these configure scripts
                   7964:                   expect the (child) <code class=
                   7965:                   "varname">CPPFLAGS</code> variable to be the same
                   7966:                   as the parent <code class=
                   7967:                   "varname">CPPFLAGS</code>. That's why we better
                   7968:                   pass the <code class="varname">CPPFLAGS</code>
                   7969:                   value properly trimmed. And here is how we do
                   7970:                   it:</p>
                   7971:                   <pre class="programlisting">
1.51      rillig   7972:     CPPFLAGS=               # empty
                   7973:     CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   7974:     CPPFLAGS+=              ${MY_CPPFLAGS}
                   7975: 
                   7976:     CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   7977: 
                   7978:     all:
                   7979:             echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   7980:             echo x${CONFIGURE_ARGS}x        # properly trimmed
1.27      rillig   7981: </pre>
                   7982:                 </li>
1.1       grant    7983: 
1.27      rillig   7984:                 <li>
                   7985:                   <p>The example above contains one bug: The
                   7986:                   <code class="varname">${PREFIX}</code> is a
                   7987:                   properly quoted shell expression, but there is
                   7988:                   the C compiler after it, which also expects a
                   7989:                   properly quoted string (this time in C syntax).
                   7990:                   The version above is therefore only correct if
                   7991:                   <code class="varname">${PREFIX}</code> does not
                   7992:                   have embedded backslashes or double quotes. If
                   7993:                   you want to allow these, you have to add another
                   7994:                   layer of quoting to each variable that is used as
                   7995:                   a C string literal. You cannot use the
                   7996:                   <code class="varname">:Q</code> operator for it,
                   7997:                   as this operator only works for the shell.</p>
                   7998:                 </li>
1.1       grant    7999: 
1.27      rillig   8000:                 <li>
1.47      reed     8001:                   <p>Whenever a variable can be empty, the
1.27      rillig   8002:                   <code class="varname">:Q</code> operator can have
                   8003:                   surprising results. Here are two completely
                   8004:                   different cases which can be solved with the same
                   8005:                   trick.</p>
                   8006:                   <pre class="programlisting">
1.51      rillig   8007:     EMPTY=                  # empty
                   8008:     empty_test:
                   8009:             for i in a ${EMPTY:Q} c; do \
                   8010:                     echo "$$i"; \
                   8011:             done
                   8012: 
                   8013:     for_test:
                   8014:     .for i in a:\ a:\test.txt
                   8015:             echo ${i:Q}
                   8016:             echo "foo"
                   8017:     .endfor
1.1       grant    8018: </pre>
                   8019: 
1.27      rillig   8020:                   <p>The first example will only print two of the
                   8021:                   three lines we might have expected. This is
                   8022:                   because <code class="varname">${EMPTY:Q}</code>
                   8023:                   expands to the empty string, which the shell
                   8024:                   cannot see. The workaround is to write
                   8025:                   <code class="varname">${EMPTY:Q}""</code>. This
                   8026:                   pattern can be often found as <code class=
                   8027:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   8028:                   <code class="varname">${TEST} -f
                   8029:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   8030: 
                   8031:                   <p>The second example will only print three lines
                   8032:                   instead of four. The first line looks like
                   8033:                   <code class="varname">a:\ echo foo</code>. This
                   8034:                   is because the backslash of the value
                   8035:                   <code class="varname">a:\</code> is interpreted
                   8036:                   as a line-continuation by <a href=
                   8037:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8038:                   <span class="citerefentry"><span class=
                   8039:                   "refentrytitle">make</span>(1)</span></a>, which
                   8040:                   makes the second line the arguments of the
                   8041:                   <a href=
                   8042:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   8043:                   <span class="citerefentry"><span class=
                   8044:                   "refentrytitle">echo</span>(1)</span></a> command
                   8045:                   from the first line. To avoid this, write
                   8046:                   <code class="varname">${i:Q}""</code>.</p>
                   8047:                 </li>
                   8048:               </ul>
                   8049:             </div>
1.1       grant    8050:           </div>
                   8051: 
1.67      hubertf  8052:           <div class="sect2" lang="en">
1.27      rillig   8053:             <div class="titlepage">
1.1       grant    8054:               <div>
1.27      rillig   8055:                 <div>
1.30      wiz      8056:                   <h3 class="title"><a name=
1.38      dillo    8057:                   "bsd-make-bug-workaround"></a>9.2.5.&nbsp;Workaround
1.30      wiz      8058:                   for a bug in BSD Make</h3>
1.27      rillig   8059:                 </div>
1.1       grant    8060:               </div>
                   8061:             </div>
                   8062: 
1.27      rillig   8063:             <p>The pkgsrc bmake program does not handle the
                   8064:             following assignment correctly. In case <code class=
                   8065:             "varname">_othervar_</code> contains a ``-'' character,
                   8066:             one of the closing braces is included in <code class=
                   8067:             "varname">${VAR}</code> after this code executes.</p>
                   8068:             <pre class="programlisting">
1.51      rillig   8069:     VAR:=   ${VAR:N${_othervar_:C/-//}}
1.1       grant    8070: </pre>
                   8071: 
1.27      rillig   8072:             <p>For a more complex code snippet and a workaround,
                   8073:             see the package <a xmlns=
                   8074:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8075:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
1.45      wiz      8076:             target="_top"><code xmlns="" class=
                   8077:             "filename">regress/make-quoting</code></a>, testcase
1.27      rillig   8078:             <code class="varname">bug1</code>.</p>
1.1       grant    8079:           </div>
                   8080:         </div>
                   8081:       </div>
                   8082: 
1.67      hubertf  8083:       <div class="chapter" lang="en">
1.1       grant    8084:         <div class="titlepage">
                   8085:           <div>
                   8086:             <div>
1.67      hubertf  8087:               <h2 class="title"><a name=
1.38      dillo    8088:               "plist"></a>Chapter&nbsp;10.&nbsp;PLIST issues</h2>
1.1       grant    8089:             </div>
                   8090:           </div>
                   8091:         </div>
                   8092: 
                   8093:         <div class="toc">
                   8094:           <p><b>Table of Contents</b></p>
                   8095: 
                   8096:           <dl>
1.38      dillo    8097:             <dt><span class="sect1"><a href="#rcs-id">10.1. RCS
1.1       grant    8098:             ID</a></span></dt>
                   8099: 
1.30      wiz      8100:             <dt><span class="sect1"><a href=
1.38      dillo    8101:             "#automatic-plist-generation">10.2. Semi-automatic
1.45      wiz      8102:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8103:             class="filename">PLIST</code>
1.14      xtraeme  8104:             generation</a></span></dt>
1.1       grant    8105: 
1.38      dillo    8106:             <dt><span class="sect1"><a href="#print-PLIST">10.3.
1.14      xtraeme  8107:             Tweaking output of <span><strong class="command">make
                   8108:             print-PLIST</strong></span></a></span></dt>
1.1       grant    8109: 
1.38      dillo    8110:             <dt><span class="sect1"><a href="#plist.misc">10.4.
1.1       grant    8111:             Variable substitution in PLIST</a></span></dt>
                   8112: 
1.30      wiz      8113:             <dt><span class="sect1"><a href=
1.48      dillo    8114:             "#manpage-compression">10.5. Man page
                   8115:             compression</a></span></dt>
1.1       grant    8116: 
1.38      dillo    8117:             <dt><span class="sect1"><a href=
                   8118:             "#using-PLIST_SRC">10.6. Changing PLIST source with
                   8119:             <code class="varname">PLIST_SRC</code></a></span></dt>
1.1       grant    8120: 
1.30      wiz      8121:             <dt><span class="sect1"><a href=
1.47      reed     8122:             "#platform-specific-plist">10.7. Platform-specific and
1.30      wiz      8123:             differing PLISTs</a></span></dt>
1.1       grant    8124: 
1.38      dillo    8125:             <dt><span class="sect1"><a href=
                   8126:             "#faq.common-dirs">10.8. Sharing directories between
                   8127:             packages</a></span></dt>
1.1       grant    8128:           </dl>
                   8129:         </div>
                   8130: 
1.45      wiz      8131:         <p>The <code xmlns=
                   8132:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8133:         "filename">PLIST</code> file contains a package's
                   8134:         &#8220;<span class="quote">packing list</span>&#8221;, i.e.
                   8135:         a list of files that belong to the package (relative to the
                   8136:         <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8137:         class="filename">${PREFIX}</code> directory it's been
                   8138:         installed in) plus some additional statements - see the
                   8139:         <a href=
1.1       grant    8140:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   8141:         <span class="citerefentry"><span class=
1.47      reed     8142:         "refentrytitle">pkg_create</span>(1)</span></a> man page
                   8143:         for a full list. This chapter addresses some issues that
                   8144:         need attention when dealing with the <code xmlns=
1.45      wiz      8145:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8146:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    8147: 
1.67      hubertf  8148:         <div class="sect1" lang="en">
1.1       grant    8149:           <div class="titlepage">
                   8150:             <div>
                   8151:               <div>
                   8152:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  8153:                 "rcs-id"></a>10.1.&nbsp;RCS ID</h2>
1.1       grant    8154:               </div>
                   8155:             </div>
                   8156:           </div>
                   8157: 
                   8158:           <p>Be sure to add a RCS ID line as the first thing in any
1.45      wiz      8159:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8160:           class="filename">PLIST</code> file you write:</p>
1.1       grant    8161:           <pre class="programlisting">
1.51      rillig   8162:     @comment $NetBSD$
1.1       grant    8163: </pre>
                   8164:         </div>
                   8165: 
1.67      hubertf  8166:         <div class="sect1" lang="en">
1.1       grant    8167:           <div class="titlepage">
                   8168:             <div>
                   8169:               <div>
                   8170:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8171:                 "automatic-plist-generation"></a>10.2.&nbsp;Semi-automatic
1.45      wiz      8172:                 <code xmlns=
                   8173:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8174:                 "filename">PLIST</code> generation</h2>
1.1       grant    8175:               </div>
                   8176:             </div>
                   8177:           </div>
                   8178: 
1.14      xtraeme  8179:           <p>You can use the <span><strong class="command">make
                   8180:           print-PLIST</strong></span> command to output a PLIST
                   8181:           that matches any new files since the package was
                   8182:           extracted. See <a href="#build.helpful-targets" title=
1.56      rillig   8183:           "14.16.&nbsp;Other helpful targets">Section&nbsp;14.16,
1.1       grant    8184:           &#8220;Other helpful targets&#8221;</a> for more
                   8185:           information on this target.</p>
                   8186:         </div>
                   8187: 
1.67      hubertf  8188:         <div class="sect1" lang="en">
1.1       grant    8189:           <div class="titlepage">
                   8190:             <div>
                   8191:               <div>
                   8192:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8193:                 "print-PLIST"></a>10.3.&nbsp;Tweaking output of
1.14      xtraeme  8194:                 <span><strong class="command">make
                   8195:                 print-PLIST</strong></span></h2>
1.1       grant    8196:               </div>
                   8197:             </div>
                   8198:           </div>
                   8199: 
                   8200:           <p>If you have used any of the *-dirs packages, as
                   8201:           explained in <a href="#faq.common-dirs" title=
1.38      dillo    8202:           "10.8.&nbsp;Sharing directories between packages">Section&nbsp;10.8,
1.1       grant    8203:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  8204:           you may have noticed that <span><strong class=
                   8205:           "command">make print-PLIST</strong></span> outputs a set
                   8206:           of <code class="varname">@comment</code>s instead of real
                   8207:           <code class="varname">@dirrm</code> lines. You can also
                   8208:           do this for specific directories and files, so that the
                   8209:           results of that command are very close to reality. This
                   8210:           helps <span class="emphasis"><em>a lot</em></span> during
                   8211:           the update of packages.</p>
                   8212: 
                   8213:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   8214:           variable takes a set of AWK patterns and actions that are
                   8215:           used to filter the output of print-PLIST. You can
                   8216:           <span class="emphasis"><em>append</em></span> any chunk
                   8217:           of AWK scripting you like to it, but be careful with
1.1       grant    8218:           quoting.</p>
                   8219: 
1.45      wiz      8220:           <p>For example, to get all files inside the <code xmlns=
                   8221:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8222:           "filename">libdata/foo</code> directory removed from the
1.1       grant    8223:           resulting PLIST:</p>
                   8224:           <pre class="programlisting">
1.51      rillig   8225:     PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.1       grant    8226: </pre>
                   8227: 
1.14      xtraeme  8228:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    8229:           lines referring to a specific (shared) directory
1.14      xtraeme  8230:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    8231:           <pre class="programlisting">
1.51      rillig   8232:     PRINT_PLIST_AWK+=       /^@dirrm share\/specific/ { print "@comment " $$0; next; }
1.1       grant    8233: </pre>
                   8234:         </div>
                   8235: 
1.67      hubertf  8236:         <div class="sect1" lang="en">
1.1       grant    8237:           <div class="titlepage">
                   8238:             <div>
                   8239:               <div>
                   8240:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8241:                 "plist.misc"></a>10.4.&nbsp;Variable substitution
                   8242:                 in PLIST</h2>
1.1       grant    8243:               </div>
                   8244:             </div>
                   8245:           </div>
                   8246: 
                   8247:           <p>A number of variables are substituted automatically in
                   8248:           PLISTs when a package is installed on a system. This
                   8249:           includes the following variables:</p>
                   8250: 
                   8251:           <div class="variablelist">
                   8252:             <dl>
1.14      xtraeme  8253:               <dt><span class="term"><code class=
                   8254:               "varname">${MACHINE_ARCH}</code>, <code class=
                   8255:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    8256: 
                   8257:               <dd>
                   8258:                 <p>Some packages like emacs and perl embed
                   8259:                 information about which architecture they were
                   8260:                 built on into the pathnames where they install
1.47      reed     8261:                 their files. To handle this case, PLIST will be
1.1       grant    8262:                 preprocessed before actually used, and the symbol
1.14      xtraeme  8263:                 &#8220;<span class="quote"><code class=
                   8264:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   8265:                 be replaced by what <span><strong class=
                   8266:                 "command">uname -p</strong></span> gives. The same
                   8267:                 is done if the string <code class=
                   8268:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   8269:                 PLIST somewhere - use this on packages that have
1.47      reed     8270:                 GNU autoconf-created configure scripts.</p>
1.1       grant    8271: 
                   8272:                 <div class="note" style=
                   8273:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   8274:                   <h3 class="title">Legacy note</h3>
                   8275: 
                   8276:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  8277:                   "quote"><code class=
                   8278:                   "varname">$ARCH</code></span>&#8221; that was
                   8279:                   replaced by the output of <span><strong class=
                   8280:                   "command">uname -m</strong></span>, but that's no
1.1       grant    8281:                   longer supported and has been removed.</p>
                   8282:                 </div>
                   8283:               </dd>
                   8284: 
1.14      xtraeme  8285:               <dt><span class="term"><code class=
                   8286:               "varname">${OPSYS}</code>, <code class=
                   8287:               "varname">${LOWER_OPSYS}</code>, <code class=
                   8288:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    8289: 
                   8290:               <dd>
                   8291:                 <p>Some packages want to embed the OS name and
                   8292:                 version into some paths. To do this, use these
1.45      wiz      8293:                 variables in the <code xmlns=
                   8294:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8295:                 "filename">PLIST</code>:</p>
1.1       grant    8296: 
                   8297:                 <div class="itemizedlist">
                   8298:                   <ul type="disc">
                   8299:                     <li>
1.14      xtraeme  8300:                       <p><code class="varname">${OPSYS}</code> -
                   8301:                       output of &#8220;<span class=
                   8302:                       "quote"><span><strong class="command">uname
                   8303:                       -s</strong></span></span>&#8221;</p>
1.1       grant    8304:                     </li>
                   8305: 
                   8306:                     <li>
1.14      xtraeme  8307:                       <p><code class=
                   8308:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   8309:                       common name (eg. &#8220;<span class=
                   8310:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    8311:                     </li>
                   8312: 
                   8313:                     <li>
1.14      xtraeme  8314:                       <p><code class="varname">${OS_VERSION}</code>
                   8315:                       - &#8220;<span class=
                   8316:                       "quote"><span><strong class="command">uname
                   8317:                       -r</strong></span></span>&#8221;</p>
1.1       grant    8318:                     </li>
                   8319:                   </ul>
                   8320:                 </div>
                   8321:               </dd>
                   8322: 
1.14      xtraeme  8323:               <dt><span class="term"><code class=
                   8324:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    8325: 
                   8326:               <dd>
                   8327:                 <p>Packages that install locale files should list
                   8328:                 them in the PLIST as &#8220;<span class=
                   8329:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   8330:                 instead of &#8220;<span class=
                   8331:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   8332:                 This properly handles the fact that different
                   8333:                 operating systems expect locale files to be either
1.45      wiz      8334:                 in <code xmlns=
                   8335:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8336:                 "filename">share</code> or <code xmlns=
                   8337:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8338:                 "filename">lib</code> by default.</p>
1.1       grant    8339:               </dd>
                   8340:             </dl>
                   8341:           </div>
                   8342: 
                   8343:           <p>For a complete list of values which are replaced by
1.45      wiz      8344:           default, please look in <code xmlns=
                   8345:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8346:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    8347:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   8348: 
                   8349:           <p>If you want to change other variables not listed
                   8350:           above, you can add variables and their expansions to this
1.14      xtraeme  8351:           variable in the following way, similar to <code class=
                   8352:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    8353:           "#components.optional" title=
1.38      dillo    8354:           "8.5.&nbsp;Optional files">Section&nbsp;8.5,
1.1       grant    8355:           &#8220;Optional files&#8221;</a>):</p>
                   8356:           <pre class="programlisting">
1.51      rillig   8357:     PLIST_SUBST+=   SOMEVAR="somevalue"
1.1       grant    8358: </pre>
                   8359: 
                   8360:           <p>This replaces all occurrences of &#8220;<span class=
                   8361:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   8362:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   8363:         </div>
                   8364: 
1.67      hubertf  8365:         <div class="sect1" lang="en">
1.1       grant    8366:           <div class="titlepage">
                   8367:             <div>
                   8368:               <div>
                   8369:                 <h2 class="title" style="clear: both"><a name=
1.48      dillo    8370:                 "manpage-compression"></a>10.5.&nbsp;Man page
                   8371:                 compression</h2>
1.1       grant    8372:               </div>
                   8373:             </div>
                   8374:           </div>
                   8375: 
1.47      reed     8376:           <p>Man pages should be installed in compressed form if
1.45      wiz      8377:           <code class="varname">MANZ</code> is set (in <code xmlns=
                   8378:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8379:           "filename">bsd.own.mk</code>), and uncompressed
1.45      wiz      8380:           otherwise. To handle this in the <code xmlns=
                   8381:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8382:           "filename">PLIST</code> file, the suffix
                   8383:           &#8220;<span class="quote">.gz</span>&#8221; is
1.47      reed     8384:           appended/removed automatically for man pages according to
1.14      xtraeme  8385:           <code class="varname">MANZ</code> and <code class=
                   8386:           "varname">MANCOMPRESSED</code> being set or not, see
1.45      wiz      8387:           above for details. This modification of the <code xmlns=
                   8388:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8389:           "filename">PLIST</code> file is done on a copy of it, not
1.45      wiz      8390:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8391:           class="filename">PLIST</code> itself.</p>
1.1       grant    8392:         </div>
                   8393: 
1.67      hubertf  8394:         <div class="sect1" lang="en">
1.1       grant    8395:           <div class="titlepage">
                   8396:             <div>
                   8397:               <div>
                   8398:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8399:                 "using-PLIST_SRC"></a>10.6.&nbsp;Changing PLIST
1.30      wiz      8400:                 source with <code class=
1.14      xtraeme  8401:                 "varname">PLIST_SRC</code></h2>
1.1       grant    8402:               </div>
                   8403:             </div>
                   8404:           </div>
                   8405: 
1.14      xtraeme  8406:           <p>To use one or more files as source for the
1.45      wiz      8407:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8408:           class="filename">PLIST</code> used in generating the
                   8409:           binary package, set the variable <code class=
1.14      xtraeme  8410:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      8411:           The files are later concatenated using <a href=
                   8412:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   8413:           <span class="citerefentry"><span class=
                   8414:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   8415:           things is important.</p>
1.1       grant    8416:         </div>
                   8417: 
1.67      hubertf  8418:         <div class="sect1" lang="en">
1.1       grant    8419:           <div class="titlepage">
                   8420:             <div>
                   8421:               <div>
                   8422:                 <h2 class="title" style="clear: both"><a name=
1.47      reed     8423:                 "platform-specific-plist"></a>10.7.&nbsp;Platform-specific
                   8424:                 and differing PLISTs</h2>
1.1       grant    8425:               </div>
                   8426:             </div>
                   8427:           </div>
                   8428: 
                   8429:           <p>Some packages decide to install a different set of
                   8430:           files based on the operating system being used. These
                   8431:           differences can be automatically handled by using the
                   8432:           following files:</p>
                   8433: 
                   8434:           <div class="itemizedlist">
                   8435:             <ul type="disc">
                   8436:               <li>
1.45      wiz      8437:                 <p><code xmlns=
                   8438:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8439:                 "filename">PLIST.common</code></p>
1.1       grant    8440:               </li>
                   8441: 
                   8442:               <li>
1.45      wiz      8443:                 <p><code xmlns=
                   8444:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8445:                 "filename">PLIST.${OPSYS}</code></p>
1.1       grant    8446:               </li>
                   8447: 
                   8448:               <li>
1.45      wiz      8449:                 <p><code xmlns=
                   8450:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8451:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   8452:               </li>
                   8453: 
                   8454:               <li>
1.45      wiz      8455:                 <p><code xmlns=
                   8456:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.21      ben      8457:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   8458:               </li>
                   8459: 
                   8460:               <li>
1.45      wiz      8461:                 <p><code xmlns=
                   8462:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8463:                 "filename">PLIST.common_end</code></p>
1.1       grant    8464:               </li>
                   8465:             </ul>
                   8466:           </div>
                   8467:         </div>
                   8468: 
1.67      hubertf  8469:         <div class="sect1" lang="en">
1.1       grant    8470:           <div class="titlepage">
                   8471:             <div>
                   8472:               <div>
                   8473:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8474:                 "faq.common-dirs"></a>10.8.&nbsp;Sharing
                   8475:                 directories between packages</h2>
1.1       grant    8476:               </div>
                   8477:             </div>
                   8478:           </div>
                   8479: 
                   8480:           <p>A &#8220;<span class="quote">shared
                   8481:           directory</span>&#8221; is a directory where multiple
                   8482:           (and unrelated) packages install files. These directories
                   8483:           are problematic because you have to add special tricks in
                   8484:           the PLIST to conditionally remove them, or have some
                   8485:           centralized package handle them.</p>
                   8486: 
                   8487:           <p>Within pkgsrc, you'll find both approaches. If a
                   8488:           directory is shared by a few unrelated packages, it's
                   8489:           often not worth to add an extra package to remove it.
                   8490:           Therefore, one simply does:</p>
                   8491:           <pre class="programlisting">
1.51      rillig   8492:     @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
1.1       grant    8493: </pre>
                   8494: 
                   8495:           <p>in the PLISTs of all affected packages, instead of the
                   8496:           regular "@dirrm" line.</p>
                   8497: 
                   8498:           <p>However, if the directory is shared across many
                   8499:           packages, two different solutions are available:</p>
                   8500: 
                   8501:           <div class="orderedlist">
                   8502:             <ol type="1">
                   8503:               <li>
                   8504:                 <p>If the packages have a common dependency, the
                   8505:                 directory can be removed in that. For example, see
                   8506:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8507:                 href=
                   8508:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.45      wiz      8509:                 target="_top"><code xmlns="" class=
                   8510:                 "filename">textproc/scrollkeeper</code></a>, which
                   8511:                 removes the shared directory <code xmlns=
                   8512:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      8513:                 "filename">share/omf</code>.</p>
1.1       grant    8514:               </li>
                   8515: 
                   8516:               <li>
                   8517:                 <p>If the packages using the directory are not
                   8518:                 related at all (they have no common dependencies),
                   8519:                 a *-dirs package is used.</p>
                   8520:               </li>
                   8521:             </ol>
                   8522:           </div>
                   8523: 
                   8524:           <p>From now on, we'll discuss the second solution. To get
                   8525:           an idea of the *-dirs packages available, issue:</p>
                   8526:           <pre class="programlisting">
1.51      rillig   8527:     <code class="prompt">%</code> cd .../pkgsrc
                   8528:     <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    8529: </pre>
                   8530: 
                   8531:           <p>Their use from other packages is very simple. The
1.14      xtraeme  8532:           <code class="varname">USE_DIRS</code> variable takes a
                   8533:           list of package names (without the &#8220;<span class=
1.1       grant    8534:           "quote">-dirs</span>&#8221; part) together with the
                   8535:           required version number (always pick the latest one when
1.34      wiz      8536:           writing new packages).</p>
1.1       grant    8537: 
                   8538:           <p>For example, if a package installs files under
1.45      wiz      8539:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8540:           class="filename">share/applications</code>, it should
                   8541:           have the following line in it:</p>
1.1       grant    8542:           <pre class="programlisting">
1.51      rillig   8543:     USE_DIRS+=      xdg-1.1
1.1       grant    8544: </pre>
                   8545: 
1.14      xtraeme  8546:           <p>After regenerating the PLIST using
                   8547:           <span><strong class="command">make
                   8548:           print-PLIST</strong></span>, you should get the right
                   8549:           (commented out) lines.</p>
1.1       grant    8550: 
1.47      reed     8551:           <p>Note that even if your package is using <code xmlns=
1.45      wiz      8552:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8553:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    8554:           *-x11-dirs packages. Just specify the name without that
1.45      wiz      8555:           part and pkgsrc (in particular, <code xmlns=
                   8556:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8557:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    8558:         </div>
                   8559:       </div>
                   8560: 
1.67      hubertf  8561:       <div class="chapter" lang="en">
1.1       grant    8562:         <div class="titlepage">
                   8563:           <div>
                   8564:             <div>
1.67      hubertf  8565:               <h2 class="title"><a name=
1.38      dillo    8566:               "buildlink"></a>Chapter&nbsp;11.&nbsp;Buildlink
1.1       grant    8567:               methodology</h2>
                   8568:             </div>
                   8569:           </div>
                   8570:         </div>
                   8571: 
                   8572:         <div class="toc">
                   8573:           <p><b>Table of Contents</b></p>
                   8574: 
                   8575:           <dl>
1.30      wiz      8576:             <dt><span class="sect1"><a href=
1.38      dillo    8577:             "#converting-to-buildlink3">11.1. Converting packages
1.30      wiz      8578:             to use buildlink3</a></span></dt>
1.1       grant    8579: 
1.30      wiz      8580:             <dt><span class="sect1"><a href=
1.45      wiz      8581:             "#creating-buildlink3.mk">11.2. Writing <code xmlns=
                   8582:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8583:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    8584: 
                   8585:             <dd>
                   8586:               <dl>
1.25      rillig   8587:                 <dt><span class="sect2"><a href=
1.38      dillo    8588:                 "#anatomy-of-bl3">11.2.1. Anatomy of a
1.30      wiz      8589:                 buildlink3.mk file</a></span></dt>
1.1       grant    8590: 
1.25      rillig   8591:                 <dt><span class="sect2"><a href=
1.38      dillo    8592:                 "#updating-buildlink-depends">11.2.2. Updating
1.30      wiz      8593:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  8594:                 "replaceable"><code>pkg</code></em></code> in
1.45      wiz      8595:                 <code xmlns=
                   8596:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8597:                 "filename">buildlink3.mk</code>
1.1       grant    8598:                 files</a></span></dt>
                   8599:               </dl>
                   8600:             </dd>
                   8601: 
1.30      wiz      8602:             <dt><span class="sect1"><a href=
1.45      wiz      8603:             "#writing-builtin.mk">11.3. Writing <code xmlns=
                   8604:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      8605:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    8606: 
                   8607:             <dd>
                   8608:               <dl>
1.25      rillig   8609:                 <dt><span class="sect2"><a href=
1.38      dillo    8610:                 "#anatomy-of-builtin.mk">11.3.1. Anatomy of a
1.45      wiz      8611:                 <code xmlns=
                   8612:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8613:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    8614: 
1.25      rillig   8615:                 <dt><span class="sect2"><a href=
1.38      dillo    8616:                 "#native-or-pkgsrc-preference">11.3.2. Global
1.30      wiz      8617:                 preferences for native or pkgsrc
                   8618:                 software</a></span></dt>
1.1       grant    8619:               </dl>
                   8620:             </dd>
                   8621:           </dl>
                   8622:         </div>
                   8623: 
                   8624:         <p>Buildlink is a framework in pkgsrc that controls what
                   8625:         headers and libraries are seen by a package's configure and
                   8626:         build processes. This is implemented in a two step
                   8627:         process:</p>
                   8628: 
                   8629:         <div class="orderedlist">
                   8630:           <ol type="1">
                   8631:             <li>
                   8632:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  8633:               into <code class="varname">BUILDLINK_DIR</code>,
                   8634:               which by default is a subdirectory of <code class=
                   8635:               "varname">WRKDIR</code>.</p>
1.1       grant    8636:             </li>
                   8637: 
                   8638:             <li>
                   8639:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  8640:               the normal compiler tools that translate <code class=
                   8641:               "option">-I${LOCALBASE}/include</code> and
                   8642:               <code class="option">-L${LOCALBASE}/lib</code> into
                   8643:               references to <code class=
                   8644:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   8645:               also make native compiler on some operating systems
                   8646:               look like GCC, so that packages that expect GCC won't
                   8647:               require modifications to build with those native
                   8648:               compilers.</p>
1.1       grant    8649:             </li>
                   8650:           </ol>
                   8651:         </div>
                   8652: 
                   8653:         <p>This normalizes the environment in which a package is
                   8654:         built so that the package may be built consistently despite
                   8655:         what other software may be installed. Please note that the
1.45      wiz      8656:         normal system header and library paths, e.g. <code xmlns=
                   8657:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   8658:         "filename">/usr/include</code>, <code xmlns=
                   8659:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8660:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    8661:         buildlink3 is designed to insulate the package build from
                   8662:         non-system-supplied software.</p>
                   8663: 
1.67      hubertf  8664:         <div class="sect1" lang="en">
1.1       grant    8665:           <div class="titlepage">
                   8666:             <div>
                   8667:               <div>
                   8668:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8669:                 "converting-to-buildlink3"></a>11.1.&nbsp;Converting
1.30      wiz      8670:                 packages to use buildlink3</h2>
1.1       grant    8671:               </div>
                   8672:             </div>
                   8673:           </div>
                   8674: 
                   8675:           <p>The process of converting packages to use the
                   8676:           buildlink3 framework (&#8220;<span class=
                   8677:           "quote">bl3ifying</span>&#8221;) is fairly
                   8678:           straightforward. The things to keep in mind are:</p>
                   8679: 
                   8680:           <div class="orderedlist">
                   8681:             <ol type="1">
                   8682:               <li>
                   8683:                 <p>Ensure that the build always calls the wrapper
                   8684:                 scripts instead of the actual toolchain. Some
                   8685:                 packages are tricky, and the only way to know for
1.45      wiz      8686:                 sure is the check <code xmlns=
                   8687:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8688:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    8689:                 wrappers are being invoked.</p>
                   8690:               </li>
                   8691: 
                   8692:               <li>
1.14      xtraeme  8693:                 <p>Don't override <code class=
                   8694:                 "varname">PREFIX</code> from within the package
                   8695:                 Makefile, e.g. Java VMs, standalone shells, etc.,
1.45      wiz      8696:                 because the code to symlink files into <code xmlns=
                   8697:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8698:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    8699:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  8700:                 <em class=
                   8701:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    8702:               </li>
                   8703: 
                   8704:               <li>
                   8705:                 <p>Remember that <span class=
1.45      wiz      8706:                 "emphasis"><em>only</em></span> the <code xmlns=
                   8707:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8708:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    8709:                 in a package's Makefile are added as dependencies
                   8710:                 for that package.</p>
                   8711:               </li>
                   8712:             </ol>
                   8713:           </div>
                   8714: 
                   8715:           <p>If a dependency on a particular package is required
                   8716:           for its libraries and headers, then we replace:</p>
                   8717:           <pre class="programlisting">
1.51      rillig   8718:     DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    8719: </pre>
                   8720: 
                   8721:           <p>with</p>
                   8722:           <pre class="programlisting">
1.51      rillig   8723:     .include "../../category/foo/buildlink3.mk"
1.1       grant    8724: </pre>
                   8725: 
1.47      reed     8726:           <p>The buildlink3.mk files usually define the required
                   8727:           dependencies. If you need a newer version of the
                   8728:           dependency when using buildlink3.mk files, then you can
                   8729:           define it in your Makefile; for example:</p>
                   8730:           <pre class="programlisting">
1.51      rillig   8731:     BUILDLINK_DEPENDS.foo+=   foo&gt;=1.1.0
                   8732:     .include "../../category/foo/buildlink3.mk"
1.47      reed     8733: </pre>
                   8734: 
1.45      wiz      8735:           <p>There are several <code xmlns=
                   8736:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8737:           "filename">buildlink3.mk</code> files in <code xmlns=
                   8738:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8739:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    8740:           issues:</p>
                   8741: 
                   8742:           <div class="itemizedlist">
                   8743:             <ul type="disc">
                   8744:               <li>
1.45      wiz      8745:                 <p><code xmlns=
                   8746:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8747:                 "filename">bdb.buildlink3.mk</code> chooses either
                   8748:                 the native or a pkgsrc Berkeley DB implementation
                   8749:                 based on the values of <code class=
1.14      xtraeme  8750:                 "varname">BDB_ACCEPTED</code> and <code class=
                   8751:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    8752:               </li>
                   8753: 
                   8754:               <li>
1.45      wiz      8755:                 <p><code xmlns=
                   8756:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     8757:                 "filename">curses.buildlink3.mk</code>: If the
1.14      xtraeme  8758:                 system comes with neither Curses nor NCurses, this
                   8759:                 will take care to install the <a xmlns=
                   8760:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    8761:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.45      wiz      8762:                 target="_top"><code xmlns="" class=
                   8763:                 "filename">devel/ncurses</code></a> package.</p>
1.1       grant    8764:               </li>
                   8765: 
                   8766:               <li>
1.45      wiz      8767:                 <p><code xmlns=
                   8768:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8769:                 "filename">krb5.buildlink3.mk</code> uses the value
                   8770:                 of <code class="varname">KRB5_ACCEPTED</code> to
                   8771:                 choose between adding a dependency on Heimdal or
                   8772:                 MIT-krb5 for packages that require a Kerberos 5
1.1       grant    8773:                 implementation.</p>
                   8774:               </li>
                   8775: 
                   8776:               <li>
1.45      wiz      8777:                 <p><code xmlns=
                   8778:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8779:                 "filename">motif.buildlink3.mk</code> checks for a
                   8780:                 system-provided Motif installation or adds a
                   8781:                 dependency on <a xmlns=
1.1       grant    8782:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8783:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.45      wiz      8784:                 target="_top"><code xmlns="" class=
                   8785:                 "filename">x11/lesstif</code></a> or <a xmlns=
1.20      ben      8786:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8787:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
1.45      wiz      8788:                 target="_top"><code xmlns="" class=
1.47      reed     8789:                 "filename">x11/openmotif</code></a>.</p>
1.1       grant    8790:               </li>
                   8791: 
                   8792:               <li>
1.45      wiz      8793:                 <p><code xmlns=
                   8794:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.71    ! wiz      8795:                 "filename">oss.buildlink3.mk</code> defines several
        !          8796:                 variables that may be used by packages that use the
        !          8797:                 Open Sound System (OSS) API.</p>
1.1       grant    8798:               </li>
                   8799: 
                   8800:               <li>
1.45      wiz      8801:                 <p><code xmlns=
                   8802:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8803:                 "filename">pgsql.buildlink3.mk</code> will accept
                   8804:                 either Postgres 7.3 or 7.4, whichever is found
                   8805:                 installed. See the file for more information.</p>
1.1       grant    8806:               </li>
                   8807: 
                   8808:               <li>
1.45      wiz      8809:                 <p><code xmlns=
                   8810:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8811:                 "filename">pthread.buildlink3.mk</code> uses the
                   8812:                 value of <code class="varname">PTHREAD_OPTS</code>
                   8813:                 and checks for native pthreads or adds a dependency
                   8814:                 on <a xmlns=
1.1       grant    8815:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8816:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.45      wiz      8817:                 target="_top"><code xmlns="" class=
1.47      reed     8818:                 "filename">devel/pth</code></a> as needed.</p>
1.1       grant    8819:               </li>
                   8820: 
                   8821:               <li>
1.45      wiz      8822:                 <p><code xmlns=
                   8823:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8824:                 "filename">xaw.buildlink3.mk</code> uses the value
                   8825:                 of <code class="varname">XAW_TYPE</code> to choose
                   8826:                 a particular Athena widgets library.</p>
1.1       grant    8827:               </li>
                   8828:             </ul>
                   8829:           </div>
                   8830: 
1.45      wiz      8831:           <p>The comments in those <code xmlns=
                   8832:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8833:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    8834:           complete description of how to use them properly.</p>
                   8835:         </div>
                   8836: 
1.67      hubertf  8837:         <div class="sect1" lang="en">
1.1       grant    8838:           <div class="titlepage">
                   8839:             <div>
                   8840:               <div>
                   8841:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    8842:                 "creating-buildlink3.mk"></a>11.2.&nbsp;Writing
1.45      wiz      8843:                 <code xmlns=
                   8844:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   8845:                 "filename">buildlink3.mk</code> files</h2>
1.1       grant    8846:               </div>
                   8847:             </div>
                   8848:           </div>
                   8849: 
1.45      wiz      8850:           <p>A package's <code xmlns=
                   8851:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8852:           "filename">buildlink3.mk</code> file is included by
                   8853:           Makefiles to indicate the need to compile and link
                   8854:           against header files and libraries provided by the
1.45      wiz      8855:           package. A <code xmlns=
                   8856:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   8857:           "filename">buildlink3.mk</code> file should always
                   8858:           provide enough information to add the correct type of
                   8859:           dependency relationship and include any other
                   8860:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8861:           class="filename">buildlink3.mk</code> files that it needs
                   8862:           to find headers and libraries that it needs in turn.</p>
1.1       grant    8863: 
1.45      wiz      8864:           <p>To generate an initial <code xmlns=
                   8865:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8866:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    8867:           Rene Hexel's <a xmlns=
                   8868:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   8869:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.45      wiz      8870:           target="_top"><code xmlns="" class=
                   8871:           "filename">pkgtools/createbuildlink</code></a> package is
1.20      ben      8872:           highly recommended. For most packages, the following
                   8873:           command will generate a good starting point for
1.45      wiz      8874:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8875:           class="filename">buildlink3.mk</code> files:</p>
1.1       grant    8876:           <pre class="screen">
1.14      xtraeme  8877: <code class="prompt">%</code> <strong class=
                   8878: "userinput"><code>cd pkgsrc/<em class=
                   8879: "replaceable"><code>category</code></em>/<em class=
                   8880: "replaceable"><code>pkgdir</code></em>
                   8881: <code class=
1.49      rillig   8882: "prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
1.1       grant    8883: </pre>
                   8884: 
1.67      hubertf  8885:           <div class="sect2" lang="en">
1.1       grant    8886:             <div class="titlepage">
                   8887:               <div>
                   8888:                 <div>
1.67      hubertf  8889:                   <h3 class="title"><a name=
                   8890:                   "anatomy-of-bl3"></a>11.2.1.&nbsp;Anatomy of a
1.25      rillig   8891:                   buildlink3.mk file</h3>
1.1       grant    8892:                 </div>
                   8893:               </div>
                   8894:             </div>
                   8895: 
1.45      wiz      8896:             <p>The following real-life example <code xmlns=
                   8897:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8898:             "filename">buildlink3.mk</code> is taken from
1.45      wiz      8899:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8900:             class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    8901:             <pre class="programlisting">
1.51      rillig   8902:     # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    8903: 
1.51      rillig   8904:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   8905:     TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
1.1       grant    8906: 
1.51      rillig   8907:     .if !empty(BUILDLINK_DEPTH:M+)
                   8908:     BUILDLINK_DEPENDS+=     tiff
                   8909:     .endif
1.1       grant    8910: 
1.51      rillig   8911:     BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   8912:     BUILDLINK_PACKAGES+=    tiff
1.1       grant    8913: 
1.51      rillig   8914:     .if !empty(TIFF_BUILDLINK3_MK:M+)
                   8915:     BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   8916:     BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   8917:     .endif  # TIFF_BUILDLINK3_MK
1.1       grant    8918: 
1.51      rillig   8919:     .include "../../devel/zlib/buildlink3.mk"
                   8920:     .include "../../graphics/jpeg/buildlink3.mk"
1.1       grant    8921: 
1.51      rillig   8922:     BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//}
1.1       grant    8923: </pre>
                   8924: 
1.14      xtraeme  8925:             <p>The header and footer manipulate <code class=
                   8926:             "varname">BUILDLINK_DEPTH</code>, which is common
1.45      wiz      8927:             across all <code xmlns=
                   8928:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8929:             "filename">buildlink3.mk</code> files and is used to
                   8930:             track at what depth we are including <code xmlns=
                   8931:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8932:             "filename">buildlink3.mk</code> files.</p>
1.1       grant    8933: 
                   8934:             <p>The first section controls if the dependency on
1.14      xtraeme  8935:             <em class="replaceable"><code>pkg</code></em> is added.
                   8936:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    8937:             global list of packages for which dependencies are
                   8938:             added by buildlink3.</p>
                   8939: 
                   8940:             <p>The second section advises pkgsrc that the
1.45      wiz      8941:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8942:             class="filename">buildlink3.mk</code> file for
1.14      xtraeme  8943:             <em class="replaceable"><code>pkg</code></em> has been
                   8944:             included at some point. <code class=
                   8945:             "varname">BUILDLINK_PACKAGES</code> is the global list
1.45      wiz      8946:             of packages for which <code xmlns=
                   8947:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  8948:             "filename">buildlink3.mk</code> files have been
                   8949:             included. It must <span class=
                   8950:             "emphasis"><em>always</em></span> be appended to within
1.45      wiz      8951:             a <code xmlns=
                   8952:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   8953:             "filename">buildlink3.mk</code> file.</p>
1.1       grant    8954: 
                   8955:             <p>The third section is protected from multiple
1.14      xtraeme  8956:             inclusion and controls how the dependency on <em class=
                   8957:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    8958:             important variables are set in the section:</p>
                   8959: 
                   8960:             <div class="itemizedlist">
                   8961:               <ul type="disc">
                   8962:                 <li>
1.14      xtraeme  8963:                   <p><code class=
                   8964:                   "varname">BUILDLINK_DEPENDS.<em class=
                   8965:                   "replaceable"><code>pkg</code></em></code> is the
                   8966:                   actual dependency recorded in the installed
                   8967:                   package; this should always be set using
                   8968:                   <span><strong class="command">+=</strong></span>
                   8969:                   to ensure that we're appending to any
                   8970:                   pre-existing list of values. This variable should
                   8971:                   be set to the first version of the package that
                   8972:                   had the last change in the major number of a
                   8973:                   shared library or that had a major API
                   8974:                   change.</p>
1.1       grant    8975:                 </li>
                   8976: 
                   8977:                 <li>
1.14      xtraeme  8978:                   <p><code class=
                   8979:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   8980:                   "replaceable"><code>pkg</code></em></code> is the
                   8981:                   location of the <em class=
                   8982:                   "replaceable"><code>pkg</code></em> pkgsrc
1.47      reed     8983:                   directory.</p>
1.1       grant    8984:                 </li>
                   8985: 
                   8986:                 <li>
1.14      xtraeme  8987:                   <p><code class=
                   8988:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8989:                   "replaceable"><code>pkg</code></em></code> (not
                   8990:                   shown above) controls whether we use <code class=
                   8991:                   "varname">BUILD_DEPENDS</code> or <code class=
                   8992:                   "varname">DEPENDS</code> to add the dependency on
                   8993:                   <em class="replaceable"><code>pkg</code></em>.
                   8994:                   The build dependency is selected by setting
                   8995:                   <code class=
                   8996:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   8997:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    8998:                   &#8220;<span class="quote">build</span>&#8221;.
                   8999:                   By default, the full dependency is used.</p>
                   9000:                 </li>
                   9001: 
                   9002:                 <li>
1.14      xtraeme  9003:                   <p><code class=
                   9004:                   "varname">BUILDLINK_INCDIRS.<em class=
                   9005:                   "replaceable"><code>pkg</code></em></code> and
                   9006:                   <code class=
1.67      hubertf  9007:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   9008:                   (not shown above) are lists of subdirectories of
                   9009:                   <code xmlns=
1.45      wiz      9010:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9011:                   "filename">${BUILDLINK_PREFIX.<em class=
                   9012:                   "replaceable"><code>pkg</code></em>}</code> to
                   9013:                   add to the header and library search paths. These
1.1       grant    9014:                   default to &#8220;<span class=
                   9015:                   "quote">include</span>&#8221; and
                   9016:                   &#8220;<span class="quote">lib</span>&#8221;
                   9017:                   respectively.</p>
                   9018:                 </li>
                   9019: 
                   9020:                 <li>
1.14      xtraeme  9021:                   <p><code class=
                   9022:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   9023:                   "replaceable"><code>pkg</code></em></code> (not
                   9024:                   shown above) is the list of preprocessor flags to
                   9025:                   add to <code class="varname">CPPFLAGS</code>,
                   9026:                   which are passed on to the configure and build
                   9027:                   phases. The &#8220;<span class=
                   9028:                   "quote">-I</span>&#8221; option should be avoided
                   9029:                   and instead be handled using <code class=
                   9030:                   "varname">BUILDLINK_INCDIRS.<em class=
                   9031:                   "replaceable"><code>pkg</code></em></code> as
                   9032:                   above.</p>
1.1       grant    9033:                 </li>
                   9034:               </ul>
                   9035:             </div>
                   9036: 
                   9037:             <p>The following variables are all optionally defined
                   9038:             within this second section (protected against multiple
                   9039:             inclusion) and control which package files are
1.45      wiz      9040:             symlinked into <code xmlns=
                   9041:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9042:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    9043:             are transformed during the symlinking:</p>
                   9044: 
                   9045:             <div class="itemizedlist">
                   9046:               <ul type="disc">
                   9047:                 <li>
1.14      xtraeme  9048:                   <p><code class=
                   9049:                   "varname">BUILDLINK_FILES.<em class=
                   9050:                   "replaceable"><code>pkg</code></em></code> (not
                   9051:                   shown above) is a shell glob pattern relative to
1.45      wiz      9052:                   <code xmlns=
                   9053:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9054:                   "filename">${BUILDLINK_PREFIX.<em class=
                   9055:                   "replaceable"><code>pkg</code></em>}</code> to be
1.45      wiz      9056:                   symlinked into <code xmlns=
                   9057:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9058:                   "filename">${BUILDLINK_DIR}</code>, e.g.
1.45      wiz      9059:                   <code xmlns=
                   9060:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9061:                   "filename">include/*.h</code>.</p>
1.1       grant    9062:                 </li>
                   9063: 
                   9064:                 <li>
1.14      xtraeme  9065:                   <p><code class=
                   9066:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   9067:                   "replaceable"><code>pkg</code></em></code> (not
                   9068:                   shown above) is a shell pipeline that outputs to
1.45      wiz      9069:                   stdout a list of files relative to <code xmlns=
                   9070:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9071:                   "filename">${BUILDLINK_PREFIX.<em class=
                   9072:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    9073:                   resulting files are to be symlinked into
1.45      wiz      9074:                   <code xmlns=
                   9075:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9076:                   "filename">${BUILDLINK_DIR}</code>. By default,
                   9077:                   this takes the <code xmlns=
                   9078:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9079:                   "filename">+CONTENTS</code> of a <em class=
                   9080:                   "replaceable"><code>pkg</code></em> and filters
                   9081:                   it through <code class=
                   9082:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   9083:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    9084:                 </li>
                   9085: 
                   9086:                 <li>
1.14      xtraeme  9087:                   <p><code class=
                   9088:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   9089:                   "replaceable"><code>pkg</code></em></code> (not
                   9090:                   shown above) is a filter command that filters
1.45      wiz      9091:                   <code xmlns=
                   9092:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9093:                   "filename">+CONTENTS</code> input into a list of
                   9094:                   files relative to <code xmlns=
                   9095:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9096:                   "filename">${BUILDLINK_PREFIX.<em class=
                   9097:                   "replaceable"><code>pkg</code></em>}</code> on
                   9098:                   stdout. By default for overwrite packages,
                   9099:                   <code class=
                   9100:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   9101:                   "replaceable"><code>pkg</code></em></code>
1.45      wiz      9102:                   outputs the contents of the <code xmlns=
                   9103:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9104:                   "filename">include</code> and <code xmlns=
                   9105:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9106:                   "filename">lib</code> directories in the package
1.45      wiz      9107:                   <code xmlns=
                   9108:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9109:                   "filename">+CONTENTS</code>, and for pkgviews
                   9110:                   packages, it outputs any libtool archives in
                   9111:                   <code xmlns=
                   9112:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9113:                   "filename">lib</code> directories.</p>
1.1       grant    9114:                 </li>
                   9115: 
                   9116:                 <li>
1.14      xtraeme  9117:                   <p><code class=
                   9118:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   9119:                   "replaceable"><code>pkg</code></em></code> (not
                   9120:                   shown above) is a list of sed arguments used to
1.1       grant    9121:                   transform the name of the source filename into a
1.14      xtraeme  9122:                   destination filename, e.g. <span><strong class=
1.1       grant    9123:                   "command">-e
1.14      xtraeme  9124:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    9125:                 </li>
                   9126:               </ul>
                   9127:             </div>
                   9128: 
1.45      wiz      9129:             <p>The last section includes any <code xmlns=
                   9130:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9131:             "filename">buildlink3.mk</code> needed for <em class=
                   9132:             "replaceable"><code>pkg</code></em>'s library
1.45      wiz      9133:             dependencies. Including these <code xmlns=
                   9134:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9135:             "filename">buildlink3.mk</code> files means that the
                   9136:             headers and libraries for these dependencies are also
1.45      wiz      9137:             symlinked into <code xmlns=
                   9138:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9139:             "filename">${BUILDLINK_DIR}</code> whenever the
                   9140:             <em class="replaceable"><code>pkg</code></em>
1.45      wiz      9141:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9142:             class="filename">buildlink3.mk</code> file is
1.14      xtraeme  9143:             included.</p>
1.1       grant    9144:           </div>
                   9145: 
1.67      hubertf  9146:           <div class="sect2" lang="en">
1.1       grant    9147:             <div class="titlepage">
                   9148:               <div>
                   9149:                 <div>
1.30      wiz      9150:                   <h3 class="title"><a name=
1.67      hubertf  9151:                   "updating-buildlink-depends"></a>11.2.2.&nbsp;Updating
1.30      wiz      9152:                   <code class=
1.67      hubertf  9153:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   9154:                   in <code xmlns=
1.45      wiz      9155:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.30      wiz      9156:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    9157:                 </div>
                   9158:               </div>
                   9159:             </div>
                   9160: 
                   9161:             <p>There are two situations that require increasing the
1.14      xtraeme  9162:             dependency listed in <code class=
                   9163:             "varname">BUILDLINK_DEPENDS.<em class=
                   9164:             "replaceable"><code>pkg</code></em></code> after a
                   9165:             package update:</p>
1.1       grant    9166: 
                   9167:             <div class="orderedlist">
                   9168:               <ol type="1">
                   9169:                 <li>
                   9170:                   <p>if the sonames (major number of the library
                   9171:                   version) of any installed shared libraries
1.47      reed     9172:                   change.</p>
1.1       grant    9173:                 </li>
                   9174: 
                   9175:                 <li>
                   9176:                   <p>if the API or interface to the header files
                   9177:                   change.</p>
                   9178:                 </li>
                   9179:               </ol>
                   9180:             </div>
                   9181: 
1.14      xtraeme  9182:             <p>In these cases, <code class=
                   9183:             "varname">BUILDLINK_DEPENDS.<em class=
                   9184:             "replaceable"><code>pkg</code></em></code> should be
                   9185:             adjusted to require at least the new package version.
                   9186:             In some cases, the packages that depend on this new
                   9187:             version may need their <code class=
                   9188:             "varname">PKGREVISION</code>s increased and, if they
1.45      wiz      9189:             have <code xmlns=
                   9190:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9191:             "filename">buildlink3.mk</code> files, their
                   9192:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   9193:             "replaceable"><code>pkg</code></em></code> adjusted,
                   9194:             too. This is needed so that binary packages made using
                   9195:             it will require the correct package dependency and not
                   9196:             settle for an older one which will not contain the
                   9197:             necessary shared libraries.</p>
1.1       grant    9198: 
                   9199:             <p>Please take careful consideration before adjusting
1.14      xtraeme  9200:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   9201:             "replaceable"><code>pkg</code></em></code> as we don't
                   9202:             want to cause unneeded package deletions and rebuilds.
                   9203:             In many cases, new versions of packages work just fine
                   9204:             with older dependencies. See <a href="#dependencies"
1.67      hubertf  9205:             title=
1.68      rillig   9206:             "16.1.4.&nbsp;Handling dependencies">Section&nbsp;16.1.4,
1.67      hubertf  9207:             &#8220;Handling dependencies&#8221;</a> for more
                   9208:             information about dependencies on other packages,
1.25      rillig   9209:             including the <code class=
                   9210:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   9211:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    9212:           </div>
                   9213:         </div>
                   9214: 
1.67      hubertf  9215:         <div class="sect1" lang="en">
1.1       grant    9216:           <div class="titlepage">
                   9217:             <div>
                   9218:               <div>
                   9219:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    9220:                 "writing-builtin.mk"></a>11.3.&nbsp;Writing
1.45      wiz      9221:                 <code xmlns=
                   9222:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   9223:                 "filename">builtin.mk</code> files</h2>
1.1       grant    9224:               </div>
                   9225:             </div>
                   9226:           </div>
                   9227: 
                   9228:           <p>Some packages in pkgsrc install headers and libraries
                   9229:           that coincide with headers and libraries present in the
1.45      wiz      9230:           base system. Aside from a <code xmlns=
                   9231:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9232:           "filename">buildlink3.mk</code> file, these packages
1.45      wiz      9233:           should also include a <code xmlns=
                   9234:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9235:           "filename">builtin.mk</code> file that includes the
                   9236:           necessary checks to decide whether using the built-in
                   9237:           software or the pkgsrc software is appropriate.</p>
1.1       grant    9238: 
                   9239:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  9240:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    9241: 
                   9242:           <div class="orderedlist">
                   9243:             <ol type="1">
                   9244:               <li>
1.14      xtraeme  9245:                 <p>It should set <code class=
                   9246:                 "varname">USE_BUILTIN.<em class=
                   9247:                 "replaceable"><code>pkg</code></em></code> to
                   9248:                 either &#8220;<span class="quote">yes</span>&#8221;
                   9249:                 or &#8220;<span class="quote">no</span>&#8221;
                   9250:                 after it is included.</p>
1.1       grant    9251:               </li>
                   9252: 
                   9253:               <li>
                   9254:                 <p>It should <span class=
                   9255:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  9256:                 <code class="varname">USE_BUILTIN.<em class=
                   9257:                 "replaceable"><code>pkg</code></em></code> which is
1.45      wiz      9258:                 already set before the <code xmlns=
                   9259:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9260:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    9261:               </li>
                   9262: 
                   9263:               <li>
                   9264:                 <p>It should be written to allow multiple
                   9265:                 inclusion. This is <span class=
                   9266:                 "emphasis"><em>very</em></span> important and takes
1.45      wiz      9267:                 careful attention to <code xmlns=
                   9268:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9269:                 "filename">Makefile</code> coding.</p>
1.1       grant    9270:               </li>
                   9271:             </ol>
                   9272:           </div>
                   9273: 
1.67      hubertf  9274:           <div class="sect2" lang="en">
1.1       grant    9275:             <div class="titlepage">
                   9276:               <div>
                   9277:                 <div>
1.67      hubertf  9278:                   <h3 class="title"><a name=
1.38      dillo    9279:                   "anatomy-of-builtin.mk"></a>11.3.1.&nbsp;Anatomy
1.45      wiz      9280:                   of a <code xmlns=
                   9281:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9282:                   "filename">builtin.mk</code> file</h3>
1.1       grant    9283:                 </div>
                   9284:               </div>
                   9285:             </div>
                   9286: 
                   9287:             <p>The following is the recommended template for
                   9288:             builtin.mk files:</p>
                   9289:             <pre class="programlisting">
1.51      rillig   9290:     .if !defined(IS_BUILTIN.foo)
                   9291:     #
                   9292:     # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   9293:     # genuinely exists in the system or not.
                   9294:     #
                   9295:     IS_BUILTIN.foo?=        no
                   9296: 
                   9297:     # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   9298:     # version can be determined.
                   9299:     #
                   9300:     .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   9301:     BUILTIN_PKG.foo?=       foo-1.0
                   9302:     .  endif
                   9303:     .endif  # IS_BUILTIN.foo
                   9304: 
                   9305:     .if !defined(USE_BUILTIN.foo)
                   9306:     USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   9307:     .  if defined(BUILTIN_PKG.foo)
                   9308:     .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   9309:     .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   9310:     USE_BUILTIN.foo!=                                                       \
                   9311:           if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   9312:                   ${ECHO} "yes";                                            \
                   9313:           else                                                              \
                   9314:                   ${ECHO} "no";                                             \
                   9315:           fi
                   9316:     .      endif
                   9317:     .    endfor
                   9318:     .  endif
                   9319:     .endif  # USE_BUILTIN.foo
                   9320: 
                   9321:     CHECK_BUILTIN.foo?=     no
                   9322:     .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   9323:     #
                   9324:     # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   9325:     # "yes" or "no".
                   9326:     #
                   9327:     .endif  # CHECK_BUILTIN.foo
1.1       grant    9328: </pre>
                   9329: 
1.14      xtraeme  9330:             <p>The first section sets <code class=
                   9331:             "varname">IS_BUILTIN.<em class=
                   9332:             "replaceable"><code>pkg</code></em></code> depending on
                   9333:             if <em class="replaceable"><code>pkg</code></em> really
                   9334:             exists in the base system. This should not be a base
                   9335:             system software with similar functionality to
                   9336:             <em class="replaceable"><code>pkg</code></em>; it
                   9337:             should only be &#8220;<span class=
                   9338:             "quote">yes</span>&#8221; if the actual package is
                   9339:             included as part of the base system. This variable is
1.45      wiz      9340:             only used internally within the <code xmlns=
                   9341:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9342:             "filename">builtin.mk</code> file.</p>
                   9343: 
                   9344:             <p>The second section sets <code class=
                   9345:             "varname">BUILTIN_PKG.<em class=
                   9346:             "replaceable"><code>pkg</code></em></code> to the
                   9347:             version of <em class=
                   9348:             "replaceable"><code>pkg</code></em> in the base system
                   9349:             if it exists (if <code class=
                   9350:             "varname">IS_BUILTIN.<em class=
                   9351:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9352:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  9353:             variable is only used internally within the
1.45      wiz      9354:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9355:             class="filename">builtin.mk</code> file.</p>
1.1       grant    9356: 
1.14      xtraeme  9357:             <p>The third section sets <code class=
                   9358:             "varname">USE_BUILTIN.<em class=
                   9359:             "replaceable"><code>pkg</code></em></code> and is
                   9360:             <span class="emphasis"><em>required</em></span> in all
1.45      wiz      9361:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9362:             class="filename">builtin.mk</code> files. The code in
                   9363:             this section must make the determination whether the
                   9364:             built-in software is adequate to satisfy the
                   9365:             dependencies listed in <code class=
1.14      xtraeme  9366:             "varname">BUILDLINK_DEPENDS.<em class=
                   9367:             "replaceable"><code>pkg</code></em></code>. This is
                   9368:             typically done by comparing <code class=
                   9369:             "varname">BUILTIN_PKG.<em class=
                   9370:             "replaceable"><code>pkg</code></em></code> against each
                   9371:             of the dependencies in <code class=
                   9372:             "varname">BUILDLINK_DEPENDS.<em class=
                   9373:             "replaceable"><code>pkg</code></em></code>.
                   9374:             <code class="varname">USE_BUILTIN.<em class=
                   9375:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    9376:             "emphasis"><em>must</em></span> be set to the correct
1.45      wiz      9377:             value by the end of the <code xmlns=
                   9378:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9379:             "filename">builtin.mk</code> file. Note that
                   9380:             <code class="varname">USE_BUILTIN.<em class=
                   9381:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    9382:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  9383:             <code class="varname">IS_BUILTIN.<em class=
                   9384:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    9385:             &#8220;<span class="quote">no</span>&#8221; because we
                   9386:             may make the determination that the built-in version of
                   9387:             the software is similar enough to be used as a
                   9388:             replacement.</p>
                   9389: 
1.14      xtraeme  9390:             <p>The last section is guarded by <code class=
                   9391:             "varname">CHECK_BUILTIN.<em class=
                   9392:             "replaceable"><code>pkg</code></em></code>, and
                   9393:             includes code that uses the value of <code class=
                   9394:             "varname">USE_BUILTIN.<em class=
                   9395:             "replaceable"><code>pkg</code></em></code> set in the
                   9396:             previous section. This typically includes, e.g., adding
1.1       grant    9397:             additional dependency restrictions and listing
1.45      wiz      9398:             additional files to symlink into <code xmlns=
                   9399:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9400:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   9401:             "varname">BUILDLINK_FILES.<em class=
                   9402:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    9403:           </div>
                   9404: 
1.67      hubertf  9405:           <div class="sect2" lang="en">
1.1       grant    9406:             <div class="titlepage">
                   9407:               <div>
                   9408:                 <div>
1.30      wiz      9409:                   <h3 class="title"><a name=
1.38      dillo    9410:                   "native-or-pkgsrc-preference"></a>11.3.2.&nbsp;Global
1.30      wiz      9411:                   preferences for native or pkgsrc software</h3>
1.1       grant    9412:                 </div>
                   9413:               </div>
                   9414:             </div>
                   9415: 
                   9416:             <p>When building packages, it's possible to choose
                   9417:             whether to set a global preference for using either the
                   9418:             built-in (native) version or the pkgsrc version of
                   9419:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  9420:             setting <code class="varname">PREFER_PKGSRC</code> and
                   9421:             <code class="varname">PREFER_NATIVE</code>. These
                   9422:             variables take values of either &#8220;<span class=
1.1       grant    9423:             "quote">yes</span>&#8221;, &#8220;<span class=
                   9424:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  9425:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   9426:             to use the pkgsrc versions of software, while
                   9427:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   9428:             to use the built-in versions. Preferences are
                   9429:             determined by the most specific instance of the package
                   9430:             in either <code class="varname">PREFER_PKGSRC</code> or
                   9431:             <code class="varname">PREFER_NATIVE</code>. If a
                   9432:             package is specified in neither or in both variables,
                   9433:             then <code class="varname">PREFER_PKGSRC</code> has
                   9434:             precedence over <code class=
                   9435:             "varname">PREFER_NATIVE</code>. For example, to require
                   9436:             using pkgsrc versions of software for all but the most
                   9437:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    9438:             <pre class="programlisting">
1.51      rillig   9439:     PREFER_PKGSRC=  yes
                   9440:     PREFER_NATIVE=  getopt skey tcp_wrappers
1.1       grant    9441: </pre>
                   9442: 
                   9443:             <p>A package <span class=
1.45      wiz      9444:             "emphasis"><em>must</em></span> have a <code xmlns=
                   9445:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  9446:             "filename">builtin.mk</code> file to be listed in
                   9447:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   9448:             it is simply ignored in that list.</p>
1.1       grant    9449:           </div>
                   9450:         </div>
                   9451:       </div>
                   9452: 
1.67      hubertf  9453:       <div class="chapter" lang="en">
1.1       grant    9454:         <div class="titlepage">
                   9455:           <div>
                   9456:             <div>
1.67      hubertf  9457:               <h2 class="title"><a name=
1.38      dillo    9458:               "pkginstall"></a>Chapter&nbsp;12.&nbsp;The pkginstall
1.35      jmmv     9459:               framework</h2>
1.1       grant    9460:             </div>
                   9461:           </div>
                   9462:         </div>
                   9463: 
                   9464:         <div class="toc">
                   9465:           <p><b>Table of Contents</b></p>
                   9466: 
                   9467:           <dl>
1.30      wiz      9468:             <dt><span class="sect1"><a href=
1.38      dillo    9469:             "#files-and-dirs-outside-prefix">12.1. Files and
1.35      jmmv     9470:             directories outside the installation
                   9471:             prefix</a></span></dt>
                   9472: 
                   9473:             <dd>
                   9474:               <dl>
                   9475:                 <dt><span class="sect2"><a href=
1.38      dillo    9476:                 "#dirs-outside-prefix">12.1.1. Directory
1.35      jmmv     9477:                 manipulation</a></span></dt>
                   9478: 
                   9479:                 <dt><span class="sect2"><a href=
1.38      dillo    9480:                 "#files-outside-prefix">12.1.2. File
1.35      jmmv     9481:                 manipulation</a></span></dt>
                   9482:               </dl>
                   9483:             </dd>
                   9484: 
1.38      dillo    9485:             <dt><span class="sect1"><a href="#conf-files">12.2.
1.35      jmmv     9486:             Configuration files</a></span></dt>
                   9487: 
                   9488:             <dd>
                   9489:               <dl>
                   9490:                 <dt><span class="sect2"><a href=
1.38      dillo    9491:                 "#conf-files-sysconfdir">12.2.1. How <code class=
1.35      jmmv     9492:                 "varname">PKG_SYSCONFDIR</code> is
                   9493:                 set</a></span></dt>
                   9494: 
                   9495:                 <dt><span class="sect2"><a href=
1.38      dillo    9496:                 "#conf-files-configure">12.2.2. Telling the
1.47      reed     9497:                 software where configuration files
1.35      jmmv     9498:                 are</a></span></dt>
                   9499: 
                   9500:                 <dt><span class="sect2"><a href=
1.38      dillo    9501:                 "#conf-files-patching">12.2.3. Patching
1.35      jmmv     9502:                 installations</a></span></dt>
                   9503: 
                   9504:                 <dt><span class="sect2"><a href=
1.38      dillo    9505:                 "#conf-files-disable">12.2.4. Disabling handling of
1.35      jmmv     9506:                 configuration files</a></span></dt>
                   9507:               </dl>
                   9508:             </dd>
                   9509: 
1.38      dillo    9510:             <dt><span class="sect1"><a href="#rcd-scripts">12.3.
1.35      jmmv     9511:             System startup scripts</a></span></dt>
                   9512: 
                   9513:             <dd>
                   9514:               <dl>
                   9515:                 <dt><span class="sect2"><a href=
1.38      dillo    9516:                 "#rcd-scripts-disable">12.3.1. Disabling handling
1.35      jmmv     9517:                 of system startup scripts</a></span></dt>
                   9518:               </dl>
                   9519:             </dd>
1.1       grant    9520: 
1.30      wiz      9521:             <dt><span class="sect1"><a href=
1.38      dillo    9522:             "#users-and-groups">12.4. System users and
1.35      jmmv     9523:             groups</a></span></dt>
                   9524: 
1.38      dillo    9525:             <dt><span class="sect1"><a href="#shells">12.5. System
1.35      jmmv     9526:             shells</a></span></dt>
                   9527: 
                   9528:             <dd>
                   9529:               <dl>
                   9530:                 <dt><span class="sect2"><a href=
1.65      hubertf  9531:                 "#shells-disable">12.5.1. Disabling shell
                   9532:                 registration</a></span></dt>
                   9533:               </dl>
                   9534:             </dd>
                   9535: 
                   9536:             <dt><span class="sect1"><a href="#fonts">12.6.
                   9537:             Fonts</a></span></dt>
                   9538: 
                   9539:             <dd>
                   9540:               <dl>
                   9541:                 <dt><span class="sect2"><a href=
                   9542:                 "#fonts-disable">12.6.1. Disabling automatic update
                   9543:                 of the fonts databases</a></span></dt>
1.35      jmmv     9544:               </dl>
                   9545:             </dd>
1.1       grant    9546:           </dl>
                   9547:         </div>
                   9548: 
1.35      jmmv     9549:         <p>This chapter describes the framework known as
                   9550:         <code class="literal">pkginstall</code>, whose key features
                   9551:         are:</p>
                   9552: 
                   9553:         <div class="itemizedlist">
                   9554:           <ul type="disc">
                   9555:             <li>
                   9556:               <p>Generic installation and manipulation of
                   9557:               directories and files outside the pkgsrc-handled
                   9558:               tree, <code class="varname">LOCALBASE</code>.</p>
                   9559:             </li>
                   9560: 
                   9561:             <li>
                   9562:               <p>Automatic handling of configuration files during
                   9563:               installation, provided that packages are correctly
                   9564:               designed.</p>
                   9565:             </li>
                   9566: 
                   9567:             <li>
                   9568:               <p>Generation and installation of system startup
                   9569:               scripts.</p>
                   9570:             </li>
                   9571: 
                   9572:             <li>
                   9573:               <p>Registration of system users and groups.</p>
                   9574:             </li>
                   9575: 
                   9576:             <li>
                   9577:               <p>Registration of system shells.</p>
                   9578:             </li>
1.65      hubertf  9579: 
                   9580:             <li>
                   9581:               <p>Automatic updating of fonts databases.</p>
                   9582:             </li>
1.35      jmmv     9583:           </ul>
                   9584:         </div>
                   9585: 
                   9586:         <p>The following sections inspect each of the above points
1.65      hubertf  9587:         in detail.</p>
1.35      jmmv     9588: 
                   9589:         <p>You may be thinking that many of the things described
                   9590:         here could be easily done with simple code in the package's
                   9591:         post-installation target (<code class=
                   9592:         "literal">post-install</code>). <span class=
                   9593:         "emphasis"><em>This is incorrect</em></span>, as the code
                   9594:         in them is only executed when building from source.
                   9595:         Machines using binary packages could not benefit from it at
                   9596:         all (as the code itself could be unavailable). Therefore,
                   9597:         the only way to achieve any of the items described above is
                   9598:         by means of the installation scripts, which are
                   9599:         automatically generated by pkginstall.</p>
1.1       grant    9600: 
1.67      hubertf  9601:         <div class="sect1" lang="en">
1.1       grant    9602:           <div class="titlepage">
                   9603:             <div>
                   9604:               <div>
                   9605:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9606:                 "files-and-dirs-outside-prefix"></a>12.1.&nbsp;Files
                   9607:                 and directories outside the installation
                   9608:                 prefix</h2>
1.1       grant    9609:               </div>
                   9610:             </div>
                   9611:           </div>
                   9612: 
1.45      wiz      9613:           <p>As you already know, the <code xmlns=
                   9614:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9615:           "filename">PLIST</code> file holds a list of files and
                   9616:           directories that belong to a package. The names used in
1.45      wiz      9617:           it are relative to the installation prefix (<code xmlns=
                   9618:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9619:           "filename">${PREFIX}</code>), which means that it cannot
                   9620:           register files outside this directory (absolute path
                   9621:           names are not allowed). Despite this restriction, some
                   9622:           packages need to install files outside this location;
1.45      wiz      9623:           e.g., under <code xmlns=
                   9624:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9625:           "filename">${VARBASE}</code> or <code xmlns=
                   9626:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   9627:           "filename">${PKG_SYSCONFDIR}</code>.</p>
1.35      jmmv     9628: 
                   9629:           <p>The only way to achieve this is to create such files
                   9630:           during installation time by using the installation
                   9631:           scripts. These scripts can run arbitrary commands, so
                   9632:           they have the potential to create and manage files
1.47      reed     9633:           anywhere in the file system. Here is where pkginstall
1.35      jmmv     9634:           comes into play: it provides generic scripts to abstract
                   9635:           the manipulation of such files and directories based on
1.45      wiz      9636:           variables set in the package's <code xmlns=
                   9637:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9638:           "filename">Makefile</code>. The rest of this section
1.47      reed     9639:           describes these variables.</p>
1.1       grant    9640: 
1.67      hubertf  9641:           <div class="sect2" lang="en">
1.35      jmmv     9642:             <div class="titlepage">
1.1       grant    9643:               <div>
1.35      jmmv     9644:                 <div>
1.67      hubertf  9645:                   <h3 class="title"><a name=
1.63      dillo    9646:                   "dirs-outside-prefix"></a>12.1.1.&nbsp;Directory
1.35      jmmv     9647:                   manipulation</h3>
                   9648:                 </div>
1.1       grant    9649:               </div>
                   9650:             </div>
                   9651: 
1.35      jmmv     9652:             <p>The following variables can be set to request the
1.47      reed     9653:             creation of directories anywhere in the file
                   9654:             system:</p>
1.27      rillig   9655: 
1.35      jmmv     9656:             <div class="itemizedlist">
                   9657:               <ul type="disc">
                   9658:                 <li>
                   9659:                   <p><code class="varname">MAKE_DIRS</code> and
                   9660:                   <code class="varname">OWN_DIRS</code> contain a
                   9661:                   list of directories that should be created and
                   9662:                   should attempt to be destroyed by the
                   9663:                   installation scripts. The difference between the
                   9664:                   two is that the latter prompts the administrator
                   9665:                   to remove any directories that may be left after
                   9666:                   deinstallation (because they were not empty),
                   9667:                   while the former does not.</p>
                   9668:                 </li>
1.1       grant    9669: 
1.35      jmmv     9670:                 <li>
                   9671:                   <p><code class="varname">MAKE_DIRS_PERMS</code>
                   9672:                   and <code class="varname">OWN_DIRS_PERMS</code>
                   9673:                   contain a list of tuples describing which
                   9674:                   directories should be created and should attempt
                   9675:                   to be destroyed by the installation scripts. Each
                   9676:                   tuple holds the following values, separated by
                   9677:                   spaces: the directory name, its owner, its group
                   9678:                   and its numerical mode. For example:</p>
                   9679:                   <pre class="programlisting">
1.51      rillig   9680:     MAKE_DIRS_PERMS+=         ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9681: </pre>
1.1       grant    9682: 
1.35      jmmv     9683:                   <p>The difference between the two is exactly the
                   9684:                   same as their non-<code class=
                   9685:                   "varname">PERMS</code> counterparts.</p>
                   9686:                 </li>
                   9687:               </ul>
                   9688:             </div>
                   9689:           </div>
                   9690: 
1.67      hubertf  9691:           <div class="sect2" lang="en">
1.35      jmmv     9692:             <div class="titlepage">
                   9693:               <div>
                   9694:                 <div>
1.67      hubertf  9695:                   <h3 class="title"><a name=
                   9696:                   "files-outside-prefix"></a>12.1.2.&nbsp;File
1.35      jmmv     9697:                   manipulation</h3>
                   9698:                 </div>
                   9699:               </div>
                   9700:             </div>
                   9701: 
                   9702:             <p>Creating non-empty files outside the installation
1.45      wiz      9703:             prefix is tricky because the <code xmlns=
                   9704:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9705:             "filename">PLIST</code> forces all files to be inside
                   9706:             it. To overcome this problem, the only solution is to
                   9707:             extract the file in the known place (i.e., inside the
                   9708:             installation prefix) and copy it to the appropriate
                   9709:             location during installation (done by the installation
                   9710:             scripts generated by pkginstall). We will call the
                   9711:             former the <span class="emphasis"><em>master
                   9712:             file</em></span> in the following paragraphs, which
                   9713:             describe the variables that can be used to
                   9714:             automatically and consistently handle files outside the
                   9715:             installation prefix:</p>
                   9716: 
                   9717:             <div class="itemizedlist">
                   9718:               <ul type="disc">
                   9719:                 <li>
                   9720:                   <p><code class="varname">CONF_FILES</code> and
                   9721:                   <code class="varname">SUPPORT_FILES</code> are
                   9722:                   pairs of master and target files. During
                   9723:                   installation time, the master file is copied to
                   9724:                   the target one if and only if the latter does not
                   9725:                   exist. Upon deinstallation, the target file is
                   9726:                   removed provided that it was not modified by the
                   9727:                   installation.</p>
                   9728: 
                   9729:                   <p>The difference between the two is that the
                   9730:                   latter prompts the administrator to remove any
                   9731:                   files that may be left after deinstallation
                   9732:                   (because they were not empty), while the former
                   9733:                   does not.</p>
                   9734:                 </li>
                   9735: 
                   9736:                 <li>
                   9737:                   <p><code class="varname">CONF_FILES_PERMS</code>
                   9738:                   and <code class=
                   9739:                   "varname">SUPPORT_FILES_PERMS</code> contain
                   9740:                   tuples describing master files as well as their
                   9741:                   target locations. For each of them, it also
                   9742:                   specifies their owner, their group and their
                   9743:                   numeric permissions, in this order. For
                   9744:                   example:</p>
                   9745:                   <pre class="programlisting">
1.51      rillig   9746:     SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
1.35      jmmv     9747: </pre>
                   9748: 
                   9749:                   <p>The difference between the two is exactly the
                   9750:                   same as their non-<code class=
                   9751:                   "varname">PERMS</code> counterparts.</p>
                   9752:                 </li>
                   9753:               </ul>
                   9754:             </div>
                   9755:           </div>
                   9756:         </div>
                   9757: 
1.67      hubertf  9758:         <div class="sect1" lang="en">
1.35      jmmv     9759:           <div class="titlepage">
                   9760:             <div>
                   9761:               <div>
                   9762:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    9763:                 "conf-files"></a>12.2.&nbsp;Configuration
                   9764:                 files</h2>
1.35      jmmv     9765:               </div>
                   9766:             </div>
                   9767:           </div>
                   9768: 
                   9769:           <p>Configuration files are special in the sense that they
                   9770:           are installed in their own specific directory,
                   9771:           <code class="varname">PKG_SYSCONFDIR</code>, and need
                   9772:           special treatment during installation (most of which is
                   9773:           automated by pkginstall). The main concept you must bear
1.36      wiz      9774:           in mind is that files marked as configuration files are
1.35      jmmv     9775:           automatically copied to the right place (somewhere inside
                   9776:           <code class="varname">PKG_SYSCONFDIR</code>) during
                   9777:           installation <span class="emphasis"><em>if and only
                   9778:           if</em></span> they didn't exist before. Similarly, they
                   9779:           will not be removed if they have local modifications.
1.36      wiz      9780:           This ensures that administrators never lose any custom
1.35      jmmv     9781:           changes they may have made.</p>
                   9782: 
1.67      hubertf  9783:           <div class="sect2" lang="en">
1.35      jmmv     9784:             <div class="titlepage">
                   9785:               <div>
                   9786:                 <div>
1.67      hubertf  9787:                   <h3 class="title"><a name=
                   9788:                   "conf-files-sysconfdir"></a>12.2.1.&nbsp;How
1.35      jmmv     9789:                   <code class="varname">PKG_SYSCONFDIR</code> is
                   9790:                   set</h3>
                   9791:                 </div>
                   9792:               </div>
                   9793:             </div>
                   9794: 
                   9795:             <p>As said before, the <code class=
                   9796:             "varname">PKG_SYSCONFDIR</code> variable specifies
                   9797:             where configuration files shall be installed. Its
                   9798:             contents are set based upon the following
                   9799:             variables:</p>
                   9800: 
                   9801:             <div class="itemizedlist">
                   9802:               <ul type="disc">
                   9803:                 <li>
                   9804:                   <p><code class="varname">PKG_SYSCONFBASE</code>:
                   9805:                   The configuration's root directory. Defaults to
1.45      wiz      9806:                   <code xmlns=
                   9807:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9808:                   "filename">${PREFIX}/etc</code> although it may
                   9809:                   be overridden by the user to point to his
                   9810:                   preferred location (e.g., <code xmlns=
                   9811:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   9812:                   "filename">/etc</code>, <code xmlns=
                   9813:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9814:                   "filename">/etc/pkg</code>, etc.). Packages must
                   9815:                   not use it directly.</p>
                   9816:                 </li>
                   9817: 
                   9818:                 <li>
                   9819:                   <p><code class=
                   9820:                   "varname">PKG_SYSCONFSUBDIR</code>: A
                   9821:                   subdirectory of <code class=
                   9822:                   "varname">PKG_SYSCONFBASE</code> under which the
                   9823:                   configuration files for the package being built
                   9824:                   shall be installed. The definition of this
                   9825:                   variable only makes sense in the package's
1.45      wiz      9826:                   <code xmlns=
                   9827:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     9828:                   "filename">Makefile</code> (i.e., it is not
                   9829:                   user-customizable).</p>
1.35      jmmv     9830: 
                   9831:                   <p>As an example, consider the Apache package,
                   9832:                   <a xmlns=
                   9833:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9834:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache2/README.html"
1.45      wiz      9835:                   target="_top"><code xmlns="" class=
                   9836:                   "filename">www/apache2</code></a>, which places
                   9837:                   its configuration files under the <code xmlns=
                   9838:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9839:                   "filename">httpd/</code> subdirectory of
                   9840:                   <code class="varname">PKG_SYSCONFBASE</code>.
                   9841:                   This should be set in the package Makefile.</p>
                   9842:                 </li>
                   9843: 
                   9844:                 <li>
                   9845:                   <p><code class="varname">PKG_SYSCONFVAR</code>:
                   9846:                   Specifies the name of the variable that holds
                   9847:                   this package's configuration directory (if
                   9848:                   different from <code class=
                   9849:                   "varname">PKG_SYSCONFBASE</code>). It defaults to
                   9850:                   <code class="varname">PKGBASE</code>'s value, and
                   9851:                   is always prefixed with <code class=
                   9852:                   "literal">PKG_SYSCONFDIR</code>.</p>
                   9853:                 </li>
                   9854: 
                   9855:                 <li>
                   9856:                   <p><code class=
                   9857:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>:
                   9858:                   Holds the directory where the configuration files
                   9859:                   for the package identified by <code class=
                   9860:                   "varname">PKG_SYSCONFVAR</code>'s shall be
                   9861:                   placed.</p>
                   9862:                 </li>
                   9863:               </ul>
                   9864:             </div>
                   9865: 
                   9866:             <p>Based on the above variables, pkginstall determines
                   9867:             the value of <code class=
                   9868:             "varname">PKG_SYSCONFDIR</code>, which is the
                   9869:             <span class="emphasis"><em>only</em></span> variable
                   9870:             that can be used within a package to refer to its
                   9871:             configuration directory. The algorithm used to set its
                   9872:             value is basically the following:</p>
                   9873: 
                   9874:             <div class="orderedlist">
                   9875:               <ol type="1">
                   9876:                 <li>
                   9877:                   <p>If <code class=
                   9878:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9879:                   is set, its value is used.</p>
                   9880:                 </li>
                   9881: 
                   9882:                 <li>
                   9883:                   <p>If the previous variable is not defined but
                   9884:                   <code class="varname">PKG_SYSCONFSUBDIR</code> is
1.45      wiz      9885:                   set in the package's <code xmlns=
                   9886:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9887:                   "filename">Makefile</code>, the resulting value
1.45      wiz      9888:                   is <code xmlns=
                   9889:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9890:                   "filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p>
                   9891:                 </li>
                   9892: 
                   9893:                 <li>
1.45      wiz      9894:                   <p>Otherwise, it is set to <code xmlns=
                   9895:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9896:                   "filename">${PKG_SYSCONFBASE}</code>.</p>
                   9897:                 </li>
                   9898:               </ol>
                   9899:             </div>
                   9900: 
1.45      wiz      9901:             <p>It is worth mentioning that <code xmlns=
                   9902:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9903:             "filename">${PKG_SYSCONFDIR}</code> is automatically
1.45      wiz      9904:             added to <code xmlns=
                   9905:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9906:             "filename">OWN_DIRS</code>. See <a href=
                   9907:             "#dirs-outside-prefix" title=
1.63      dillo    9908:             "12.1.1.&nbsp;Directory manipulation">Section&nbsp;12.1.1,
1.35      jmmv     9909:             &#8220;Directory manipulation&#8221;</a> what this
                   9910:             means.</p>
                   9911:           </div>
                   9912: 
1.67      hubertf  9913:           <div class="sect2" lang="en">
1.35      jmmv     9914:             <div class="titlepage">
                   9915:               <div>
                   9916:                 <div>
1.67      hubertf  9917:                   <h3 class="title"><a name=
1.63      dillo    9918:                   "conf-files-configure"></a>12.2.2.&nbsp;Telling
                   9919:                   the software where configuration files are</h3>
1.35      jmmv     9920:                 </div>
                   9921:               </div>
                   9922:             </div>
                   9923: 
                   9924:             <p>Given that pkgsrc (and users!) expect configuration
                   9925:             files to be in a known place, you need to teach each
1.36      wiz      9926:             package where it shall install its files. In some cases
1.35      jmmv     9927:             you will have to patch the package Makefiles to achieve
                   9928:             it. If you are lucky, though, it may be as easy as
                   9929:             passing an extra flag to the configuration script; this
1.47      reed     9930:             is the case of GNU Autoconf- generated files:</p>
1.35      jmmv     9931:             <pre class="programlisting">
1.51      rillig   9932:     CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.35      jmmv     9933: </pre>
                   9934: 
                   9935:             <p>Note that this specifies where the package has to
                   9936:             <span class="emphasis"><em>look for</em></span> its
                   9937:             configuration files, not where they will be originally
                   9938:             installed (although the difference is never explicit,
                   9939:             unfortunately).</p>
                   9940:           </div>
                   9941: 
1.67      hubertf  9942:           <div class="sect2" lang="en">
1.35      jmmv     9943:             <div class="titlepage">
                   9944:               <div>
                   9945:                 <div>
1.67      hubertf  9946:                   <h3 class="title"><a name=
1.63      dillo    9947:                   "conf-files-patching"></a>12.2.3.&nbsp;Patching
1.35      jmmv     9948:                   installations</h3>
                   9949:                 </div>
                   9950:               </div>
                   9951:             </div>
                   9952: 
                   9953:             <p>As said before, pkginstall automatically handles
                   9954:             configuration files. This means that <span class=
                   9955:             "strong"><strong>the packages themselves must not touch
1.45      wiz      9956:             the contents of <code xmlns=
                   9957:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9958:             "filename">${PKG_SYSCONFDIR}</code>
1.36      wiz      9959:             directly</strong></span>. Bad news is that many
                   9960:             software installation scripts will, out of the box,
                   9961:             mess with the contents of that directory. So what is
                   9962:             the correct procedure to fix this issue?</p>
1.35      jmmv     9963: 
                   9964:             <p>You must teach the package (usually by manually
                   9965:             patching it) to install any configuration files under
1.45      wiz      9966:             the examples hierarchy, <code xmlns=
                   9967:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9968:             "filename">share/examples/${PKGBASE}/</code>. This way,
1.45      wiz      9969:             the <code xmlns=
                   9970:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   9971:             "filename">PLIST</code> registers them and the
                   9972:             administrator always has the original copies
1.35      jmmv     9973:             available.</p>
                   9974: 
                   9975:             <p>Once the required configuration files are in place
                   9976:             (i.e., under the examples hierarchy), the pkginstall
                   9977:             framework can use them as master copies during the
1.45      wiz      9978:             package installation to update what is in <code xmlns=
                   9979:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     9980:             "filename">${PKG_SYSCONFDIR}</code>. To achieve this,
                   9981:             the variables <code class="varname">CONF_FILES</code>
                   9982:             and <code class="varname">CONF_FILES_PERMS</code> are
                   9983:             used. Check out <a href="#files-outside-prefix" title=
1.63      dillo    9984:             "12.1.2.&nbsp;File manipulation">Section&nbsp;12.1.2,
1.35      jmmv     9985:             &#8220;File manipulation&#8221;</a> for information
                   9986:             about their syntax and their purpose. Here is an
                   9987:             example, taken from the <a xmlns=
                   9988:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9989:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/mail/mutt/README.html"
1.45      wiz      9990:             target="_top"><code xmlns="" class=
                   9991:             "filename">mail/mutt</code></a> package:</p>
1.35      jmmv     9992:             <pre class="programlisting">
1.51      rillig   9993:     EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   9994:     CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.35      jmmv     9995: </pre>
                   9996: 
                   9997:             <p>Note that the <code class="varname">EGDIR</code>
                   9998:             variable is specific to that package and has no meaning
                   9999:             outside it.</p>
                   10000:           </div>
                   10001: 
1.67      hubertf  10002:           <div class="sect2" lang="en">
1.35      jmmv     10003:             <div class="titlepage">
                   10004:               <div>
                   10005:                 <div>
1.67      hubertf  10006:                   <h3 class="title"><a name=
                   10007:                   "conf-files-disable"></a>12.2.4.&nbsp;Disabling
1.35      jmmv     10008:                   handling of configuration files</h3>
                   10009:                 </div>
                   10010:               </div>
                   10011:             </div>
                   10012: 
                   10013:             <p>The automatic copying of config files can be toggled
                   10014:             by setting the environment variable <code class=
                   10015:             "varname">PKG_CONFIG</code> prior to package
                   10016:             installation.</p>
                   10017:           </div>
                   10018:         </div>
                   10019: 
1.67      hubertf  10020:         <div class="sect1" lang="en">
1.35      jmmv     10021:           <div class="titlepage">
                   10022:             <div>
                   10023:               <div>
                   10024:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    10025:                 "rcd-scripts"></a>12.3.&nbsp;System startup
                   10026:                 scripts</h2>
1.35      jmmv     10027:               </div>
                   10028:             </div>
                   10029:           </div>
                   10030: 
                   10031:           <p>System startup scripts are special files because they
                   10032:           must be installed in a place known by the underlying OS,
                   10033:           usually outside the installation prefix. Therefore, the
                   10034:           same rules described in <a href=
                   10035:           "#files-and-dirs-outside-prefix" title=
1.38      dillo    10036:           "12.1.&nbsp;Files and directories outside the installation prefix">
1.63      dillo    10037:           Section&nbsp;12.1, &#8220;Files and directories outside
                   10038:           the installation prefix&#8221;</a> apply, and the same
1.35      jmmv     10039:           solutions can be used. However, pkginstall provides a
1.36      wiz      10040:           special mechanism to handle these files.</p>
1.35      jmmv     10041: 
                   10042:           <p>In order to provide system startup scripts, the
                   10043:           package has to:</p>
                   10044: 
                   10045:           <div class="orderedlist">
                   10046:             <ol type="1">
                   10047:               <li>
1.45      wiz      10048:                 <p>Store the script inside <code xmlns=
                   10049:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10050:                 "filename">${FILESDIR}</code>, with the
                   10051:                 <code class="literal">.sh</code> suffix appended.
                   10052:                 Considering the <a xmlns=
                   10053:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   10054:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/cups/README.html"
1.45      wiz      10055:                 target="_top"><code xmlns="" class=
                   10056:                 "filename">print/cups</code></a> package as an
                   10057:                 example, it has a <code xmlns=
                   10058:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10059:                 "filename">cupsd.sh</code> in its files
                   10060:                 directory.</p>
                   10061:               </li>
                   10062: 
                   10063:               <li>
                   10064:                 <p>Tell pkginstall to handle it, appending the name
                   10065:                 of the script, without its extension, to the
                   10066:                 <code class="varname">RCD_SCRIPTS</code> variable.
                   10067:                 Continuing the previous example:</p>
                   10068:                 <pre class="programlisting">
1.51      rillig   10069:     RCD_SCRIPTS+=   cupsd
1.35      jmmv     10070: </pre>
                   10071:               </li>
                   10072:             </ol>
                   10073:           </div>
                   10074: 
                   10075:           <p>Once this is done, pkginstall will do the following
                   10076:           steps for each script in an automated fashion:</p>
                   10077: 
                   10078:           <div class="orderedlist">
                   10079:             <ol type="1">
                   10080:               <li>
                   10081:                 <p>Process the file found in the files directory
                   10082:                 applying all the substitutions described in the
1.45      wiz      10083:                 <code xmlns=
                   10084:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10085:                 "filename">FILES_SUBST</code> variable.</p>
1.35      jmmv     10086:               </li>
                   10087: 
                   10088:               <li>
                   10089:                 <p>Copy the script from the files directory to the
1.45      wiz      10090:                 examples hierarchy, <code xmlns=
                   10091:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10092:                 "filename">${PREFIX}/share/examples/rc.d/</code>.
1.36      wiz      10093:                 Note that this master file must be explicitly
1.45      wiz      10094:                 registered in the <code xmlns=
                   10095:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10096:                 "filename">PLIST</code>.</p>
                   10097:               </li>
                   10098: 
                   10099:               <li>
                   10100:                 <p>Add code to the installation scripts to copy the
                   10101:                 startup script from the examples hierarchy into the
                   10102:                 system-wide startup scripts directory.</p>
                   10103:               </li>
                   10104:             </ol>
                   10105:           </div>
                   10106: 
1.67      hubertf  10107:           <div class="sect2" lang="en">
1.35      jmmv     10108:             <div class="titlepage">
                   10109:               <div>
                   10110:                 <div>
1.67      hubertf  10111:                   <h3 class="title"><a name=
1.63      dillo    10112:                   "rcd-scripts-disable"></a>12.3.1.&nbsp;Disabling
1.35      jmmv     10113:                   handling of system startup scripts</h3>
                   10114:                 </div>
                   10115:               </div>
                   10116:             </div>
                   10117: 
                   10118:             <p>The automatic copying of config files can be toggled
                   10119:             by setting the environment variable <code class=
                   10120:             "varname">PKG_RCD_SCRIPTS</code> prior to package
                   10121:             installation. Note that the scripts will be always
1.45      wiz      10122:             copied inside the examples hierarchy, <code xmlns=
                   10123:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10124:             "filename">${PREFIX}/share/examples/rc.d/</code>, no
                   10125:             matter what the value of this variable is.</p>
                   10126:           </div>
                   10127:         </div>
                   10128: 
1.67      hubertf  10129:         <div class="sect1" lang="en">
1.35      jmmv     10130:           <div class="titlepage">
                   10131:             <div>
                   10132:               <div>
                   10133:                 <h2 class="title" style="clear: both"><a name=
1.63      dillo    10134:                 "users-and-groups"></a>12.4.&nbsp;System users and
                   10135:                 groups</h2>
1.35      jmmv     10136:               </div>
                   10137:             </div>
                   10138:           </div>
                   10139: 
                   10140:           <p>If a package needs to create special users and/or
                   10141:           groups during installation, it can do so by using the
                   10142:           pkginstall framework.</p>
                   10143: 
                   10144:           <p>Users can be created by adding entries to the
                   10145:           <code class="varname">PKG_USERS</code> variable. Each
1.45      wiz      10146:           entry has the following syntax, which mimics <code xmlns=
                   10147:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10148:           "filename">/etc/passwd</code>:</p>
                   10149:           <pre class="programlisting">
1.51      rillig   10150:     user:group[:[userid][:[descr][:[home][:shell]]]]
1.35      jmmv     10151: </pre>
                   10152: 
                   10153:           <p>Only the user and group are required; everything else
                   10154:           is optional, but the colons must be in the right places
                   10155:           when specifying optional bits. By default, a new user
1.45      wiz      10156:           will have home directory <code xmlns=
                   10157:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10158:           "filename">/nonexistent</code>, and login shell
1.45      wiz      10159:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10160:           class="filename">/sbin/nologin</code> unless they are
                   10161:           specified as part of the user element. Note that if the
1.51      rillig   10162:           description contains spaces, then spaces should be
1.45      wiz      10163:           backslash-escaped, as in:</p>
1.35      jmmv     10164:           <pre class="programlisting">
1.51      rillig   10165:     foo:foogrp::The\ Foomister
1.35      jmmv     10166: </pre>
                   10167: 
                   10168:           <p>Similarly, groups can be created using the
                   10169:           <code class="varname">PKG_GROUPS</code> variable, whose
                   10170:           syntax is:</p>
                   10171:           <pre class="programlisting">
1.51      rillig   10172:     group[:groupid]
1.35      jmmv     10173: </pre>
                   10174: 
                   10175:           <p>As before, only the group name is required; the
                   10176:           numeric identifier is optional.</p>
                   10177:         </div>
                   10178: 
1.67      hubertf  10179:         <div class="sect1" lang="en">
1.35      jmmv     10180:           <div class="titlepage">
                   10181:             <div>
                   10182:               <div>
                   10183:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10184:                 "shells"></a>12.5.&nbsp;System shells</h2>
1.35      jmmv     10185:               </div>
                   10186:             </div>
                   10187:           </div>
                   10188: 
                   10189:           <p>Packages that install system shells should register
1.45      wiz      10190:           them in the shell database, <code xmlns=
                   10191:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10192:           "filename">/etc/shells</code>, to make things easier to
                   10193:           the administrator. This must be done from the
                   10194:           installation scripts to keep binary packages working on
                   10195:           any system. pkginstall provides an easy way to accomplish
                   10196:           this task.</p>
                   10197: 
                   10198:           <p>When a package provides a shell interpreter, it has to
                   10199:           set the <code class="varname">PKG_SHELL</code> variable
                   10200:           to its absolute file name. This will add some hooks to
                   10201:           the installation scripts to handle it. Consider the
                   10202:           following example, taken from <a xmlns=
                   10203:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10204:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/zsh/README.html"
1.45      wiz      10205:           target="_top"><code xmlns="" class=
                   10206:           "filename">shells/zsh</code></a>:</p>
1.35      jmmv     10207:           <pre class="programlisting">
1.51      rillig   10208:     PKG_SHELL=      ${PREFIX}/bin/zsh
1.35      jmmv     10209: </pre>
                   10210: 
1.67      hubertf  10211:           <div class="sect2" lang="en">
1.35      jmmv     10212:             <div class="titlepage">
                   10213:               <div>
                   10214:                 <div>
1.67      hubertf  10215:                   <h3 class="title"><a name=
                   10216:                   "shells-disable"></a>12.5.1.&nbsp;Disabling shell
1.65      hubertf  10217:                   registration</h3>
1.35      jmmv     10218:                 </div>
                   10219:               </div>
                   10220:             </div>
                   10221: 
                   10222:             <p>The automatic registration of shell interpreters can
                   10223:             be disabled by the administrator by setting the
1.45      wiz      10224:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10225:             class="filename">PKG_REGISTER_SHELLS</code> environment
                   10226:             variable to <code class="literal">NO</code>.</p>
1.35      jmmv     10227:           </div>
                   10228:         </div>
1.65      hubertf  10229: 
1.67      hubertf  10230:         <div class="sect1" lang="en">
1.65      hubertf  10231:           <div class="titlepage">
                   10232:             <div>
                   10233:               <div>
                   10234:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  10235:                 "fonts"></a>12.6.&nbsp;Fonts</h2>
1.65      hubertf  10236:               </div>
                   10237:             </div>
                   10238:           </div>
                   10239: 
                   10240:           <p>Packages that install X11 fonts should update the
                   10241:           database files that index the fonts within each fonts
                   10242:           directory. This can easily be accomplished within the
                   10243:           pkginstall framework.</p>
                   10244: 
                   10245:           <p>When a package installs X11 fonts, it must list the
                   10246:           directories in which fonts are installed in the
                   10247:           <code class="varname">FONTS_DIRS.<em class=
                   10248:           "replaceable"><code>type</code></em></code> variables,
                   10249:           where <em class="replaceable"><code>type</code></em> can
                   10250:           be one of &#8220;<span class="quote">ttf</span>&#8221;,
                   10251:           &#8220;<span class="quote">type1</span>&#8221; or
                   10252:           &#8220;<span class="quote">x11</span>&#8221;. This will
                   10253:           add hooks to the installation scripts to run the
                   10254:           appropriate commands to update the fonts database files
                   10255:           within each of those directories. For convenience, if the
                   10256:           directory path is relative, it is taken to be relative to
                   10257:           the package's installation prefix. Consider the following
                   10258:           example, taken from <a xmlns=
                   10259:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10260:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/dbz-ttf/README.html"
                   10261:           target="_top"><code xmlns="" class=
                   10262:           "filename">fonts/dbz-ttf</code></a>:</p>
                   10263:           <pre class="programlisting">
                   10264:     FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
                   10265: </pre>
                   10266: 
1.67      hubertf  10267:           <div class="sect2" lang="en">
1.65      hubertf  10268:             <div class="titlepage">
                   10269:               <div>
                   10270:                 <div>
1.67      hubertf  10271:                   <h3 class="title"><a name=
                   10272:                   "fonts-disable"></a>12.6.1.&nbsp;Disabling
                   10273:                   automatic update of the fonts databases</h3>
1.65      hubertf  10274:                 </div>
                   10275:               </div>
                   10276:             </div>
                   10277: 
                   10278:             <p>The automatic update of fonts databases can be
                   10279:             disabled by the administrator by setting the
                   10280:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10281:             class="filename">PKG_UPDATE_FONTS_DB</code> environment
                   10282:             variable to <code class="literal">NO</code>.</p>
                   10283:           </div>
                   10284:         </div>
1.35      jmmv     10285:       </div>
                   10286: 
1.67      hubertf  10287:       <div class="chapter" lang="en">
1.35      jmmv     10288:         <div class="titlepage">
                   10289:           <div>
                   10290:             <div>
1.67      hubertf  10291:               <h2 class="title"><a name=
1.38      dillo    10292:               "options"></a>Chapter&nbsp;13.&nbsp;Options
1.35      jmmv     10293:               handling</h2>
                   10294:             </div>
                   10295:           </div>
                   10296:         </div>
                   10297: 
                   10298:         <div class="toc">
                   10299:           <p><b>Table of Contents</b></p>
                   10300: 
                   10301:           <dl>
                   10302:             <dt><span class="sect1"><a href=
1.38      dillo    10303:             "#global-default-options">13.1. Global default
1.35      jmmv     10304:             options</a></span></dt>
                   10305: 
                   10306:             <dt><span class="sect1"><a href=
1.38      dillo    10307:             "#converting-to-options">13.2. Converting packages to
1.45      wiz      10308:             use <code xmlns=
                   10309:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10310:             "filename">bsd.options.mk</code></a></span></dt>
1.48      dillo    10311: 
                   10312:             <dt><span class="sect1"><a href="#option-names">13.3.
                   10313:             Option Names</a></span></dt>
1.35      jmmv     10314:           </dl>
                   10315:         </div>
                   10316: 
                   10317:         <p>Many packages have the ability to be built to support
1.45      wiz      10318:         different sets of features. <code xmlns=
                   10319:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10320:         "filename">bsd.options.mk</code> is a framework in pkgsrc
                   10321:         that provides generic handling of those options that
                   10322:         determine different ways in which the packages can be
                   10323:         built. It's possible for the user to specify exactly which
                   10324:         sets of options will be built into a package or to allow a
                   10325:         set of global default options apply.</p>
                   10326: 
1.67      hubertf  10327:         <div class="sect1" lang="en">
1.35      jmmv     10328:           <div class="titlepage">
                   10329:             <div>
                   10330:               <div>
                   10331:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    10332:                 "global-default-options"></a>13.1.&nbsp;Global
1.35      jmmv     10333:                 default options</h2>
                   10334:               </div>
                   10335:             </div>
                   10336:           </div>
                   10337: 
                   10338:           <p>Global default options are listed in <code class=
                   10339:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
                   10340:           the options that should be built into every package if
                   10341:           that option is supported. This variable should be set in
1.45      wiz      10342:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10343:           class="filename">/etc/mk.conf</code>.</p>
1.35      jmmv     10344:         </div>
                   10345: 
1.67      hubertf  10346:         <div class="sect1" lang="en">
1.35      jmmv     10347:           <div class="titlepage">
                   10348:             <div>
                   10349:               <div>
                   10350:                 <h2 class="title" style="clear: both"><a name=
1.38      dillo    10351:                 "converting-to-options"></a>13.2.&nbsp;Converting
1.45      wiz      10352:                 packages to use <code xmlns=
                   10353:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10354:                 "filename">bsd.options.mk</code></h2>
                   10355:               </div>
                   10356:             </div>
                   10357:           </div>
                   10358: 
1.45      wiz      10359:           <p>The following example shows how <code xmlns=
                   10360:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10361:           "filename">bsd.options.mk</code> should be used by the
                   10362:           hypothetical ``wibble'' package, either in the package
1.45      wiz      10363:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10364:           class="filename">Makefile</code>, or in a file, e.g.
                   10365:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10366:           class="filename">options.mk</code>, that is included by
                   10367:           the main package <code xmlns=
                   10368:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.35      jmmv     10369:           "filename">Makefile</code>.</p>
                   10370:           <pre class="programlisting">
1.51      rillig   10371:     PKG_OPTIONS_VAR=            PKG_OPTIONS.wibble
                   10372:     PKG_SUPPORTED_OPTIONS=              wibble-foo ldap
                   10373:     PKG_OPTIONS_OPTIONAL_GROUPS=        database
                   10374:     PKG_OPTIONS_GROUP.database= mysql pgsql
                   10375:     PKG_SUGGESTED_OPTIONS=              wibble-foo
                   10376:     PKG_OPTIONS_LEGACY_VARS+=   WIBBLE_USE_OPENLDAP:ldap
                   10377:     PKG_OPTIONS_LEGACY_OPTS+=   foo:wibble-foo
                   10378: 
                   10379:     .include "../../mk/bsd.prefs.mk"
                   10380: 
                   10381:     # this package was previously named wibble2
                   10382:     .if defined(PKG_OPTIONS.wibble2)
                   10383:     PKG_LEGACY_OPTIONS+=  ${PKG_OPTIONS.wibble2}
                   10384:     PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   10385:             "Deprecated variable PKG_OPTIONS.wibble2 used, use "${PKG_OPTIONS_VAR:Q}" instead."
                   10386:     .endif
                   10387: 
                   10388:     .include "../../mk/bsd.options.mk"
                   10389: 
                   10390:     # Package-specific option-handling
                   10391: 
                   10392:     ###
                   10393:     ### FOO support
                   10394:     ###
                   10395:     .if !empty(PKG_OPTIONS:Mwibble-foo)
                   10396:     CONFIGURE_ARGS+=    --enable-foo
                   10397:     .endif
                   10398: 
                   10399:     ###
                   10400:     ### LDAP support
                   10401:     ###
                   10402:     .if !empty(PKG_OPTIONS:Mldap)
                   10403:     .  include "../../databases/openldap/buildlink3.mk"
                   10404:     CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   10405:     .endif
                   10406: 
                   10407:     ###
                   10408:     ### database support
                   10409:     ###
                   10410:     .if !empty(PKG_OPTIONS:Mmysql)
                   10411:     .  include "../../mk/mysql.buildlink3.mk"
                   10412:     .endif
                   10413:     .if !empty(PKG_OPTIONS:Mpgsql)
                   10414:     .  include "../../mk/pgsql.buildlink3.mk"
                   10415:     .endif
1.1       grant    10416: </pre>
                   10417: 
1.28      rillig   10418:           <p>The first section contains the information about which
                   10419:           build options are supported by the package, and any
1.1       grant    10420:           default options settings if needed.</p>
                   10421: 
                   10422:           <div class="orderedlist">
                   10423:             <ol type="1">
                   10424:               <li>
1.14      xtraeme  10425:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   10426:                 the name of the <a href=
1.1       grant    10427:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10428:                 <span class="citerefentry"><span class=
1.27      rillig   10429:                 "refentrytitle">make</span>(1)</span></a> variable
1.37      dillo    10430:                 that the user can set to override the default
1.57      minskim  10431:                 options. It should be set to PKG_OPTIONS.<em class=
1.63      dillo    10432:                 "replaceable"><code>pkgbase</code></em>. Do not set
                   10433:                 it to PKG_OPTIONS.${PKGBASE}, since <code class=
                   10434:                 "varname">PKGBASE</code> is set after <code class=
                   10435:                 "varname">PKG_OPTIONS_VAR</code> is used.</p>
1.1       grant    10436:               </li>
                   10437: 
                   10438:               <li>
1.14      xtraeme  10439:                 <p><code class=
                   10440:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.37      dillo    10441:                 build options supported by the package.</p>
                   10442:               </li>
                   10443: 
                   10444:               <li>
                   10445:                 <p><code class=
                   10446:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   10447:                 list of names of groups of mutually exclusive
                   10448:                 options. The options in each group are listed in
                   10449:                 <code class="varname">PKG_OPTIONS_GROUP.<em class=
                   10450:                 "replaceable"><code>groupname</code></em></code>.
                   10451:                 The most specific setting of any option from the
                   10452:                 group takes precedence over all other options in
                   10453:                 the group. Options from the groups will be
                   10454:                 automatically added to <code class=
                   10455:                 "varname">PKG_SUPPORTED_OPTIONS</code>.</p>
                   10456:               </li>
                   10457: 
                   10458:               <li>
                   10459:                 <p><code class=
                   10460:                 "varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is
                   10461:                 like <code class=
                   10462:                 "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but
                   10463:                 building the packages will fail if no option from
                   10464:                 the group is selected.</p>
1.1       grant    10465:               </li>
                   10466: 
                   10467:               <li>
1.27      rillig   10468:                 <p><code class=
1.44      gdt      10469:                 "varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a
                   10470:                 list of names of sets of options. At least one
                   10471:                 option from each set must be selected. The options
                   10472:                 in each set are listed in <code class=
                   10473:                 "varname">PKG_OPTIONS_SET.<em class=
                   10474:                 "replaceable"><code>setname</code></em></code>.
                   10475:                 Options from the sets will be automatically added
                   10476:                 to <code class=
                   10477:                 "varname">PKG_SUPPORTED_OPTIONS</code>. Building
                   10478:                 the package will fail if no option from the set is
                   10479:                 selected.</p>
                   10480:               </li>
                   10481: 
                   10482:               <li>
                   10483:                 <p><code class=
1.27      rillig   10484:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   10485:                 build options which are enabled by default.</p>
                   10486:               </li>
                   10487: 
                   10488:               <li>
1.37      dillo    10489:                 <p><code class=
                   10490:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   10491:                 of &#8220;<span class="quote"><em class=
1.67      hubertf  10492:                 "replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;
                   10493:                 pairs that map legacy <code xmlns=
1.45      wiz      10494:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10495:                 "filename">/etc/mk.conf</code> variables to their
                   10496:                 option counterparts. Pairs should be added with
                   10497:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10498:                 the listing of global legacy variables. A warning
                   10499:                 will be issued if the user uses a legacy
                   10500:                 variable.</p>
                   10501:               </li>
1.1       grant    10502: 
1.37      dillo    10503:               <li>
                   10504:                 <p><code class=
                   10505:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   10506:                 of &#8220;<span class="quote"><em class=
1.67      hubertf  10507:                 "replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;
                   10508:                 pairs that map options that have been renamed to
                   10509:                 their new counterparts. Pairs should be added with
1.37      dillo    10510:                 &#8220;<span class="quote">+=</span>&#8221; to keep
                   10511:                 the listing of global legacy options. A warning
                   10512:                 will be issued if the user uses a legacy
                   10513:                 option.</p>
                   10514:               </li>
1.1       grant    10515: 
1.37      dillo    10516:               <li>
                   10517:                 <p><code class="varname">PKG_LEGACY_OPTIONS</code>
                   10518:                 is a list of options implied by deprecated
                   10519:                 variables used. This can be used for cases that
                   10520:                 neither <code class=
                   10521:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   10522:                 <code class=
                   10523:                 "varname">PKG_OPTIONS_LEGACY_OPTS</code> can
                   10524:                 handle, e. g. when <code class=
                   10525:                 "varname">PKG_OPTIONS_VAR</code> is renamed.</p>
1.1       grant    10526:               </li>
                   10527: 
                   10528:               <li>
1.37      dillo    10529:                 <p><code class=
                   10530:                 "varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   10531:                 a list of warnings about deprecated variables or
                   10532:                 options used, and what to use instead.</p>
1.1       grant    10533:               </li>
1.28      rillig   10534:             </ol>
1.1       grant    10535:           </div>
                   10536: 
1.37      dillo    10537:           <p>A package should never modify <code class=
                   10538:           "varname">PKG_DEFAULT_OPTIONS</code> or the variable
                   10539:           named in <code class="varname">PKG_OPTIONS_VAR</code>.
                   10540:           These are strictly user-settable. To suggest a default
                   10541:           set of options, use <code class=
                   10542:           "varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   10543: 
1.42      dillo    10544:           <p><code class="varname">PKG_OPTIONS_VAR</code> must be
1.45      wiz      10545:           defined before including <code xmlns=
                   10546:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.42      dillo    10547:           "filename">bsd.options.mk</code>. If none of <code class=
1.37      dillo    10548:           "varname">PKG_SUPPORTED_OPTIONS</code>, <code class=
                   10549:           "varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   10550:           <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code>
1.47      reed     10551:           are defined (as can happen with platform-specific options
1.42      dillo    10552:           if none of them is supported on the current platform),
                   10553:           <code class="varname">PKG_OPTIONS</code> is set to the
                   10554:           empty list and the package is otherwise treated as not
                   10555:           using the options framework.</p>
1.37      dillo    10556: 
1.45      wiz      10557:           <p>After the inclusion of <code xmlns=
                   10558:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.37      dillo    10559:           "filename">bsd.options.mk</code>, the variable
1.28      rillig   10560:           <code class="varname">PKG_OPTIONS</code> contains the
1.37      dillo    10561:           list of selected build options, properly filtered to
1.28      rillig   10562:           remove unsupported and duplicate options.</p>
                   10563: 
1.1       grant    10564:           <p>The remaining sections contain the logic that is
1.37      dillo    10565:           specific to each option. The correct way to check for an
                   10566:           option is to check whether it is listed in <code class=
                   10567:           "varname">PKG_OPTIONS</code>:</p>
                   10568:           <pre class="programlisting">
1.51      rillig   10569:     .if !empty(PKG_OPTIONS:M<em class=
1.37      dillo    10570: "replaceable"><code>option</code></em>)
                   10571: </pre>
1.48      dillo    10572:         </div>
1.37      dillo    10573: 
1.67      hubertf  10574:         <div class="sect1" lang="en">
1.48      dillo    10575:           <div class="titlepage">
                   10576:             <div>
                   10577:               <div>
                   10578:                 <h2 class="title" style="clear: both"><a name=
                   10579:                 "option-names"></a>13.3.&nbsp;Option Names</h2>
                   10580:               </div>
                   10581:             </div>
                   10582:           </div>
                   10583: 
                   10584:           <p>Options that enable similar features in different
                   10585:           packages (like optional support for a library) should use
                   10586:           a common name in all packages that support it (like the
                   10587:           name of the library). If another package already has an
                   10588:           option with the same meaning, use the same name.</p>
                   10589: 
                   10590:           <p>Options that enable features specific to one package,
                   10591:           where it's unlikely that another (unrelated) package has
                   10592:           the same (or a similar) optional feature, should use a
                   10593:           name prefixed with <code class="varname"><em class=
                   10594:           "replaceable"><code>pkgname</code></em>-</code>.</p>
                   10595: 
                   10596:           <p>If a group of related packages share an optional
                   10597:           feature specific to that group, prefix it with the name
                   10598:           of the &#8220;<span class="quote">main</span>&#8221;
                   10599:           package (e. g. <code class=
                   10600:           "varname">djbware-errno-hack</code>).</p>
                   10601: 
                   10602:           <p>For new options, add a line to <code xmlns=
                   10603:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   10604:           "filename">mk/defaults/options.description</code>. Lines
                   10605:           have two fields, separated by tab. The first field is the
                   10606:           option name, the second its description. The description
                   10607:           should be a whole sentence (starting with an uppercase
                   10608:           letter and ending with a period) that describes what
                   10609:           enabling the option does. E. g. &#8220;<span class=
                   10610:           "quote">Enable ispell support.</span>&#8221; The file is
                   10611:           sorted by option names.</p>
1.1       grant    10612:         </div>
                   10613:       </div>
                   10614: 
1.67      hubertf  10615:       <div class="chapter" lang="en">
1.1       grant    10616:         <div class="titlepage">
                   10617:           <div>
                   10618:             <div>
1.67      hubertf  10619:               <h2 class="title"><a name=
1.38      dillo    10620:               "build"></a>Chapter&nbsp;14.&nbsp;The build
1.1       grant    10621:               process</h2>
                   10622:             </div>
                   10623:           </div>
                   10624:         </div>
                   10625: 
                   10626:         <div class="toc">
                   10627:           <p><b>Table of Contents</b></p>
                   10628: 
                   10629:           <dl>
1.56      rillig   10630:             <dt><span class="sect1"><a href="#build.intro">14.1.
                   10631:             Introduction</a></span></dt>
                   10632: 
                   10633:             <dt><span class="sect1"><a href="#build.prefix">14.2.
1.1       grant    10634:             Program location</a></span></dt>
                   10635: 
1.56      rillig   10636:             <dt><span class="sect1"><a href=
                   10637:             "#build.builddirs">14.3. Directories used during the
                   10638:             build process</a></span></dt>
                   10639: 
                   10640:             <dt><span class="sect1"><a href="#build.running">14.4.
                   10641:             Running a phase</a></span></dt>
                   10642: 
                   10643:             <dt><span class="sect1"><a href="#build.fetch">14.5.
                   10644:             The <span class="emphasis"><em>fetch</em></span>
                   10645:             phase</a></span></dt>
                   10646: 
                   10647:             <dt><span class="sect1"><a href="#build.checksum">14.6.
                   10648:             The <span class="emphasis"><em>checksum</em></span>
                   10649:             phase</a></span></dt>
                   10650: 
                   10651:             <dt><span class="sect1"><a href="#build.extract">14.7.
                   10652:             The <span class="emphasis"><em>extract</em></span>
                   10653:             phase</a></span></dt>
                   10654: 
                   10655:             <dt><span class="sect1"><a href="#build.patch">14.8.
                   10656:             The <span class="emphasis"><em>patch</em></span>
                   10657:             phase</a></span></dt>
                   10658: 
                   10659:             <dt><span class="sect1"><a href="#build.tools">14.9.
                   10660:             The <span class="emphasis"><em>tools</em></span>
                   10661:             phase</a></span></dt>
                   10662: 
                   10663:             <dt><span class="sect1"><a href="#build.wrapper">14.10.
                   10664:             The <span class="emphasis"><em>wrapper</em></span>
                   10665:             phase</a></span></dt>
1.1       grant    10666: 
                   10667:             <dt><span class="sect1"><a href=
1.56      rillig   10668:             "#build.configure">14.11. The <span class=
                   10669:             "emphasis"><em>configure</em></span>
                   10670:             phase</a></span></dt>
                   10671: 
                   10672:             <dt><span class="sect1"><a href="#build.build">14.12.
                   10673:             The <span class="emphasis"><em>build</em></span>
                   10674:             phase</a></span></dt>
                   10675: 
                   10676:             <dt><span class="sect1"><a href="#build.test">14.13.
                   10677:             The <span class="emphasis"><em>test</em></span>
                   10678:             phase</a></span></dt>
                   10679: 
                   10680:             <dt><span class="sect1"><a href="#build.install">14.14.
                   10681:             The <span class="emphasis"><em>install</em></span>
                   10682:             phase</a></span></dt>
                   10683: 
                   10684:             <dt><span class="sect1"><a href="#build.package">14.15.
                   10685:             The <span class="emphasis"><em>package</em></span>
                   10686:             phase</a></span></dt>
                   10687: 
                   10688:             <dt><span class="sect1"><a href=
                   10689:             "#build.helpful-targets">14.16. Other helpful
1.1       grant    10690:             targets</a></span></dt>
                   10691:           </dl>
                   10692:         </div>
                   10693: 
1.67      hubertf  10694:         <div class="sect1" lang="en">
1.56      rillig   10695:           <div class="titlepage">
                   10696:             <div>
                   10697:               <div>
                   10698:                 <h2 class="title" style="clear: both"><a name=
                   10699:                 "build.intro"></a>14.1.&nbsp;Introduction</h2>
                   10700:               </div>
                   10701:             </div>
                   10702:           </div>
                   10703: 
                   10704:           <p>This chapter gives a detailed description on how a
                   10705:           package is built. Building a package is separated into
                   10706:           different <span class="emphasis"><em>phases</em></span>
                   10707:           (for example <code class="varname">fetch</code>,
                   10708:           <code class="varname">build</code>, <code class=
                   10709:           "varname">install</code>), all of which are described in
                   10710:           the following sections. Each phase is splitted into
                   10711:           so-called <span class="emphasis"><em>stages</em></span>,
1.66      rillig   10712:           which take the name of the containing phase, prefixed by
1.56      rillig   10713:           one of <code class="varname">pre-</code>, <code class=
                   10714:           "varname">do-</code> or <code class=
                   10715:           "varname">post-</code>. (Examples are <code class=
                   10716:           "varname">pre-configure</code>, <code class=
                   10717:           "varname">post-build</code>.) Most of the actual work is
                   10718:           done in the <code class="varname">do-*</code> stages.</p>
                   10719: 
                   10720:           <p>The basic steps for building a program are always the
                   10721:           same. First the program's source (<span class=
                   10722:           "emphasis"><em>distfile</em></span>) must be brought to
1.66      rillig   10723:           the local system and then extracted. After any
                   10724:           pkgsrc-specific patches to compile properly are applied,
                   10725:           the software can be configured, then built (usually by
                   10726:           compiling), and finally the generated binaries, etc. can
                   10727:           be put into place on the system.</p>
1.56      rillig   10728:         </div>
1.1       grant    10729: 
1.67      hubertf  10730:         <div class="sect1" lang="en">
1.1       grant    10731:           <div class="titlepage">
                   10732:             <div>
                   10733:               <div>
                   10734:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10735:                 "build.prefix"></a>14.2.&nbsp;Program location</h2>
1.1       grant    10736:               </div>
                   10737:             </div>
                   10738:           </div>
                   10739: 
                   10740:           <p>Before outlining the process performed by the NetBSD
                   10741:           package system in the next section, here's a brief
                   10742:           discussion on where programs are installed, and which
                   10743:           variables influence this.</p>
                   10744: 
1.14      xtraeme  10745:           <p>The automatic variable <code class=
                   10746:           "varname">PREFIX</code> indicates where all files of the
                   10747:           final program shall be installed. It is usually set to
1.45      wiz      10748:           <code class="varname">LOCALBASE</code> (<code xmlns=
                   10749:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10750:           "filename">/usr/pkg</code>), or <code class=
                   10751:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    10752:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  10753:           The value of <code class="varname">PREFIX</code> needs to
                   10754:           be put into the various places in the program's source
                   10755:           where paths to these files are encoded. See <a href=
1.1       grant    10756:           "#components.patches" title=
1.38      dillo    10757:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
1.1       grant    10758:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   10759:           title=
1.68      rillig   10760:           "16.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;16.3.1,
1.1       grant    10761:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   10762:           details.</p>
                   10763: 
                   10764:           <p>When choosing which of these variables to use, follow
                   10765:           the following rules:</p>
                   10766: 
                   10767:           <div class="itemizedlist">
                   10768:             <ul type="disc">
                   10769:               <li>
1.14      xtraeme  10770:                 <p><code class="varname">PREFIX</code> always
                   10771:                 points to the location where the current pkg will
                   10772:                 be installed. When referring to a pkg's own
1.1       grant    10773:                 installation path, use &#8220;<span class=
                   10774:                 "quote">${PREFIX}</span>&#8221;.</p>
                   10775:               </li>
                   10776: 
                   10777:               <li>
1.14      xtraeme  10778:                 <p><code class="varname">LOCALBASE</code> is where
                   10779:                 all non-X11 pkgs are installed. If you need to
1.1       grant    10780:                 construct a -I or -L argument to the compiler to
                   10781:                 find includes and libraries installed by another
                   10782:                 non-X11 pkg, use &#8220;<span class=
                   10783:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   10784:               </li>
                   10785: 
                   10786:               <li>
1.14      xtraeme  10787:                 <p><code class="varname">X11BASE</code> is where
                   10788:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    10789:                 installed. When looking for <span class=
                   10790:                 "emphasis"><em>standard</em></span> X11 includes
                   10791:                 (not those installed by a pkg), use
                   10792:                 &#8220;<span class=
                   10793:                 "quote">${X11BASE}</span>&#8221;.</p>
                   10794:               </li>
                   10795: 
                   10796:               <li>
1.47      reed     10797:                 <p>X11-based packages are special in that they may
                   10798:                 be installed in either <code class=
1.14      xtraeme  10799:                 "varname">X11BASE</code> or <code class=
                   10800:                 "varname">LOCALBASE</code>.</p>
1.1       grant    10801: 
                   10802:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  10803:                 <code class="varname">LOCALBASE</code> whenever
1.34      wiz      10804:                 possible. Note that you will need to include
1.45      wiz      10805:                 <code xmlns=
                   10806:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.34      wiz      10807:                 "filename">../../mk/x11.buildlink3.mk</code> in
                   10808:                 them to request the presence of X11 and to get the
                   10809:                 right compilation flags.</p>
1.1       grant    10810: 
                   10811:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  10812:                 be installed under <code class=
                   10813:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    10814:                 app-defaults files. These packages are special and
1.14      xtraeme  10815:                 they must be placed under <code class=
                   10816:                 "varname">X11BASE</code>. To accomplish this, set
                   10817:                 either <code class="varname">USE_X11BASE</code> or
                   10818:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    10819:                 package.</p>
                   10820: 
1.34      wiz      10821:                 <p>Some notes: If you need to find includes or
1.14      xtraeme  10822:                 libraries installed by a pkg that has <code class=
                   10823:                 "varname">USE_IMAKE</code> or <code class=
                   10824:                 "varname">USE_X11BASE</code> in its pkg
1.45      wiz      10825:                 <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   10826:                 class="filename">Makefile</code>, you need to look
                   10827:                 in <span class="emphasis"><em>both</em></span>
                   10828:                 <code xmlns=
                   10829:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10830:                 "filename">${X11BASE}</code> and <code xmlns=
                   10831:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10832:                 "filename">${LOCALBASE}</code>. To force
                   10833:                 installation of all X11 packages in <code class=
                   10834:                 "varname">LOCALBASE</code>, the <a xmlns=
                   10835:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10836:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.45      wiz      10837:                 target="_top"><code xmlns="" class=
                   10838:                 "filename">pkgtools/xpkgwedge</code></a> package is
1.34      wiz      10839:                 enabled by default.</p>
1.1       grant    10840:               </li>
                   10841: 
                   10842:               <li>
1.14      xtraeme  10843:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    10844:                 used to refer to the installed location of an X11
1.14      xtraeme  10845:                 package. <code class="varname">X11PREFIX</code>
                   10846:                 will be set to <code class="varname">X11BASE</code>
                   10847:                 if xpkgwedge is not installed, and to <code class=
                   10848:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    10849:                 installed.</p>
                   10850:               </li>
                   10851: 
                   10852:               <li>
                   10853:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  10854:                 have some packages installed in <code class=
                   10855:                 "varname">X11BASE</code> and some in <code class=
                   10856:                 "varname">LOCALBASE</code>. To determine the prefix
                   10857:                 of an installed package, the <code class=
                   10858:                 "varname">EVAL_PREFIX</code> definition can be
                   10859:                 used. It takes pairs in the format
                   10860:                 &#8220;<span class=
1.1       grant    10861:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      10862:                 the <a href=
                   10863:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   10864:                 <span class="citerefentry"><span class=
                   10865:                 "refentrytitle">make</span>(1)</span></a> variable
                   10866:                 <code class="varname">DIRNAME</code> will be set to
                   10867:                 the prefix of the installed package
                   10868:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    10869:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   10870:                 is not installed.</p>
                   10871: 
                   10872:                 <p>This is best illustrated by example.</p>
                   10873: 
1.45      wiz      10874:                 <p>The following lines are taken from <code xmlns=
                   10875:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10876:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    10877:                 <pre class="programlisting">
1.51      rillig   10878:     EVAL_PREFIX+=           GTKDIR=gtk+
1.69      rillig   10879:     CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE:Q}
                   10880:     CONFIGURE_ARGS+=        --with-gtk-prefix=${GTKDIR:Q}
                   10881:     CONFIGURE_ARGS+=        --enable-multibyte
1.1       grant    10882: </pre>
                   10883: 
                   10884:                 <p>Specific defaults can be defined for the
1.14      xtraeme  10885:                 packages evaluated using <code class=
                   10886:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    10887:                 of the form:</p>
                   10888:                 <pre class="programlisting">
1.51      rillig   10889:     GTKDIR_DEFAULT= ${LOCALBASE}
1.1       grant    10890: </pre>
                   10891: 
1.14      xtraeme  10892:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    10893:                 corresponds to the first definition in the
1.14      xtraeme  10894:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    10895:               </li>
                   10896: 
                   10897:               <li>
1.45      wiz      10898:                 <p>Within <code xmlns=
                   10899:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10900:                 "filename">${PREFIX}</code>, packages should
                   10901:                 install files according to <a href=
1.24      wiz      10902:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   10903:                 <span class="citerefentry"><span class=
                   10904:                 "refentrytitle">hier</span>(7)</span></a>, with the
1.45      wiz      10905:                 exception that manual pages go into <code xmlns=
                   10906:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10907:                 "filename">${PREFIX}/man</code>, not <code xmlns=
                   10908:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  10909:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    10910:               </li>
                   10911:             </ul>
                   10912:           </div>
                   10913:         </div>
                   10914: 
1.67      hubertf  10915:         <div class="sect1" lang="en">
1.1       grant    10916:           <div class="titlepage">
                   10917:             <div>
                   10918:               <div>
                   10919:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   10920:                 "build.builddirs"></a>14.3.&nbsp;Directories used
                   10921:                 during the build process</h2>
1.1       grant    10922:               </div>
                   10923:             </div>
                   10924:           </div>
                   10925: 
1.56      rillig   10926:           <p>When building a package, a number of directories is
                   10927:           used to store source files, temporary files,
                   10928:           pkgsrc-internal files, and so on. These directories are
                   10929:           explained here.</p>
                   10930: 
                   10931:           <p>Some of the directory variables contain relative
                   10932:           pathnames. There are two common base directories for
                   10933:           these relative directories: <code class=
                   10934:           "varname">PKGSRCDIR/PKGPATH</code> is used for
                   10935:           directories that are pkgsrc-specific. <code class=
                   10936:           "varname">WRKSRC</code> is used for directories inside
1.66      rillig   10937:           the package itself.</p>
1.1       grant    10938: 
                   10939:           <div class="variablelist">
                   10940:             <dl>
1.56      rillig   10941:               <dt><span class="term"><code class=
1.66      rillig   10942:               "varname">PKGSRCDIR</code></span></dt>
1.56      rillig   10943: 
                   10944:               <dd>
                   10945:                 <p>This is an absolute pathname that points to the
                   10946:                 pkgsrc root directory. Generally, you don't need
                   10947:                 it.</p>
                   10948:               </dd>
                   10949: 
                   10950:               <dt><span class="term"><code class=
1.66      rillig   10951:               "varname">PKGPATH</code></span></dt>
1.1       grant    10952: 
                   10953:               <dd>
1.56      rillig   10954:                 <p>This is a pathname relative to <code class=
                   10955:                 "varname">PKGSRCDIR</code> that points to the
                   10956:                 current package.</p>
                   10957:               </dd>
                   10958: 
                   10959:               <dt><span class="term"><code class=
1.66      rillig   10960:               "varname">WRKDIR</code></span></dt>
1.56      rillig   10961: 
                   10962:               <dd>
                   10963:                 <p>This is an absolute pathname pointing to the
1.57      minskim  10964:                 directory where all work takes place. The distfiles
                   10965:                 are extraced to this directory. It also contains
                   10966:                 temporary directories and log files used by the
                   10967:                 various pkgsrc frameworks, like <span class=
                   10968:                 "emphasis"><em>buildlink</em></span> or the
                   10969:                 <span class=
1.56      rillig   10970:                 "emphasis"><em>wrappers</em></span>.</p>
                   10971:               </dd>
                   10972: 
                   10973:               <dt><span class="term"><code class=
1.66      rillig   10974:               "varname">WRKSRC</code></span></dt>
1.56      rillig   10975: 
                   10976:               <dd>
                   10977:                 <p>This is an absolute pathname pointing to the
                   10978:                 directory where the distfiles are extracted. It is
                   10979:                 usually a direct subdirectory of <code class=
                   10980:                 "varname">WRKDIR</code>, and often it's the only
1.66      rillig   10981:                 directory entry that isn't hidden. This variable
                   10982:                 may be changed by a package <code xmlns=
                   10983:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   10984:                 "filename">Makefile</code>.</p>
1.56      rillig   10985:               </dd>
                   10986:             </dl>
                   10987:           </div>
                   10988:         </div>
                   10989: 
1.67      hubertf  10990:         <div class="sect1" lang="en">
1.56      rillig   10991:           <div class="titlepage">
                   10992:             <div>
                   10993:               <div>
                   10994:                 <h2 class="title" style="clear: both"><a name=
                   10995:                 "build.running"></a>14.4.&nbsp;Running a phase</h2>
                   10996:               </div>
                   10997:             </div>
                   10998:           </div>
                   10999: 
                   11000:           <p>You can run a particular phase by typing
                   11001:           <span><strong class="command">make phase</strong></span>,
                   11002:           where <span class="emphasis"><em>phase</em></span> is the
                   11003:           name of the phase. This will automatically run all phases
                   11004:           that are required for this phase. The default phase is
                   11005:           <code class="varname">build</code>, that is, when you run
                   11006:           <span><strong class="command">make</strong></span>
                   11007:           without parameters in a package directory, the package
                   11008:           will be built, but not installed.</p>
                   11009:         </div>
                   11010: 
1.67      hubertf  11011:         <div class="sect1" lang="en">
1.56      rillig   11012:           <div class="titlepage">
                   11013:             <div>
                   11014:               <div>
                   11015:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11016:                 "build.fetch"></a>14.5.&nbsp;The <span class=
                   11017:                 "emphasis"><em>fetch</em></span> phase</h2>
1.56      rillig   11018:               </div>
                   11019:             </div>
                   11020:           </div>
                   11021: 
                   11022:           <p>This will check if the file(s) given in the variables
                   11023:           <code class="varname">DISTFILES</code> and <code class=
                   11024:           "varname">PATCHFILES</code> (as defined in the package's
                   11025:           Makefile) are present on the local system in <code xmlns=
                   11026:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11027:           "filename">/usr/pkgsrc/distfiles</code>. If they are not
                   11028:           present, an attempt will be made to fetch them using
                   11029:           commands of the form:</p>
                   11030:           <pre class="programlisting">
1.51      rillig   11031:     ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
1.1       grant    11032: </pre>
                   11033: 
1.56      rillig   11034:           <p>where ${site} varies through several possibilities in
                   11035:           turn: first, <code class=
                   11036:           "varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   11037:           sites specified in either <code class=
                   11038:           "varname">SITES_file</code> if defined, else <code class=
                   11039:           "varname">MASTER_SITES</code> or <code class=
                   11040:           "varname">PATCH_SITES</code>, as applies, then finally
                   11041:           the value of <code class=
                   11042:           "varname">MASTER_SITE_BACKUP</code>. The order of all
                   11043:           except the first can be optionally sorted by the user,
                   11044:           via setting either <code class=
                   11045:           "varname">MASTER_SORT_AWK</code> or <code class=
                   11046:           "varname">MASTER_SORT_REGEX</code>.</p>
                   11047:         </div>
                   11048: 
1.67      hubertf  11049:         <div class="sect1" lang="en">
1.56      rillig   11050:           <div class="titlepage">
                   11051:             <div>
                   11052:               <div>
                   11053:                 <h2 class="title" style="clear: both"><a name=
                   11054:                 "build.checksum"></a>14.6.&nbsp;The <span class=
                   11055:                 "emphasis"><em>checksum</em></span> phase</h2>
                   11056:               </div>
                   11057:             </div>
                   11058:           </div>
                   11059: 
                   11060:           <p>After the distfile(s) are fetched, their checksum is
                   11061:           generated and compared with the checksums stored in the
                   11062:           distinfo file. If the checksums don't match, the build is
                   11063:           aborted. This is to ensure the same distfile is used for
                   11064:           building, and that the distfile wasn't changed, e.g. by
                   11065:           some malign force, deliberately changed distfiles on the
                   11066:           master distribution site or network lossage.</p>
                   11067:         </div>
                   11068: 
1.67      hubertf  11069:         <div class="sect1" lang="en">
1.56      rillig   11070:           <div class="titlepage">
                   11071:             <div>
                   11072:               <div>
                   11073:                 <h2 class="title" style="clear: both"><a name=
                   11074:                 "build.extract"></a>14.7.&nbsp;The <span class=
                   11075:                 "emphasis"><em>extract</em></span> phase</h2>
                   11076:               </div>
                   11077:             </div>
                   11078:           </div>
                   11079: 
                   11080:           <p>When the distfiles are present on the local system,
1.69      rillig   11081:           they need to be extracted, as they usually come in the
                   11082:           form of some compressed archive format.</p>
                   11083: 
                   11084:           <p>By default, all <code class="varname">DISTFILES</code>
                   11085:           are extracted. If you only need some of them, you can set
                   11086:           the <code class="varname">EXTRACT_ONLY</code> variable to
                   11087:           the list of those files.</p>
                   11088: 
                   11089:           <p>Extracting the files is usually done by a little
                   11090:           program, <code xmlns=
                   11091:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11092:           "filename">mk/scripts/extract</code>, which already knows
                   11093:           how to extract various archive formats, so most likely
                   11094:           you will not need to change anything here. But if you
                   11095:           need, the following variables may help you:</p>
                   11096: 
                   11097:           <div class="variablelist">
                   11098:             <dl>
                   11099:               <dt><span class="term"><code class=
                   11100:               "varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
                   11101: 
                   11102:               <dd>
                   11103:                 <p>Use these variables to override the default
                   11104:                 options for an extract command, which are defined
                   11105:                 in <code xmlns=
                   11106:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11107:                 "filename">mk/scripts/extract</code>.</p>
                   11108:               </dd>
1.1       grant    11109: 
1.69      rillig   11110:               <dt><span class="term"><code class=
                   11111:               "varname">EXTRACT_USING</code></span></dt>
1.1       grant    11112: 
1.69      rillig   11113:               <dd>
                   11114:                 <p>This variable can be set to <code class=
                   11115:                 "literal">pax</code>, <code class=
                   11116:                 "literal">tar</code> or an absolute pathname
                   11117:                 pointing to the command with which tar archives
                   11118:                 should be extracted.</p>
                   11119:               </dd>
                   11120:             </dl>
                   11121:           </div>
                   11122: 
                   11123:           <p>If the <code xmlns=
1.56      rillig   11124:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.69      rillig   11125:           "filename">extract</code> program doesn't serve your
                   11126:           needs, you can also override the <code class=
                   11127:           "varname">EXTRACT_CMD</code> variable, which holds the
                   11128:           command used for extracting the files. This command is
                   11129:           executed in the <code xmlns=
                   11130:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11131:           "filename">${WRKSRC}</code> directory. During execution
                   11132:           of this command, the shell variable <code class=
                   11133:           "varname">extract_file</code> holds the absolute pathname
                   11134:           of the file that is going to be extracted.</p>
                   11135: 
                   11136:           <p>And if that still does not suffice, you can override
                   11137:           the <code class="varname">do-extract</code> target in the
                   11138:           package Makefile.</p>
1.56      rillig   11139:         </div>
                   11140: 
1.67      hubertf  11141:         <div class="sect1" lang="en">
1.56      rillig   11142:           <div class="titlepage">
                   11143:             <div>
                   11144:               <div>
                   11145:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11146:                 "build.patch"></a>14.8.&nbsp;The <span class=
                   11147:                 "emphasis"><em>patch</em></span> phase</h2>
1.56      rillig   11148:               </div>
                   11149:             </div>
                   11150:           </div>
                   11151: 
                   11152:           <p>After extraction, all the patches named by the
                   11153:           <code class="varname">PATCHFILES</code>, those present in
                   11154:           the patches subdirectory of the package as well as in
                   11155:           $LOCALPATCHES/$PKGPATH (e.g. <code xmlns=
                   11156:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11157:           "filename">/usr/local/patches/graphics/png</code>) are
                   11158:           applied. Patchfiles ending in <code xmlns=
                   11159:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11160:           "filename">.Z</code> or <code xmlns=
                   11161:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11162:           "filename">.gz</code> are uncompressed before they are
                   11163:           applied, files ending in <code xmlns=
                   11164:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11165:           "filename">.orig</code> or <code xmlns=
                   11166:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11167:           "filename">.rej</code> are ignored. Any special options
                   11168:           to <a href=
                   11169:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   11170:           <span class="citerefentry"><span class=
                   11171:           "refentrytitle">patch</span>(1)</span></a> can be handed
                   11172:           in <code class="varname">PATCH_DIST_ARGS</code>. See
                   11173:           <a href="#components.patches" title=
                   11174:           "8.3.&nbsp;patches/*">Section&nbsp;8.3,
                   11175:           &#8220;patches/*&#8221;</a> for more details.</p>
                   11176: 
                   11177:           <p>By default <a href=
                   11178:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   11179:           <span class="citerefentry"><span class=
                   11180:           "refentrytitle">patch</span>(1)</span></a> is given
                   11181:           special args to make it fail if the patches apply with
                   11182:           some lines of fuzz. Please fix (regen) the patches so
                   11183:           that they apply cleanly. The rationale behind this is
                   11184:           that patches that don't apply cleanly may end up being
                   11185:           applied in the wrong place, and cause severe harm
                   11186:           there.</p>
                   11187:         </div>
                   11188: 
1.67      hubertf  11189:         <div class="sect1" lang="en">
1.56      rillig   11190:           <div class="titlepage">
                   11191:             <div>
                   11192:               <div>
                   11193:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11194:                 "build.tools"></a>14.9.&nbsp;The <span class=
                   11195:                 "emphasis"><em>tools</em></span> phase</h2>
1.56      rillig   11196:               </div>
                   11197:             </div>
                   11198:           </div>
                   11199: 
1.68      rillig   11200:           <p>This is covered in <a href="#tools" title=
                   11201:           "Chapter&nbsp;15.&nbsp;Tools needed for building or running">
                   11202:           Chapter&nbsp;15, <i>Tools needed for building or
                   11203:           running</i></a>.</p>
1.56      rillig   11204:         </div>
                   11205: 
1.67      hubertf  11206:         <div class="sect1" lang="en">
1.56      rillig   11207:           <div class="titlepage">
                   11208:             <div>
                   11209:               <div>
                   11210:                 <h2 class="title" style="clear: both"><a name=
                   11211:                 "build.wrapper"></a>14.10.&nbsp;The <span class=
                   11212:                 "emphasis"><em>wrapper</em></span> phase</h2>
                   11213:               </div>
                   11214:             </div>
                   11215:           </div>
                   11216: 
                   11217:           <p>[TODO]</p>
                   11218:         </div>
                   11219: 
1.67      hubertf  11220:         <div class="sect1" lang="en">
1.56      rillig   11221:           <div class="titlepage">
                   11222:             <div>
                   11223:               <div>
                   11224:                 <h2 class="title" style="clear: both"><a name=
                   11225:                 "build.configure"></a>14.11.&nbsp;The <span class=
                   11226:                 "emphasis"><em>configure</em></span> phase</h2>
                   11227:               </div>
                   11228:             </div>
                   11229:           </div>
                   11230: 
                   11231:           <p>Most pieces of software need information on the header
                   11232:           files, system calls, and library routines which are
                   11233:           available on the platform they run on. The process of
                   11234:           determining this information is known as configuration,
                   11235:           and is usually automated. In most cases, a script is
                   11236:           supplied with the distfiles, and its invocation results
                   11237:           in generation of header files, Makefiles, etc.</p>
                   11238: 
                   11239:           <p>If the package contains a configure script, this can
                   11240:           be invoked by setting <code class=
                   11241:           "varname">HAS_CONFIGURE</code> to &#8220;<span class=
                   11242:           "quote">yes</span>&#8221;. If the configure script is a
                   11243:           GNU autoconf script, you should set <code class=
                   11244:           "varname">GNU_CONFIGURE</code> to &#8220;<span class=
                   11245:           "quote">yes</span>&#8221; instead. What happens in the
                   11246:           <span class="emphasis"><em>configure</em></span> phase is
                   11247:           roughly:</p>
                   11248:           <pre class="programlisting">
                   11249:     .for d in ${CONFIGURE_DIRS}
                   11250:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${CONFIGURE_ENV} \
                   11251:                 ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   11252:     .endfor
                   11253: </pre>
1.1       grant    11254: 
1.56      rillig   11255:           <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   11256:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11257:           pathnames relative to <code class=
                   11258:           "varname">WRKSRC</code>. In each of these directories,
                   11259:           the configure script is run with the environment
                   11260:           <code class="varname">CONFIGURE_ENV</code> and arguments
                   11261:           <code class="varname">CONFIGURE_ARGS</code>. The
                   11262:           variables <code class="varname">CONFIGURE_ENV</code>,
                   11263:           <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   11264:           &#8220;<span class="quote">./configure</span>&#8221;) and
                   11265:           <code class="varname">CONFIGURE_ARGS</code> may all be
                   11266:           changed by the package.</p>
1.1       grant    11267: 
1.56      rillig   11268:           <p>If the program uses an <code xmlns=
                   11269:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   11270:           "filename">Imakefile</code> for configuration, the
                   11271:           appropriate steps can be invoked by setting <code class=
                   11272:           "varname">USE_IMAKE</code> to &#8220;<span class=
                   11273:           "quote">yes</span>&#8221;. (If you only want the package
                   11274:           installed in <code class="varname">${X11PREFIX}</code>
                   11275:           but xmkmf not being run, set <code class=
                   11276:           "varname">USE_X11BASE</code> instead.)</p>
                   11277:         </div>
1.1       grant    11278: 
1.67      hubertf  11279:         <div class="sect1" lang="en">
1.56      rillig   11280:           <div class="titlepage">
                   11281:             <div>
                   11282:               <div>
                   11283:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11284:                 "build.build"></a>14.12.&nbsp;The <span class=
                   11285:                 "emphasis"><em>build</em></span> phase</h2>
1.56      rillig   11286:               </div>
                   11287:             </div>
1.1       grant    11288:           </div>
                   11289: 
1.56      rillig   11290:           <p>For building a package, a rough equivalent of the
                   11291:           following code is executed.</p>
1.1       grant    11292:           <pre class="programlisting">
1.56      rillig   11293:     .for d in ${BUILD_DIRS}
                   11294:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   11295:                 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   11296:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   11297:     .endfor
1.1       grant    11298: </pre>
1.56      rillig   11299: 
                   11300:           <p><code class="varname">BUILD_DIRS</code> (default:
                   11301:           &#8220;<span class="quote">.</span>&#8221;) is a list of
                   11302:           pathnames relative to <code class=
                   11303:           "varname">WRKSRC</code>. In each of these directories,
                   11304:           <code class="varname">MAKE_PROGRAM</code> is run with the
                   11305:           environment <code class="varname">MAKE_ENV</code> and
                   11306:           arguments <code class="varname">BUILD_MAKE_FLAGS</code>.
                   11307:           The variables <code class="varname">MAKE_ENV</code>,
                   11308:           <code class="varname">BUILD_MAKE_FLAGS</code>,
                   11309:           <code class="varname">MAKEFILE</code> and <code class=
                   11310:           "varname">BUILD_TARGET</code> may all be changed by the
                   11311:           package.</p>
                   11312: 
                   11313:           <p>The default value of <code class=
                   11314:           "varname">MAKE_PROGRAM</code> is &#8220;<span class=
                   11315:           "quote">gmake</span>&#8221; if <code class=
                   11316:           "varname">USE_TOOLS</code> contains &#8220;<span class=
                   11317:           "quote">gmake</span>&#8221;, &#8220;<span class=
                   11318:           "quote">make</span>&#8221; otherwise. The default value
                   11319:           of <code class="varname">MAKEFILE</code> is
                   11320:           &#8220;<span class="quote">Makefile</span>&#8221;, and
                   11321:           <code class="varname">BUILD_TARGET</code> defaults to
                   11322:           &#8220;<span class="quote">all</span>&#8221;.</p>
                   11323:         </div>
                   11324: 
1.67      hubertf  11325:         <div class="sect1" lang="en">
1.56      rillig   11326:           <div class="titlepage">
                   11327:             <div>
                   11328:               <div>
                   11329:                 <h2 class="title" style="clear: both"><a name=
1.67      hubertf  11330:                 "build.test"></a>14.13.&nbsp;The <span class=
                   11331:                 "emphasis"><em>test</em></span> phase</h2>
1.56      rillig   11332:               </div>
                   11333:             </div>
                   11334:           </div>
                   11335: 
                   11336:           <p>[TODO]</p>
                   11337:         </div>
                   11338: 
1.67      hubertf  11339:         <div class="sect1" lang="en">
1.56      rillig   11340:           <div class="titlepage">
                   11341:             <div>
                   11342:               <div>
                   11343:                 <h2 class="title" style="clear: both"><a name=
                   11344:                 "build.install"></a>14.14.&nbsp;The <span class=
                   11345:                 "emphasis"><em>install</em></span> phase</h2>
                   11346:               </div>
                   11347:             </div>
                   11348:           </div>
                   11349: 
                   11350:           <p>Once the build stage has completed, the final step is
                   11351:           to install the software in public directories, so users
1.68      rillig   11352:           can access the programs and files.</p>
                   11353: 
                   11354:           <p>In the <span class="emphasis"><em>install</em></span>
                   11355:           phase, a rough equivalent of the following code is
                   11356:           executed. Additionally, before and after this code, much
                   11357:           magic is performed to do consistency checks, registering
                   11358:           the package, and so on.</p>
                   11359:           <pre class="programlisting">
                   11360:     .for d in ${INSTALL_DIRS}
                   11361:             cd ${WRKSRC} &amp;&amp; cd ${d} &amp;&amp; env ${MAKE_ENV} \
                   11362:                 ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
                   11363:                     -f ${MAKEFILE} ${BUILD_TARGET}
                   11364:     .endfor
                   11365: </pre>
                   11366: 
                   11367:           <p>The variable's meanings are analogous to the ones in
                   11368:           the <span class="emphasis"><em>build</em></span> phase.
                   11369:           <code class="varname">INSTALL_DIRS</code> defaults to
                   11370:           <code class="varname">BUILD_DIRS</code>. <code class=
                   11371:           "varname">INSTALL_TARGET</code> is &#8220;<span class=
                   11372:           "quote">install</span>&#8221; by default, plus
                   11373:           &#8220;<span class="quote">install.man</span>&#8221; if
                   11374:           <code class="varname">USE_IMAKE</code> is defined.</p>
                   11375: 
                   11376:           <p>In the <span class="emphasis"><em>install</em></span>
                   11377:           phase, the following variables are useful. They are all
                   11378:           variations of the <a href=
                   11379:           "http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   11380:           <span class="citerefentry"><span class=
                   11381:           "refentrytitle">install</span>(1)</span></a> command that
                   11382:           have the owner, group and permissions preset.
                   11383:           <code class="varname">INSTALL</code> is the plain install
                   11384:           command. The specialized variants, together with their
                   11385:           intended use, are:</p>
                   11386: 
                   11387:           <div class="variablelist">
                   11388:             <dl>
                   11389:               <dt><span class="term"><code class=
                   11390:               "varname">INSTALL_PROGRAM_DIR</code></span></dt>
                   11391: 
                   11392:               <dd>
                   11393:                 <p>directories that contain binaries</p>
                   11394:               </dd>
                   11395: 
                   11396:               <dt><span class="term"><code class=
                   11397:               "varname">INSTALL_SCRIPT_DIR</code></span></dt>
                   11398: 
                   11399:               <dd>
                   11400:                 <p>directories that contain scripts</p>
                   11401:               </dd>
                   11402: 
                   11403:               <dt><span class="term"><code class=
                   11404:               "varname">INSTALL_LIB_DIR</code></span></dt>
                   11405: 
                   11406:               <dd>
                   11407:                 <p>directories that contain shared and static
                   11408:                 libraries</p>
                   11409:               </dd>
                   11410: 
                   11411:               <dt><span class="term"><code class=
                   11412:               "varname">INSTALL_DATA_DIR</code></span></dt>
                   11413: 
                   11414:               <dd>
                   11415:                 <p>directories that contain data files</p>
                   11416:               </dd>
                   11417: 
                   11418:               <dt><span class="term"><code class=
                   11419:               "varname">INSTALL_MAN_DIR</code></span></dt>
                   11420: 
                   11421:               <dd>
                   11422:                 <p>directories that contain man pages</p>
                   11423:               </dd>
                   11424: 
                   11425:               <dt><span class="term"><code class=
                   11426:               "varname">INSTALL_PROGRAM</code></span></dt>
                   11427: 
                   11428:               <dd>
                   11429:                 <p>binaries that can be stripped from debugging
                   11430:                 symbols</p>
                   11431:               </dd>
                   11432: 
                   11433:               <dt><span class="term"><code class=
                   11434:               "varname">INSTALL_SCRIPT</code></span></dt>
                   11435: 
                   11436:               <dd>
                   11437:                 <p>binaries that cannot be stripped</p>
                   11438:               </dd>
                   11439: 
                   11440:               <dt><span class="term"><code class=
                   11441:               "varname">INSTALL_GAME</code></span></dt>
                   11442: 
                   11443:               <dd>
                   11444:                 <p>game binaries</p>
                   11445:               </dd>
                   11446: 
                   11447:               <dt><span class="term"><code class=
                   11448:               "varname">INSTALL_LIB</code></span></dt>
                   11449: 
                   11450:               <dd>
                   11451:                 <p>shared and static libraries</p>
                   11452:               </dd>
                   11453: 
                   11454:               <dt><span class="term"><code class=
                   11455:               "varname">INSTALL_DATA</code></span></dt>
                   11456: 
                   11457:               <dd>
                   11458:                 <p>data files</p>
                   11459:               </dd>
                   11460: 
                   11461:               <dt><span class="term"><code class=
                   11462:               "varname">INSTALL_GAME_DATA</code></span></dt>
                   11463: 
                   11464:               <dd>
                   11465:                 <p>data files for games</p>
                   11466:               </dd>
                   11467: 
                   11468:               <dt><span class="term"><code class=
                   11469:               "varname">INSTALL_MAN</code></span></dt>
                   11470: 
                   11471:               <dd>
                   11472:                 <p>man pages</p>
                   11473:               </dd>
                   11474:             </dl>
                   11475:           </div>
                   11476: 
                   11477:           <p>Some other variables are:</p>
                   11478: 
                   11479:           <div class="variablelist">
                   11480:             <dl>
                   11481:               <dt><span class="term"><code class=
                   11482:               "varname">INSTALLATION_DIRS</code></span></dt>
                   11483: 
                   11484:               <dd>
                   11485:                 <p>A list of directories relative to <code class=
                   11486:                 "varname">PREFIX</code> that are created by pkgsrc
                   11487:                 at the beginning of the <span class=
                   11488:                 "emphasis"><em>install</em></span> phase. If this
                   11489:                 variable is set, <code class=
                   11490:                 "varname">NO_MTREE</code>=&#8220;<span class=
                   11491:                 "quote">yes</span>&#8221; is assumed, which means
                   11492:                 that the package claims to create all needed
                   11493:                 directories itself before installing files to it.
                   11494:                 Therefore this variable should only be set in
                   11495:                 <code xmlns=
                   11496:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11497:                 "filename">Makefile</code>s that are under control
                   11498:                 of the package's author.</p>
                   11499:               </dd>
                   11500:             </dl>
                   11501:           </div>
1.56      rillig   11502:         </div>
                   11503: 
1.67      hubertf  11504:         <div class="sect1" lang="en">
1.56      rillig   11505:           <div class="titlepage">
                   11506:             <div>
                   11507:               <div>
                   11508:                 <h2 class="title" style="clear: both"><a name=
                   11509:                 "build.package"></a>14.15.&nbsp;The <span class=
                   11510:                 "emphasis"><em>package</em></span> phase</h2>
                   11511:               </div>
                   11512:             </div>
                   11513:           </div>
                   11514: 
                   11515:           <p>[TODO]</p>
1.1       grant    11516:         </div>
                   11517: 
1.67      hubertf  11518:         <div class="sect1" lang="en">
1.1       grant    11519:           <div class="titlepage">
                   11520:             <div>
                   11521:               <div>
                   11522:                 <h2 class="title" style="clear: both"><a name=
1.56      rillig   11523:                 "build.helpful-targets"></a>14.16.&nbsp;Other
1.1       grant    11524:                 helpful targets</h2>
                   11525:               </div>
                   11526:             </div>
                   11527:           </div>
                   11528: 
                   11529:           <div class="variablelist">
                   11530:             <dl>
                   11531:               <dt><span class="term">pre/post-*</span></dt>
                   11532: 
                   11533:               <dd>
                   11534:                 <p>For any of the main targets described in the
                   11535:                 previous section, two auxiliary targets exist with
                   11536:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   11537:                 &#8220;<span class="quote">post-</span>&#8221; used
                   11538:                 as a prefix for the main target's name. These
                   11539:                 targets are invoked before and after the main
                   11540:                 target is called, allowing extra configuration or
                   11541:                 installation steps be performed from a package's
                   11542:                 Makefile, for example, which a program's configure
                   11543:                 script or install target omitted.</p>
                   11544:               </dd>
                   11545: 
                   11546:               <dt><span class="term">do-*</span></dt>
                   11547: 
                   11548:               <dd>
                   11549:                 <p>Should one of the main targets do the wrong
                   11550:                 thing, and should there be no variable to fix this,
                   11551:                 you can redefine it with the do-* target. (Note
                   11552:                 that redefining the target itself instead of the
                   11553:                 do-* target is a bad idea, as the pre-* and post-*
                   11554:                 targets won't be called anymore, etc.) You will not
                   11555:                 usually need to do this.</p>
                   11556:               </dd>
                   11557: 
                   11558:               <dt><span class="term">reinstall</span></dt>
                   11559: 
                   11560:               <dd>
1.14      xtraeme  11561:                 <p>If you did a <span><strong class="command">make
                   11562:                 install</strong></span> and you noticed some file
                   11563:                 was not installed properly, you can repeat the
1.1       grant    11564:                 installation with this target, which will ignore
                   11565:                 the &#8220;<span class="quote">already
                   11566:                 installed</span>&#8221; flag.</p>
                   11567:               </dd>
                   11568: 
                   11569:               <dt><span class="term">deinstall</span></dt>
                   11570: 
                   11571:               <dd>
1.24      wiz      11572:                 <p>This target does a <a href=
                   11573:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11574:                 <span class="citerefentry"><span class=
                   11575:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   11576:                 the current directory, effectively de-installing
                   11577:                 the package. The following variables can be used to
                   11578:                 tune the behaviour:</p>
1.1       grant    11579: 
                   11580:                 <div class="variablelist">
                   11581:                   <dl>
1.14      xtraeme  11582:                     <dt><span class="term"><code class=
                   11583:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    11584: 
                   11585:                     <dd>
                   11586:                       <p>Add a "-v" to the <a href=
                   11587:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11588:                       <span class="citerefentry"><span class=
                   11589:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11590:                       command.</p>
                   11591:                     </dd>
                   11592: 
1.14      xtraeme  11593:                     <dt><span class="term"><code class=
                   11594:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    11595: 
                   11596:                     <dd>
                   11597:                       <p>Remove all packages that require (depend
                   11598:                       on) the given package. This can be used to
                   11599:                       remove any packages that may have been pulled
                   11600:                       in by a given package, e.g. if
1.14      xtraeme  11601:                       <span><strong class="command">make deinstall
                   11602:                       DEINSTALLDEPENDS=1</strong></span> is done in
1.45      wiz      11603:                       <code xmlns=
                   11604:                       "http://www.w3.org/TR/xhtml1/transitional"
                   11605:                       class="filename">pkgsrc/x11/kde</code>, this
                   11606:                       is likely to remove whole KDE. Works by
1.1       grant    11607:                       adding &#8220;<span class=
                   11608:                       "quote">-R</span>&#8221; to the <a href=
                   11609:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   11610:                       <span class="citerefentry"><span class=
                   11611:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   11612:                       command line.</p>
                   11613:                     </dd>
                   11614:                   </dl>
                   11615:                 </div>
                   11616:               </dd>
                   11617: 
                   11618:               <dt><span class="term">update</span></dt>
                   11619: 
                   11620:               <dd>
                   11621:                 <p>This target causes the current package to be
                   11622:                 updated to the latest version. The package and all
                   11623:                 depending packages first get de-installed, then
                   11624:                 current versions of the corresponding packages get
                   11625:                 compiled and installed. This is similar to manually
                   11626:                 noting which packages are currently installed, then
1.14      xtraeme  11627:                 performing a series of <span><strong class=
                   11628:                 "command">make deinstall</strong></span> and
                   11629:                 <span><strong class="command">make
                   11630:                 install</strong></span> (or whatever <code class=
                   11631:                 "varname">UPDATE_TARGET</code> is set to) for these
                   11632:                 packages.</p>
1.1       grant    11633: 
                   11634:                 <p>You can use the &#8220;<span class=
                   11635:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  11636:                 package updating in case a previous
                   11637:                 <span><strong class="command">make
                   11638:                 update</strong></span> was interrupted for some
                   11639:                 reason. However, in this case, make sure you don't
                   11640:                 call <span><strong class="command">make
                   11641:                 clean</strong></span> or otherwise remove the list
                   11642:                 of dependent packages in <code class=
1.47      reed     11643:                 "varname">WRKDIR</code>. Otherwise, you lose the
1.1       grant    11644:                 ability to automatically update the current package
                   11645:                 along with the dependent packages you have
                   11646:                 installed.</p>
                   11647: 
1.14      xtraeme  11648:                 <p>Resuming an interrupted <span><strong class=
                   11649:                 "command">make update</strong></span> will only
                   11650:                 work as long as the package tree remains unchanged.
                   11651:                 If the source code for one of the packages to be
                   11652:                 updated has been changed, resuming
                   11653:                 <span><strong class="command">make
                   11654:                 update</strong></span> will most certainly
                   11655:                 fail!</p>
1.1       grant    11656: 
                   11657:                 <p>The following variables can be used either on
1.45      wiz      11658:                 the command line or in <code xmlns=
                   11659:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11660:                 "filename">/etc/mk.conf</code> to alter the
                   11661:                 behaviour of <span><strong class="command">make
                   11662:                 update</strong></span>:</p>
1.1       grant    11663: 
                   11664:                 <div class="variablelist">
                   11665:                   <dl>
1.14      xtraeme  11666:                     <dt><span class="term"><code class=
                   11667:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    11668: 
                   11669:                     <dd>
                   11670:                       <p>Install target to recursively use for the
                   11671:                       updated package and the dependent packages.
1.14      xtraeme  11672:                       Defaults to <code class=
                   11673:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    11674:                       &#8220;<span class=
                   11675:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  11676:                       <span><strong class="command">make
                   11677:                       update</strong></span>. e.g.
                   11678:                       <span><strong class="command">make update
                   11679:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    11680:                     </dd>
                   11681: 
1.14      xtraeme  11682:                     <dt><span class="term"><code class=
                   11683:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    11684: 
                   11685:                     <dd>
                   11686:                       <p>Don't clean up after updating. Useful if
                   11687:                       you want to leave the work sources of the
                   11688:                       updated packages around for inspection or
                   11689:                       other purposes. Be sure you eventually clean
                   11690:                       up the source tree (see the
                   11691:                       &#8220;<span class=
                   11692:                       "quote">clean-update</span>&#8221; target
                   11693:                       below) or you may run into troubles with old
                   11694:                       source code still lying around on your next
1.14      xtraeme  11695:                       <span><strong class=
                   11696:                       "command">make</strong></span> or
                   11697:                       <span><strong class="command">make
                   11698:                       update</strong></span>.</p>
1.1       grant    11699:                     </dd>
                   11700: 
1.14      xtraeme  11701:                     <dt><span class="term"><code class=
                   11702:                     "varname">REINSTALL</code></span></dt>
1.1       grant    11703: 
                   11704:                     <dd>
                   11705:                       <p>Deinstall each package before installing
1.14      xtraeme  11706:                       (making <code class=
                   11707:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    11708:                       necessary if the &#8220;<span class=
                   11709:                       "quote">clean-update</span>&#8221; target
                   11710:                       (see below) was called after interrupting a
1.14      xtraeme  11711:                       running <span><strong class="command">make
                   11712:                       update</strong></span>.</p>
1.1       grant    11713:                     </dd>
                   11714: 
1.14      xtraeme  11715:                     <dt><span class="term"><code class=
                   11716:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    11717: 
                   11718:                     <dd>
                   11719:                       <p>Allows you to disable recursion and
                   11720:                       hardcode the target for packages. The default
                   11721:                       is &#8220;<span class=
                   11722:                       "quote">update</span>&#8221; for the update
                   11723:                       target, facilitating a recursive update of
1.14      xtraeme  11724:                       prerequisite packages. Only set <code class=
                   11725:                       "varname">DEPENDS_TARGET</code> if you want
                   11726:                       to disable recursive updates. Use
                   11727:                       <code class="varname">UPDATE_TARGET</code>
                   11728:                       instead to just set a specific target for
                   11729:                       each package to be installed during
                   11730:                       <span><strong class="command">make
                   11731:                       update</strong></span> (see above).</p>
1.1       grant    11732:                     </dd>
                   11733:                   </dl>
                   11734:                 </div>
                   11735:               </dd>
                   11736: 
                   11737:               <dt><span class="term">clean-update</span></dt>
                   11738: 
                   11739:               <dd>
                   11740:                 <p>Clean the source tree for all packages that
1.14      xtraeme  11741:                 would get updated if <span><strong class=
                   11742:                 "command">make update</strong></span> was called
                   11743:                 from the current directory. This target should not
                   11744:                 be used if the current package (or any of its
                   11745:                 depending packages) have already been de-installed
                   11746:                 (e.g., after calling <span><strong class=
                   11747:                 "command">make update</strong></span>) or you may
                   11748:                 lose some packages you intended to update. As a
                   11749:                 rule of thumb: only use this target <span class=
                   11750:                 "emphasis"><em>before</em></span> the first time
                   11751:                 you run <span><strong class="command">make
                   11752:                 update</strong></span> and only if you have a dirty
                   11753:                 package tree (e.g., if you used <code class=
                   11754:                 "varname">NOCLEAN</code>).</p>
1.1       grant    11755: 
1.47      reed     11756:                 <p>If you are unsure about whether your tree is
                   11757:                 clean, you can either perform a
1.14      xtraeme  11758:                 <span><strong class="command">make
1.47      reed     11759:                 clean</strong></span> at the top of the tree, or
                   11760:                 use the following sequence of commands from the
                   11761:                 directory of the package you want to update
                   11762:                 (<span class="emphasis"><em>before</em></span>
                   11763:                 running <span><strong class="command">make
1.14      xtraeme  11764:                 update</strong></span> for the first time,
                   11765:                 otherwise you lose all the packages you wanted to
                   11766:                 update!):</p>
1.1       grant    11767:                 <pre class="screen">
1.14      xtraeme  11768: <code class="prompt">#</code> <strong class=
                   11769: "userinput"><code>make clean-update</code></strong>
                   11770: <code class="prompt">#</code> <strong class=
                   11771: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   11772: <code class="prompt">#</code> <strong class=
                   11773: "userinput"><code>make update</code></strong>
1.1       grant    11774: </pre>
                   11775: 
                   11776:                 <p>The following variables can be used either on
1.45      wiz      11777:                 the command line or in <code xmlns=
                   11778:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11779:                 "filename">/etc/mk.conf</code> to alter the
                   11780:                 behaviour of <span><strong class="command">make
                   11781:                 clean-update</strong></span>:</p>
1.1       grant    11782: 
                   11783:                 <div class="variablelist">
                   11784:                   <dl>
1.14      xtraeme  11785:                     <dt><span class="term"><code class=
                   11786:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    11787: 
                   11788:                     <dd>
1.14      xtraeme  11789:                       <p>After <span><strong class="command">make
                   11790:                       clean</strong></span>, do not reconstruct the
                   11791:                       list of directories to update for this
                   11792:                       package. Only use this if
                   11793:                       <span><strong class="command">make
                   11794:                       update</strong></span> successfully installed
                   11795:                       all packages you wanted to update. Normally,
                   11796:                       this is done automatically on
                   11797:                       <span><strong class="command">make
                   11798:                       update</strong></span>, but may have been
                   11799:                       suppressed by the <code class=
                   11800:                       "varname">NOCLEAN</code> variable (see
1.1       grant    11801:                       above).</p>
                   11802:                     </dd>
                   11803:                   </dl>
                   11804:                 </div>
                   11805:               </dd>
                   11806: 
                   11807:               <dt><span class="term">info</span></dt>
                   11808: 
                   11809:               <dd>
                   11810:                 <p>This target invokes <a href=
                   11811:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   11812:                 <span class="citerefentry"><span class=
                   11813:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   11814:                 the current package. You can use this to check
                   11815:                 which version of a package is installed.</p>
                   11816:               </dd>
                   11817: 
                   11818:               <dt><span class="term">readme</span></dt>
                   11819: 
                   11820:               <dd>
1.45      wiz      11821:                 <p>This target generates a <code xmlns=
                   11822:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11823:                 "filename">README.html</code> file, which can be
1.1       grant    11824:                 viewed using a browser such as <a xmlns=
                   11825:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11826:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.45      wiz      11827:                 target="_top"><code xmlns="" class=
                   11828:                 "filename">www/mozilla</code></a> or <a xmlns=
1.20      ben      11829:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   11830:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
1.45      wiz      11831:                 target="_top"><code xmlns="" class=
                   11832:                 "filename">www/links</code></a>. The generated
                   11833:                 files contain references to any packages which are
                   11834:                 in the <code class="varname">PACKAGES</code>
                   11835:                 directory on the local host. The generated files
                   11836:                 can be made to refer to URLs based on <code class=
1.20      ben      11837:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   11838:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
1.45      wiz      11839:                 wanted to generate <code xmlns=
                   11840:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11841:                 "filename">README.html</code> files which pointed
                   11842:                 to binary packages on the local machine, in the
1.45      wiz      11843:                 directory <code xmlns=
                   11844:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      11845:                 "filename">/usr/packages</code>, set <code class=
                   11846:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   11847:                 and <code class=
                   11848:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   11849:                 <code class="varname">${PACKAGES}</code> directory
                   11850:                 and its subdirectories will be searched for all the
                   11851:                 binary packages.</p>
1.1       grant    11852:               </dd>
                   11853: 
                   11854:               <dt><span class="term">readme-all</span></dt>
                   11855: 
                   11856:               <dd>
1.45      wiz      11857:                 <p>Use this target to create a file <code xmlns=
                   11858:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11859:                 "filename">README-all.html</code> which contains a
1.1       grant    11860:                 list of all packages currently available in the
                   11861:                 NetBSD Packages Collection, together with the
                   11862:                 category they belong to and a short description.
1.45      wiz      11863:                 This file is compiled from the <code xmlns=
                   11864:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11865:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    11866:                 sure to run this <span class=
1.14      xtraeme  11867:                 "emphasis"><em>after</em></span> a
                   11868:                 <span><strong class="command">make
                   11869:                 readme</strong></span>.</p>
1.1       grant    11870:               </dd>
                   11871: 
                   11872:               <dt><span class="term">cdrom-readme</span></dt>
                   11873: 
                   11874:               <dd>
                   11875:                 <p>This is very much the same as the
                   11876:                 &#8220;<span class="quote">readme</span>&#8221;
                   11877:                 target (see above), but is to be used when
                   11878:                 generating a pkgsrc tree to be written to a CD-ROM.
1.45      wiz      11879:                 This target also produces <code xmlns=
                   11880:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11881:                 "filename">README.html</code> files, and can be
                   11882:                 made to refer to URLs based on <code class=
                   11883:                 "varname">CDROM_PKG_URL_HOST</code> and
                   11884:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    11885:               </dd>
                   11886: 
                   11887:               <dt><span class="term">show-distfiles</span></dt>
                   11888: 
                   11889:               <dd>
                   11890:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  11891:                 are needed to build the package. (<code class=
                   11892:                 "varname">DISTFILES</code> and <code class=
1.45      wiz      11893:                 "varname">PATCHFILES</code>, but not <code xmlns=
                   11894:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11895:                 "filename">patches/*</code>)</p>
1.1       grant    11896:               </dd>
                   11897: 
                   11898:               <dt><span class="term">show-downlevel</span></dt>
                   11899: 
                   11900:               <dd>
                   11901:                 <p>This target shows nothing if the package is not
                   11902:                 installed. If a version of this package is
                   11903:                 installed, but is not the version provided in this
                   11904:                 version of pkgsrc, then a warning message is
                   11905:                 displayed. This target can be used to show which of
                   11906:                 your installed packages are downlevel, and so the
                   11907:                 old versions can be deleted, and the current ones
                   11908:                 added.</p>
                   11909:               </dd>
                   11910: 
                   11911:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   11912: 
                   11913:               <dd>
                   11914:                 <p>This target shows the directory in the pkgsrc
                   11915:                 hierarchy from which the package can be built and
                   11916:                 installed. This may not be the same directory as
                   11917:                 the one from which the package was installed. This
                   11918:                 target is intended to be used by people who may
                   11919:                 wish to upgrade many packages on a single host, and
                   11920:                 can be invoked from the top-level pkgsrc Makefile
                   11921:                 by using the &#8220;<span class=
                   11922:                 "quote">show-host-specific-pkgs</span>&#8221;
                   11923:                 target.</p>
                   11924:               </dd>
                   11925: 
                   11926:               <dt><span class=
                   11927:               "term">show-installed-depends</span></dt>
                   11928: 
                   11929:               <dd>
                   11930:                 <p>This target shows which installed packages match
1.14      xtraeme  11931:                 the current package's <code class=
                   11932:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    11933:                 dependencies are causing build problems.</p>
                   11934:               </dd>
                   11935: 
                   11936:               <dt><span class="term">check-shlibs</span></dt>
                   11937: 
                   11938:               <dd>
                   11939:                 <p>After a package is installed, check all its
                   11940:                 binaries and (on ELF platforms) shared libraries to
                   11941:                 see if they find the shared libs they need. Run by
1.14      xtraeme  11942:                 default if <code class=
                   11943:                 "varname">PKG_DEVELOPER</code> is set in
1.45      wiz      11944:                 <code xmlns=
                   11945:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11946:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    11947:               </dd>
                   11948: 
                   11949:               <dt><span class="term">print-PLIST</span></dt>
                   11950: 
                   11951:               <dd>
                   11952:                 <p>After a &#8220;<span class="quote">make
                   11953:                 install</span>&#8221; from a new or upgraded pkg,
                   11954:                 this prints out an attempt to generate a new
1.45      wiz      11955:                 <code xmlns=
                   11956:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11957:                 "filename">PLIST</code> from a <span><strong class=
                   11958:                 "command">find -newer
1.14      xtraeme  11959:                 work/.extract_done</strong></span>. An attempt is
                   11960:                 made to care for shared libs etc., but it is
1.1       grant    11961:                 <span class="emphasis"><em>strongly</em></span>
                   11962:                 recommended to review the result before putting it
1.45      wiz      11963:                 into <code xmlns=
                   11964:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11965:                 "filename">PLIST</code>. On upgrades, it's useful
                   11966:                 to diff the output of this command against an
                   11967:                 already existing <code xmlns=
                   11968:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  11969:                 "filename">PLIST</code> file.</p>
1.1       grant    11970: 
1.24      wiz      11971:                 <p>If the package installs files via <a href=
                   11972:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11973:                 <span class="citerefentry"><span class=
                   11974:                 "refentrytitle">tar</span>(1)</span></a> or other
                   11975:                 methods that don't update file access times, be
                   11976:                 sure to add these files manually to your
1.45      wiz      11977:                 <code xmlns=
                   11978:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   11979:                 "filename">PLIST</code>, as the &#8220;<span class=
                   11980:                 "quote">find -newer</span>&#8221; command used by
                   11981:                 this target won't catch them!</p>
1.1       grant    11982: 
                   11983:                 <p>See <a href="#print-PLIST" title=
1.38      dillo    11984:                 "10.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;10.3,
1.14      xtraeme  11985:                 &#8220;Tweaking output of <span><strong class=
                   11986:                 "command">make
                   11987:                 print-PLIST</strong></span>&#8221;</a> for more
                   11988:                 information on this target.</p>
1.1       grant    11989:               </dd>
                   11990: 
                   11991:               <dt><span class="term">bulk-package</span></dt>
                   11992: 
                   11993:               <dd>
                   11994:                 <p>Used to do bulk builds. If an appropriate binary
                   11995:                 package already exists, no action is taken. If not,
                   11996:                 this target will compile, install and package it
1.47      reed     11997:                 (and its depends, if <code class=
1.14      xtraeme  11998:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    11999:                 <a href="#binary.configuration" title=
1.38      dillo    12000:                 "6.3.1.&nbsp;Configuration">Section&nbsp;6.3.1,
1.47      reed     12001:                 &#8220;Configuration&#8221;</a>). After creating
                   12002:                 the binary package, the sources, the just-installed
                   12003:                 package and its required packages are removed,
1.1       grant    12004:                 preserving free disk space.</p>
                   12005: 
                   12006:                 <p><span class="emphasis"><em>Beware that this
                   12007:                 target may deinstall all packages installed on a
                   12008:                 system!</em></span></p>
                   12009:               </dd>
                   12010: 
                   12011:               <dt><span class="term">bulk-install</span></dt>
                   12012: 
                   12013:               <dd>
                   12014:                 <p>Used during bulk-installs to install required
1.47      reed     12015:                 packages. If an up-to-date binary package is
1.1       grant    12016:                 available, it will be installed via <a href=
                   12017:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   12018:                 <span class="citerefentry"><span class=
                   12019:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  12020:                 not, <span><strong class="command">make
                   12021:                 bulk-package</strong></span> will be executed, but
1.47      reed     12022:                 the installed binary won't be removed.</p>
1.1       grant    12023: 
                   12024:                 <p>A binary package is considered
1.47      reed     12025:                 &#8220;<span class="quote">up-to-date</span>&#8221;
1.1       grant    12026:                 to be installed via <a href=
                   12027:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   12028:                 <span class="citerefentry"><span class=
                   12029:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   12030:                 if:</p>
                   12031: 
                   12032:                 <div class="itemizedlist">
                   12033:                   <ul type="disc">
                   12034:                     <li>
1.45      wiz      12035:                       <p>None of the package's files (<code xmlns=
                   12036:                       "http://www.w3.org/TR/xhtml1/transitional"
                   12037:                       class="filename">Makefile</code>, ...) were
1.14      xtraeme  12038:                       modified since it was built.</p>
1.1       grant    12039:                     </li>
                   12040: 
                   12041:                     <li>
                   12042:                       <p>None of the package's required (binary)
                   12043:                       packages were modified since it was
                   12044:                       built.</p>
                   12045:                     </li>
                   12046:                   </ul>
                   12047:                 </div>
                   12048: 
                   12049:                 <p><span class="emphasis"><em>Beware that this
                   12050:                 target may deinstall all packages installed on a
                   12051:                 system!</em></span></p>
                   12052:               </dd>
                   12053:             </dl>
                   12054:           </div>
                   12055:         </div>
                   12056:       </div>
                   12057: 
1.67      hubertf  12058:       <div class="chapter" lang="en">
1.1       grant    12059:         <div class="titlepage">
                   12060:           <div>
                   12061:             <div>
1.67      hubertf  12062:               <h2 class="title"><a name=
1.68      rillig   12063:               "tools"></a>Chapter&nbsp;15.&nbsp;Tools needed for
                   12064:               building or running</h2>
                   12065:             </div>
                   12066:           </div>
                   12067:         </div>
                   12068: 
                   12069:         <div class="toc">
                   12070:           <p><b>Table of Contents</b></p>
                   12071: 
                   12072:           <dl>
                   12073:             <dt><span class="sect1"><a href="#pkgsrc-tools">15.1.
                   12074:             Tools for pkgsrc builds</a></span></dt>
                   12075: 
                   12076:             <dt><span class="sect1"><a href="#package-tools">15.2.
                   12077:             Tools needed by packages</a></span></dt>
                   12078: 
                   12079:             <dt><span class="sect1"><a href="#platform-tools">15.3.
                   12080:             Tools provided by platforms</a></span></dt>
                   12081:           </dl>
                   12082:         </div>
                   12083: 
                   12084:         <p>The <code class="varname">USE_TOOLS</code> definition is
                   12085:         used both internally by pkgsrc and also for individual
                   12086:         packages to define what commands are needed for building a
                   12087:         package (like <code class="varname">BUILD_DEPENDS</code>)
                   12088:         or for later run-time of an installed packaged (such as
                   12089:         <code class="varname">DEPENDS</code>). If the native system
                   12090:         provides an adequate tool, then in many cases, a pkgsrc
                   12091:         package will not be used.</p>
                   12092: 
                   12093:         <p>When building a package, the replacement tools are made
                   12094:         available in a directory (as symlinks or wrapper scripts)
                   12095:         that is early in the executable search path. Just like the
                   12096:         buildlink system, this helps with consistent builds.</p>
                   12097: 
                   12098:         <p>A tool may be needed to help build a specific package.
                   12099:         For example, perl, GNU make (gmake) or yacc may be
                   12100:         needed.</p>
                   12101: 
                   12102:         <p>Also a tool may be needed, for example, because the
                   12103:         native system's supplied tool may be inefficient for
                   12104:         building a package with pkgsrc. For example, a package may
                   12105:         need GNU awk, bison (instead of yacc) or a better sed.</p>
                   12106: 
                   12107:         <p>The tools used by a package can be listed by running
                   12108:         <span><strong class="command">make
                   12109:         show-tools</strong></span>.</p>
                   12110: 
                   12111:         <div class="sect1" lang="en">
                   12112:           <div class="titlepage">
                   12113:             <div>
                   12114:               <div>
                   12115:                 <h2 class="title" style="clear: both"><a name=
                   12116:                 "pkgsrc-tools"></a>15.1.&nbsp;Tools for pkgsrc
                   12117:                 builds</h2>
                   12118:               </div>
                   12119:             </div>
                   12120:           </div>
                   12121: 
                   12122:           <p>The default set of tools used by pkgsrc is defined in
                   12123:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12124:           class="filename">bsd.pkg.mk</code>. This includes
                   12125:           standard Unix tools, such as: <span><strong class=
                   12126:           "command">cat</strong></span>, <span><strong class=
                   12127:           "command">awk</strong></span>, <span><strong class=
                   12128:           "command">chmod</strong></span>, <span><strong class=
                   12129:           "command">test</strong></span>, and so on. These can be
                   12130:           seen by running: <span><strong class="command">make
                   12131:           show-var VARNAME=USE_TOOLS</strong></span>.</p>
                   12132: 
                   12133:           <p>If a package needs a specific program to build then
                   12134:           the <code class="varname">USE_TOOLS</code> variable can
                   12135:           be used to define the tools needed.</p>
                   12136:         </div>
                   12137: 
                   12138:         <div class="sect1" lang="en">
                   12139:           <div class="titlepage">
                   12140:             <div>
                   12141:               <div>
                   12142:                 <h2 class="title" style="clear: both"><a name=
                   12143:                 "package-tools"></a>15.2.&nbsp;Tools needed by
                   12144:                 packages</h2>
                   12145:               </div>
                   12146:             </div>
                   12147:           </div>
                   12148: 
                   12149:           <p>In the following examples, the :pkgsrc means to use
                   12150:           the pkgsrc version and not the native version for a build
                   12151:           dependency. And the :run means that it is used for a
                   12152:           run-time dependencies also (and becomes a DEPENDS). The
                   12153:           default is a build dependency which can be set with
                   12154:           :build. (So in this example, it is the same as
                   12155:           gmake:build and pkg-config:build.)</p>
                   12156:           <pre class="programlisting">
                   12157: USE_TOOLS+=     mktemp:pkgsrc
                   12158: USE_TOOLS+=     gmake perl:run pkg-config
                   12159: </pre>
                   12160: 
                   12161:           <p>When using the tools framework, a <code class=
                   12162:           "varname">TOOLS_PATH.foo</code> variable is defined which
                   12163:           contains the full path to the appropriate tool. For
                   12164:           example, <code class="varname">TOOLS_PATH.bash</code>
                   12165:           could be &#8220;<span class=
                   12166:           "quote">/bin/bash</span>&#8221; on Linux systems.</p>
                   12167: 
                   12168:           <p>If you always need a pkgsrc version of the tool at
                   12169:           run-time, then just use <code class=
                   12170:           "varname">DEPENDS</code> instead.</p>
                   12171:         </div>
                   12172: 
                   12173:         <div class="sect1" lang="en">
                   12174:           <div class="titlepage">
                   12175:             <div>
                   12176:               <div>
                   12177:                 <h2 class="title" style="clear: both"><a name=
                   12178:                 "platform-tools"></a>15.3.&nbsp;Tools provided by
                   12179:                 platforms</h2>
                   12180:               </div>
                   12181:             </div>
                   12182:           </div>
                   12183: 
                   12184:           <p>When improving or porting pkgsrc to a new platform,
                   12185:           have a look at (or create) the corresponding platform
                   12186:           specific make file fragment under <code xmlns=
                   12187:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   12188:           "filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which
                   12189:           defines the name of the common tools. For example:</p>
                   12190:           <pre class="programlisting">
                   12191: .if exists(/usr/bin/bzcat)
                   12192: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzcat
                   12193: .elif exists(/usr/bin/bzip2)
                   12194: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzip2 -cd
                   12195: .endif
                   12196: 
                   12197: TOOLS_PLATFORM.true?=           true                    # shell builtin
                   12198: </pre>
                   12199:         </div>
                   12200:       </div>
                   12201: 
                   12202:       <div class="chapter" lang="en">
                   12203:         <div class="titlepage">
                   12204:           <div>
                   12205:             <div>
                   12206:               <h2 class="title"><a name=
                   12207:               "fixes"></a>Chapter&nbsp;16.&nbsp;Making your package
1.55      rillig   12208:               work</h2>
1.1       grant    12209:             </div>
                   12210:           </div>
                   12211:         </div>
                   12212: 
                   12213:         <div class="toc">
                   12214:           <p><b>Table of Contents</b></p>
                   12215: 
                   12216:           <dl>
1.30      wiz      12217:             <dt><span class="sect1"><a href=
1.68      rillig   12218:             "#general-operation">16.1. General
1.30      wiz      12219:             operation</a></span></dt>
1.1       grant    12220: 
                   12221:             <dd>
                   12222:               <dl>
                   12223:                 <dt><span class="sect2"><a href=
1.68      rillig   12224:                 "#pulling-vars-from-etc-mk.conf">16.1.1. How to
1.30      wiz      12225:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    12226: 
                   12227:                 <dt><span class="sect2"><a href=
1.68      rillig   12228:                 "#where-to-install-documentation">16.1.2. Where to
1.31      wiz      12229:                 install documentation</a></span></dt>
                   12230: 
                   12231:                 <dt><span class="sect2"><a href=
1.68      rillig   12232:                 "#restricted-packages">16.1.3. Restricted
1.1       grant    12233:                 packages</a></span></dt>
                   12234: 
                   12235:                 <dt><span class="sect2"><a href=
1.68      rillig   12236:                 "#dependencies">16.1.4. Handling
1.1       grant    12237:                 dependencies</a></span></dt>
                   12238: 
                   12239:                 <dt><span class="sect2"><a href=
1.68      rillig   12240:                 "#conflicts">16.1.5. Handling conflicts with other
1.1       grant    12241:                 packages</a></span></dt>
                   12242: 
                   12243:                 <dt><span class="sect2"><a href=
1.68      rillig   12244:                 "#not-building-packages">16.1.6. Packages that
1.30      wiz      12245:                 cannot or should not be built</a></span></dt>
1.1       grant    12246: 
                   12247:                 <dt><span class="sect2"><a href=
1.68      rillig   12248:                 "#undeletable-packages">16.1.7. Packages which
1.30      wiz      12249:                 should not be deleted, once
                   12250:                 installed</a></span></dt>
1.1       grant    12251: 
                   12252:                 <dt><span class="sect2"><a href=
1.68      rillig   12253:                 "#security-handling">16.1.8. Handling packages with
1.1       grant    12254:                 security problems</a></span></dt>
                   12255: 
                   12256:                 <dt><span class="sect2"><a href=
1.68      rillig   12257:                 "#compiler-bugs">16.1.9. How to handle compiler
1.1       grant    12258:                 bugs</a></span></dt>
                   12259: 
                   12260:                 <dt><span class="sect2"><a href=
1.68      rillig   12261:                 "#bumping-pkgrevision">16.1.10. How to handle
1.30      wiz      12262:                 incrementing versions when fixing an existing
1.1       grant    12263:                 package</a></span></dt>
                   12264: 
                   12265:                 <dt><span class="sect2"><a href=
1.68      rillig   12266:                 "#portability-of-packages">16.1.11. Portability of
1.1       grant    12267:                 packages</a></span></dt>
                   12268:               </dl>
                   12269:             </dd>
                   12270: 
1.30      wiz      12271:             <dt><span class="sect1"><a href=
1.68      rillig   12272:             "#downloading-issues">16.2. Possible downloading
1.30      wiz      12273:             issues</a></span></dt>
1.1       grant    12274: 
                   12275:             <dd>
                   12276:               <dl>
                   12277:                 <dt><span class="sect2"><a href=
1.68      rillig   12278:                 "#no-plain-download">16.2.1. Packages whose
1.30      wiz      12279:                 distfiles aren't available for plain
1.1       grant    12280:                 downloading</a></span></dt>
                   12281: 
                   12282:                 <dt><span class="sect2"><a href=
1.68      rillig   12283:                 "#modified-distfiles-same-name">16.2.2. How to
1.30      wiz      12284:                 handle modified distfiles with the 'old'
                   12285:                 name</a></span></dt>
1.1       grant    12286:               </dl>
                   12287:             </dd>
                   12288: 
1.30      wiz      12289:             <dt><span class="sect1"><a href=
1.68      rillig   12290:             "#configuration-gotchas">16.3. Configuration
1.30      wiz      12291:             gotchas</a></span></dt>
1.1       grant    12292: 
                   12293:             <dd>
                   12294:               <dl>
                   12295:                 <dt><span class="sect2"><a href=
1.68      rillig   12296:                 "#fixes.libtool">16.3.1. Shared libraries -
1.1       grant    12297:                 libtool</a></span></dt>
                   12298: 
                   12299:                 <dt><span class="sect2"><a href=
1.68      rillig   12300:                 "#using-libtool">16.3.2. Using libtool on GNU
1.30      wiz      12301:                 packages that already support
                   12302:                 libtool</a></span></dt>
1.1       grant    12303: 
                   12304:                 <dt><span class="sect2"><a href=
1.68      rillig   12305:                 "#autoconf-automake">16.3.3. GNU
1.1       grant    12306:                 Autoconf/Automake</a></span></dt>
                   12307:               </dl>
                   12308:             </dd>
                   12309: 
1.68      rillig   12310:             <dt><span class="sect1"><a href="#fixes-build">16.4.
1.55      rillig   12311:             Building the package</a></span></dt>
1.1       grant    12312: 
                   12313:             <dd>
                   12314:               <dl>
                   12315:                 <dt><span class="sect2"><a href=
1.68      rillig   12316:                 "#cpp-defines">16.4.1. CPP defines</a></span></dt>
1.51      rillig   12317: 
1.60      rillig   12318:                 <dt><span class="sect2"><a href=
1.68      rillig   12319:                 "#cpp-list-examples">16.4.2. Examples of CPP
1.60      rillig   12320:                 defines for some platforms</a></span></dt>
                   12321: 
1.68      rillig   12322:                 <dt><span class="sect2"><a href="#cpp-list">16.4.3.
1.51      rillig   12323:                 Getting a list of CPP defines</a></span></dt>
1.1       grant    12324:               </dl>
                   12325:             </dd>
                   12326: 
1.30      wiz      12327:             <dt><span class="sect1"><a href=
1.68      rillig   12328:             "#package-specific-actions">16.5. Package specific
1.30      wiz      12329:             actions</a></span></dt>
1.1       grant    12330: 
                   12331:             <dd>
                   12332:               <dl>
                   12333:                 <dt><span class="sect2"><a href=
1.68      rillig   12334:                 "#user-interaction">16.5.1. User
1.2       hubertf  12335:                 interaction</a></span></dt>
1.1       grant    12336: 
                   12337:                 <dt><span class="sect2"><a href=
1.68      rillig   12338:                 "#handling-licenses">16.5.2. Handling
1.1       grant    12339:                 licenses</a></span></dt>
                   12340: 
                   12341:                 <dt><span class="sect2"><a href=
1.68      rillig   12342:                 "#installing-score-files">16.5.3. Installing score
1.1       grant    12343:                 files</a></span></dt>
                   12344: 
                   12345:                 <dt><span class="sect2"><a href=
1.68      rillig   12346:                 "#perl-scripts">16.5.4. Packages containing perl
1.1       grant    12347:                 scripts</a></span></dt>
                   12348: 
                   12349:                 <dt><span class="sect2"><a href=
1.68      rillig   12350:                 "#hardcoded-paths">16.5.5. Packages with hardcoded
1.30      wiz      12351:                 paths to other interpreters</a></span></dt>
1.1       grant    12352: 
                   12353:                 <dt><span class="sect2"><a href=
1.68      rillig   12354:                 "#perl-modules">16.5.6. Packages installing perl
1.1       grant    12355:                 modules</a></span></dt>
                   12356: 
                   12357:                 <dt><span class="sect2"><a href=
1.68      rillig   12358:                 "#faq.info-files">16.5.7. Packages installing info
1.1       grant    12359:                 files</a></span></dt>
                   12360: 
1.68      rillig   12361:                 <dt><span class="sect2"><a href="#manpages">16.5.8.
1.57      minskim  12362:                 Packages installing man pages</a></span></dt>
                   12363: 
1.1       grant    12364:                 <dt><span class="sect2"><a href=
1.68      rillig   12365:                 "#gconf2-data-files">16.5.9. Packages installing
1.30      wiz      12366:                 GConf2 data files</a></span></dt>
1.1       grant    12367: 
                   12368:                 <dt><span class="sect2"><a href=
1.68      rillig   12369:                 "#scrollkeeper-data-files">16.5.10. Packages
1.30      wiz      12370:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    12371: 
                   12372:                 <dt><span class="sect2"><a href=
1.68      rillig   12373:                 "#x11-fonts">16.5.11. Packages installing X11
1.1       grant    12374:                 fonts</a></span></dt>
                   12375: 
                   12376:                 <dt><span class="sect2"><a href=
1.68      rillig   12377:                 "#gtk2-modules">16.5.12. Packages installing GTK2
1.1       grant    12378:                 modules</a></span></dt>
                   12379: 
                   12380:                 <dt><span class="sect2"><a href=
1.68      rillig   12381:                 "#sgml-xml-data">16.5.13. Packages installing SGML
1.30      wiz      12382:                 or XML data</a></span></dt>
1.1       grant    12383: 
                   12384:                 <dt><span class="sect2"><a href=
1.68      rillig   12385:                 "#mime-database">16.5.14. Packages installing
1.1       grant    12386:                 extensions to the MIME database</a></span></dt>
                   12387: 
                   12388:                 <dt><span class="sect2"><a href=
1.68      rillig   12389:                 "#intltool">16.5.15. Packages using
1.1       grant    12390:                 intltool</a></span></dt>
1.18      xtraeme  12391: 
                   12392:                 <dt><span class="sect2"><a href=
1.68      rillig   12393:                 "#startup-scripts">16.5.16. Packages installing
1.30      wiz      12394:                 startup scripts</a></span></dt>
1.57      minskim  12395: 
                   12396:                 <dt><span class="sect2"><a href=
1.68      rillig   12397:                 "#tex-packages">16.5.17. Packages installing TeX
1.57      minskim  12398:                 modules</a></span></dt>
1.1       grant    12399:               </dl>
                   12400:             </dd>
                   12401: 
1.30      wiz      12402:             <dt><span class="sect1"><a href=
1.68      rillig   12403:             "#feedback-to-author">16.6. Feedback to the
1.30      wiz      12404:             author</a></span></dt>
1.1       grant    12405:           </dl>
                   12406:         </div>
                   12407: 
1.67      hubertf  12408:         <div class="sect1" lang="en">
1.1       grant    12409:           <div class="titlepage">
                   12410:             <div>
                   12411:               <div>
                   12412:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   12413:                 "general-operation"></a>16.1.&nbsp;General
1.1       grant    12414:                 operation</h2>
                   12415:               </div>
                   12416:             </div>
                   12417:           </div>
                   12418: 
1.67      hubertf  12419:           <div class="sect2" lang="en">
1.1       grant    12420:             <div class="titlepage">
                   12421:               <div>
                   12422:                 <div>
1.30      wiz      12423:                   <h3 class="title"><a name=
1.68      rillig   12424:                   "pulling-vars-from-etc-mk.conf"></a>16.1.1.&nbsp;How
1.30      wiz      12425:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    12426:                 </div>
                   12427:               </div>
                   12428:             </div>
                   12429: 
                   12430:             <p>The problem with package-defined variables that can
1.14      xtraeme  12431:             be overridden via <code class="varname">MAKECONF</code>
1.45      wiz      12432:             or <code xmlns=
                   12433:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12434:             "filename">/etc/mk.conf</code> is that <a href=
1.1       grant    12435:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   12436:             <span class="citerefentry"><span class=
                   12437:             "refentrytitle">make</span>(1)</span></a> expands a
1.47      reed     12438:             variable as it is used, but evaluates preprocessor-like
1.1       grant    12439:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  12440:             So, to use any variable (which may be set in
1.45      wiz      12441:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12442:             class="filename">/etc/mk.conf</code>) in one of the
                   12443:             .if* statements, the file <code xmlns=
                   12444:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12445:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    12446:             that .if* statement.</p>
                   12447: 
1.47      reed     12448:             <p>Rather than having a number of ad-hoc ways of
1.45      wiz      12449:             including <code xmlns=
                   12450:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12451:             "filename">/etc/mk.conf</code>, should it exist, or
                   12452:             <code class="varname">MAKECONF</code>, should it exist,
                   12453:             include the <code xmlns=
                   12454:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   12455:             "filename">pkgsrc/mk/bsd.prefs.mk</code> file in the
                   12456:             package Makefile before any preprocessor-like .if,
                   12457:             .ifdef, or .ifndef statements:</p>
1.1       grant    12458:             <pre class="programlisting">
1.51      rillig   12459:     .include "../../mk/bsd.prefs.mk"
                   12460: 
1.1       grant    12461:     .if defined(USE_MENUS)
1.51      rillig   12462:     # ...
1.1       grant    12463:     .endif
                   12464: </pre>
                   12465: 
1.14      xtraeme  12466:             <p>If you wish to set the <code class=
1.45      wiz      12467:             "varname">CFLAGS</code> variable in <code xmlns=
                   12468:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     12469:             "filename">/etc/mk.conf</code>, please make sure to
1.1       grant    12470:             use:</p>
                   12471:             <pre class="programlisting">
1.51      rillig   12472:     CFLAGS+=  -your -flags
1.1       grant    12473: </pre>
                   12474: 
1.14      xtraeme  12475:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   12476:             without the &#8220;<span class="quote">+</span>&#8221;)
                   12477:             may lead to problems with packages that need to add
                   12478:             their own flags. Also, you may want to take a look at
                   12479:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    12480:             href=
                   12481:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.45      wiz      12482:             target="_top"><code xmlns="" class=
                   12483:             "filename">devel/cpuflags</code></a> package if you're
1.20      ben      12484:             interested in optimization for the current CPU.</p>
1.1       grant    12485:           </div>
                   12486: 
1.67      hubertf  12487:           <div class="sect2" lang="en">
1.1       grant    12488:             <div class="titlepage">
                   12489:               <div>
                   12490:                 <div>
1.31      wiz      12491:                   <h3 class="title"><a name=
1.68      rillig   12492:                   "where-to-install-documentation"></a>16.1.2.&nbsp;Where
1.31      wiz      12493:                   to install documentation</h3>
                   12494:                 </div>
                   12495:               </div>
                   12496:             </div>
                   12497: 
1.45      wiz      12498:             <p>Documentation should be installed into <code xmlns=
                   12499:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.31      wiz      12500:             "filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.45      wiz      12501:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12502:             class="filename">${PREFIX}/share/doc/${PKGNAME}</code>
                   12503:             (the latter includes the version number of the
                   12504:             package).</p>
1.31      wiz      12505:           </div>
                   12506: 
1.67      hubertf  12507:           <div class="sect2" lang="en">
1.31      wiz      12508:             <div class="titlepage">
                   12509:               <div>
                   12510:                 <div>
1.67      hubertf  12511:                   <h3 class="title"><a name=
1.68      rillig   12512:                   "restricted-packages"></a>16.1.3.&nbsp;Restricted
1.1       grant    12513:                   packages</h3>
                   12514:                 </div>
                   12515:               </div>
                   12516:             </div>
                   12517: 
                   12518:             <p>Some licenses restrict how software may be
                   12519:             re-distributed. In order to satisfy these restrictions,
                   12520:             the package system defines five make variables that can
                   12521:             be set to note these restrictions:</p>
                   12522: 
                   12523:             <div class="itemizedlist">
                   12524:               <ul type="disc">
                   12525:                 <li>
1.14      xtraeme  12526:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    12527: 
                   12528:                   <p>This variable should be set whenever a
                   12529:                   restriction exists (regardless of its kind). Set
                   12530:                   this variable to a string containing the reason
                   12531:                   for the restriction.</p>
                   12532:                 </li>
                   12533: 
                   12534:                 <li>
1.14      xtraeme  12535:                   <p><code class=
                   12536:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    12537: 
                   12538:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  12539:                   variable to <code class=
                   12540:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12541:                   package may not be included on a CD-ROM.</p>
                   12542:                 </li>
                   12543: 
                   12544:                 <li>
1.14      xtraeme  12545:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    12546: 
                   12547:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  12548:                   Set this variable to <code class=
                   12549:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    12550:                   package may not not be made available on the
                   12551:                   Internet.</p>
                   12552:                 </li>
                   12553: 
                   12554:                 <li>
1.14      xtraeme  12555:                   <p><code class=
                   12556:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    12557: 
                   12558:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  12559:                   this variable to <code class=
                   12560:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12561:                   of the source code or other distfile(s) is not
                   12562:                   allowed on CD-ROMs.</p>
                   12563:                 </li>
                   12564: 
                   12565:                 <li>
1.14      xtraeme  12566:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    12567: 
                   12568:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  12569:                   variable to <code class=
                   12570:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    12571:                   of the source code or other distfile(s) via the
                   12572:                   Internet is not allowed.</p>
                   12573:                 </li>
                   12574:               </ul>
                   12575:             </div>
                   12576: 
1.14      xtraeme  12577:             <p>Please note that the use of <code class=
                   12578:             "varname">NO_PACKAGE</code>, <code class=
                   12579:             "varname">IGNORE</code>, <code class=
                   12580:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    12581:             variables to denote restrictions is deprecated, because
                   12582:             they unconditionally prevent users from generating
                   12583:             binary packages!</p>
                   12584:           </div>
                   12585: 
1.67      hubertf  12586:           <div class="sect2" lang="en">
1.1       grant    12587:             <div class="titlepage">
                   12588:               <div>
                   12589:                 <div>
1.67      hubertf  12590:                   <h3 class="title"><a name=
1.68      rillig   12591:                   "dependencies"></a>16.1.4.&nbsp;Handling
1.1       grant    12592:                   dependencies</h3>
                   12593:                 </div>
                   12594:               </div>
                   12595:             </div>
                   12596: 
                   12597:             <p>Your package may depend on some other package being
                   12598:             present - and there are various ways of expressing this
1.14      xtraeme  12599:             dependency. pkgsrc supports the <code class=
                   12600:             "varname">BUILD_DEPENDS</code> and <code class=
1.47      reed     12601:             "varname">DEPENDS</code> definitions, the <code class=
                   12602:             "varname">USE_TOOLS</code> definition, as well as
1.45      wiz      12603:             dependencies via <code xmlns=
                   12604:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12605:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    12606:             way to handle dependencies, and which uses the
                   12607:             variables named above. See <a href="#buildlink" title=
1.38      dillo    12608:             "Chapter&nbsp;11.&nbsp;Buildlink methodology">Chapter&nbsp;11,
1.1       grant    12609:             <i>Buildlink methodology</i></a> for more
                   12610:             information.</p>
                   12611: 
                   12612:             <p>The basic difference between the two variables is as
1.14      xtraeme  12613:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    12614:             definition registers that pre-requisite in the binary
                   12615:             package so it will be pulled in when the binary package
1.14      xtraeme  12616:             is later installed, whilst the <code class=
                   12617:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    12618:             marking a dependency that is only needed for building
                   12619:             the package.</p>
                   12620: 
                   12621:             <p>This means that if you only need a package present
                   12622:             whilst you are building, it should be noted as a
1.14      xtraeme  12623:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    12624: 
1.14      xtraeme  12625:             <p>The format for a <code class=
                   12626:             "varname">BUILD_DEPENDS</code> and a <code class=
                   12627:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    12628:             <pre class="programlisting">
1.51      rillig   12629:     &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.1       grant    12630: </pre>
                   12631: 
                   12632:             <p>Please note that the &#8220;<span class=
                   12633:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  12634:             any of the wildcard version numbers recognized by
1.1       grant    12635:             <a href=
                   12636:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   12637:             <span class="citerefentry"><span class=
                   12638:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   12639: 
                   12640:             <div class="orderedlist">
                   12641:               <ol type="1">
                   12642:                 <li>
                   12643:                   <p>If your package needs another package's
                   12644:                   binaries or libraries to build or run, and if
1.45      wiz      12645:                   that package has a <code xmlns=
                   12646:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12647:                   "filename">buildlink3.mk</code> file available,
                   12648:                   use it:</p>
1.1       grant    12649:                   <pre class="programlisting">
                   12650:     .include "../../graphics/jpeg/buildlink3.mk"
                   12651: </pre>
                   12652:                 </li>
                   12653: 
                   12654:                 <li>
                   12655:                   <p>If your package needs to use another package
1.45      wiz      12656:                   to build itself and there is no <code xmlns=
                   12657:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12658:                   "filename">buildlink3.mk</code> file available,
                   12659:                   use the <code class=
                   12660:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    12661:                   <pre class="programlisting">
1.51      rillig   12662:     BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
1.1       grant    12663: </pre>
                   12664:                 </li>
                   12665: 
                   12666:                 <li>
                   12667:                   <p>If your package needs a library with which to
1.45      wiz      12668:                   link and again there is no <code xmlns=
                   12669:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12670:                   "filename">buildlink3.mk</code> file available,
                   12671:                   this is specified using the <code class=
1.71    ! wiz      12672:                   "varname">DEPENDS</code> definition. For
        !          12673:                   example:</p>
1.1       grant    12674:                   <pre class="programlisting">
1.51      rillig   12675:     DEPENDS+=       xpm-3.4j:../../graphics/xpm
1.1       grant    12676: </pre>
                   12677: 
                   12678:                   <p>You can also use wildcards in package
                   12679:                   dependences:</p>
                   12680:                   <pre class="programlisting">
1.51      rillig   12681:     DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
1.1       grant    12682: </pre>
                   12683: 
                   12684:                   <p>Note that such wildcard dependencies are
                   12685:                   retained when creating binary packages. The
                   12686:                   dependency is checked when installing the binary
                   12687:                   package and any package which matches the pattern
                   12688:                   will be used. Wildcard dependencies should be
                   12689:                   used with care.</p>
                   12690: 
                   12691:                   <p>The &#8220;<span class=
                   12692:                   "quote">-[0-9]*</span>&#8221; should be used
                   12693:                   instead of &#8220;<span class=
                   12694:                   "quote">-*</span>&#8221; to avoid potentially
                   12695:                   ambiguous matches such as &#8220;<span class=
                   12696:                   "quote">tk-postgresql</span>&#8221; matching a
                   12697:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  12698:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    12699: 
                   12700:                   <p>Wildcards can also be used to specify that a
                   12701:                   package will only build against a certain minimum
                   12702:                   version of a pre-requisite:</p>
                   12703:                   <pre class="programlisting">
1.51      rillig   12704:     DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
1.1       grant    12705: </pre>
                   12706: 
                   12707:                   <p>This means that the package will build against
                   12708:                   version 3.5.4 of the tiff library or newer. Such
                   12709:                   a dependency may be warranted if, for example,
                   12710:                   the API of the library has changed with version
                   12711:                   3.5.4 and a package would not compile against an
                   12712:                   earlier version of tiff.</p>
                   12713: 
                   12714:                   <p>Please note that such dependencies should only
                   12715:                   be updated if a package requires a newer
                   12716:                   pre-requisite, but not to denote recommendations
                   12717:                   such as security updates or ABI changes that do
                   12718:                   not prevent a package from building correctly.
                   12719:                   Such recommendations can be expressed using
1.14      xtraeme  12720:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    12721:                   <pre class="programlisting">
1.51      rillig   12722:     RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
1.1       grant    12723: </pre>
                   12724: 
1.14      xtraeme  12725:                   <p>In addition to the above <code class=
                   12726:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    12727:                   while a package will build against
                   12728:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  12729:                   recommended. <code class=
                   12730:                   "varname">RECOMMENDED</code> entries will be
                   12731:                   turned into dependencies unless explicitly
                   12732:                   ignored (in which case a warning will be
1.36      wiz      12733:                   printed).</p>
                   12734: 
                   12735:                   <p>To ignore these dependency recommendations and
                   12736:                   just use the required <code class=
                   12737:                   "varname">DEPENDS</code>, set <code class=
                   12738:                   "varname">IGNORE_RECOMMENDED=YES</code>. This may
                   12739:                   make it easier and faster to update packages
                   12740:                   built using pkgsrc, since older compatible
                   12741:                   dependencies can continue to be used. This is
                   12742:                   useful for people who watch their rebuilds very
                   12743:                   carefully; it is not very good as a
                   12744:                   general-purpose hammer. If you use it, you need
                   12745:                   to be mindful of possible ABI changes, including
                   12746:                   those from the underlying OS.</p>
                   12747: 
                   12748:                   <p>Packages that are built with recommendations
                   12749:                   ignored may not be uploaded to ftp.NetBSD.org by
                   12750:                   developers and should not be used across
                   12751:                   different systems that may have different
                   12752:                   versions of binary packages installed.</p>
1.1       grant    12753: 
                   12754:                   <p>For security fixes, please update the package
                   12755:                   vulnerabilities file as well as setting
1.14      xtraeme  12756:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    12757:                   <a href="#security-handling" title=
1.68      rillig   12758:                   "16.1.8.&nbsp;Handling packages with security problems">
                   12759:                   Section&nbsp;16.1.8, &#8220;Handling packages
1.67      hubertf  12760:                   with security problems&#8221;</a> for more
1.1       grant    12761:                   information.</p>
                   12762:                 </li>
                   12763: 
                   12764:                 <li>
                   12765:                   <p>If your package needs some executable to be
1.17      sketch   12766:                   able to run correctly and if there's no
1.45      wiz      12767:                   <code xmlns=
                   12768:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   12769:                   "filename">buildlink3.mk</code> file, this is
                   12770:                   specified using the <code class=
1.14      xtraeme  12771:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    12772:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   12773:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.45      wiz      12774:                   target="_top"><code xmlns="" class=
                   12775:                   "filename">print/lyx</code></a> package needs to
                   12776:                   be able to execute the latex binary from the
                   12777:                   teTeX package when it runs, and that is
                   12778:                   specified:</p>
1.1       grant    12779:                   <pre class="programlisting">
1.51      rillig   12780:     DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
1.1       grant    12781: </pre>
                   12782: 
                   12783:                   <p>The comment about wildcard dependencies from
                   12784:                   previous paragraph applies here, too.</p>
                   12785:                 </li>
                   12786:               </ol>
                   12787:             </div>
                   12788: 
                   12789:             <p>If your package needs files from another package to
1.71    ! wiz      12790:             build, add the relevant distribution files to
        !          12791:             <code class="varname">DISTFILES</code>, so they will be
        !          12792:             extracted automatically. See the <a xmlns=
1.1       grant    12793:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.71    ! wiz      12794:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript/README.html"
1.45      wiz      12795:             target="_top"><code xmlns="" class=
1.71    ! wiz      12796:             "filename">print/ghostscript</code></a> package for an
        !          12797:             example. (It relies on the jpeg sources being present
        !          12798:             in source form during the build.)</p>
1.1       grant    12799: 
1.14      xtraeme  12800:             <p>Please also note the <code class=
                   12801:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   12802:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   12803:             which are provided as convenience definitions. The
1.24      wiz      12804:             former works out whether <a href=
                   12805:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   12806:             <span class="citerefentry"><span class=
                   12807:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   12808:             the base system, and, if it isn't, installs the
                   12809:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12810:             href=
1.1       grant    12811:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.45      wiz      12812:             target="_top"><code xmlns="" class=
                   12813:             "filename">devel/gettext</code></a> package. The latter
1.20      ben      12814:             adds a build dependency on either an installed version
                   12815:             of an older gettext package, or if it isn't, installs
                   12816:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   12817:             href=
                   12818:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
1.45      wiz      12819:             target="_top"><code xmlns="" class=
                   12820:             "filename">devel/gettext-m4</code></a> package.</p>
1.1       grant    12821:           </div>
                   12822: 
1.67      hubertf  12823:           <div class="sect2" lang="en">
1.1       grant    12824:             <div class="titlepage">
                   12825:               <div>
                   12826:                 <div>
1.67      hubertf  12827:                   <h3 class="title"><a name=
1.68      rillig   12828:                   "conflicts"></a>16.1.5.&nbsp;Handling conflicts
1.1       grant    12829:                   with other packages</h3>
                   12830:                 </div>
                   12831:               </div>
                   12832:             </div>
                   12833: 
                   12834:             <p>Your package may conflict with other packages a user
                   12835:             might already have installed on his system, e.g. if
                   12836:             your package installs the same set of files like
                   12837:             another package in our pkgsrc tree.</p>
                   12838: 
1.14      xtraeme  12839:             <p>In this case you can set <code class=
1.47      reed     12840:             "varname">CONFLICTS</code> to a space-separated list of
1.1       grant    12841:             packages (including version string) your package
                   12842:             conflicts with.</p>
                   12843: 
1.47      reed     12844:             <p>For example, <a xmlns=
1.1       grant    12845:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12846:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.45      wiz      12847:             target="_top"><code xmlns="" class=
                   12848:             "filename">x11/Xaw3d</code></a> and <a xmlns=
1.20      ben      12849:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   12850:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
1.45      wiz      12851:             target="_top"><code xmlns="" class=
1.47      reed     12852:             "filename">x11/Xaw-Xpm</code></a> install the same
                   12853:             shared library, thus you set in <code xmlns=
1.45      wiz      12854:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.20      ben      12855:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    12856:             <pre class="programlisting">
1.51      rillig   12857:     CONFLICTS=      Xaw-Xpm-[0-9]*
1.1       grant    12858: </pre>
                   12859: 
1.45      wiz      12860:             <p>and in <code xmlns=
                   12861:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12862:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    12863:             <pre class="programlisting">
1.51      rillig   12864:     CONFLICTS=      Xaw3d-[0-9]*
1.1       grant    12865: </pre>
                   12866: 
                   12867:             <p>Packages will automatically conflict with other
                   12868:             packages with the name prefix and a different version
                   12869:             string. &#8220;<span class=
                   12870:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   12871:             conflict with the older version &#8220;<span class=
                   12872:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   12873:           </div>
                   12874: 
1.67      hubertf  12875:           <div class="sect2" lang="en">
1.1       grant    12876:             <div class="titlepage">
                   12877:               <div>
                   12878:                 <div>
1.67      hubertf  12879:                   <h3 class="title"><a name=
1.68      rillig   12880:                   "not-building-packages"></a>16.1.6.&nbsp;Packages
1.30      wiz      12881:                   that cannot or should not be built</h3>
1.1       grant    12882:                 </div>
                   12883:               </div>
                   12884:             </div>
                   12885: 
                   12886:             <p>There are several reasons why a package might be
                   12887:             instructed to not build under certain circumstances. If
                   12888:             the package builds and runs on most platforms, the
1.14      xtraeme  12889:             exceptions should be noted with <code class=
                   12890:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   12891:             builds and runs on a small handful of platforms, set
                   12892:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.45      wiz      12893:             Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   12894:             <code class="varname">NOT_FOR_PLATFORM</code> are OS
                   12895:             triples (OS-version-platform) that can use glob-style
                   12896:             wildcards.</p>
                   12897: 
                   12898:             <p>If the package should be skipped (for example,
                   12899:             because it provides functionality already provided by
                   12900:             the system), set <code class=
1.14      xtraeme  12901:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   12902:             message. If the package should fail because some
                   12903:             preconditions are not met, set <code class=
                   12904:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    12905:             message.</p>
                   12906:           </div>
                   12907: 
1.67      hubertf  12908:           <div class="sect2" lang="en">
1.1       grant    12909:             <div class="titlepage">
                   12910:               <div>
                   12911:                 <div>
1.67      hubertf  12912:                   <h3 class="title"><a name=
1.68      rillig   12913:                   "undeletable-packages"></a>16.1.7.&nbsp;Packages
1.30      wiz      12914:                   which should not be deleted, once installed</h3>
1.1       grant    12915:                 </div>
                   12916:               </div>
                   12917:             </div>
                   12918: 
                   12919:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  12920:             has been installed, the <code class=
                   12921:             "varname">PKG_PRESERVE</code> definition should be set
                   12922:             in the package Makefile. This will be carried into any
1.1       grant    12923:             binary package that is made from this pkgsrc entry. A
                   12924:             &#8220;<span class="quote">preserved</span>&#8221;
                   12925:             package will not be deleted using <a href=
                   12926:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   12927:             <span class="citerefentry"><span class=
                   12928:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   12929:             the &#8220;<span class="quote">-f</span>&#8221; option
                   12930:             is used.</p>
                   12931:           </div>
                   12932: 
1.67      hubertf  12933:           <div class="sect2" lang="en">
1.1       grant    12934:             <div class="titlepage">
                   12935:               <div>
                   12936:                 <div>
1.67      hubertf  12937:                   <h3 class="title"><a name=
1.68      rillig   12938:                   "security-handling"></a>16.1.8.&nbsp;Handling
1.1       grant    12939:                   packages with security problems</h3>
                   12940:                 </div>
                   12941:               </div>
                   12942:             </div>
                   12943: 
                   12944:             <p>When a vulnerability is found, this should be noted
1.45      wiz      12945:             in <code xmlns=
                   12946:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12947:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.43      wiz      12948:             and after committing that file, use
                   12949:             <span><strong class="command">make
                   12950:             upload</strong></span> in the same directory to update
                   12951:             the file on ftp.NetBSD.org.</p>
                   12952: 
                   12953:             <p>After fixing the vulnerability by a patch, its
                   12954:             <code class="varname">PKGREVISION</code> should be
                   12955:             increased (this is of course not necessary if the
                   12956:             problem is fixed by using a newer release of the
1.45      wiz      12957:             software). In addition, if a <code xmlns=
                   12958:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12959:             "filename">buildlink3.mk</code> file exists for an
1.43      wiz      12960:             affected package, a corresponding <code class=
1.14      xtraeme  12961:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   12962:             "replaceable"><code>pkg</code></em></code> entry should
1.43      wiz      12963:             be added or updated in it.</p>
1.1       grant    12964: 
                   12965:             <p>Also, if the fix should be applied to the stable
                   12966:             pkgsrc branch, be sure to submit a pullup request!</p>
1.43      wiz      12967: 
                   12968:             <p>Binary packages already on ftp.NetBSD.org will be
                   12969:             handled semi-automatically by a weekly cron job.</p>
1.1       grant    12970:           </div>
                   12971: 
1.67      hubertf  12972:           <div class="sect2" lang="en">
1.1       grant    12973:             <div class="titlepage">
                   12974:               <div>
                   12975:                 <div>
1.67      hubertf  12976:                   <h3 class="title"><a name=
1.68      rillig   12977:                   "compiler-bugs"></a>16.1.9.&nbsp;How to handle
1.1       grant    12978:                   compiler bugs</h3>
                   12979:                 </div>
                   12980:               </div>
                   12981:             </div>
                   12982: 
                   12983:             <p>Some source files trigger bugs in the compiler,
                   12984:             based on combinations of compiler version and
                   12985:             architecture and almost always relation to optimisation
                   12986:             being enabled. Common symptoms are gcc internal errors
                   12987:             or never finishing compiling a file.</p>
                   12988: 
1.47      reed     12989:             <p>Typically, a workaround involves testing the
1.14      xtraeme  12990:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    12991:             version, disabling optimisation for that
1.14      xtraeme  12992:             file/<code class="varname">MACHINE_ARCH</code>/compiler
1.45      wiz      12993:             combination, and documenting it in <code xmlns=
                   12994:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  12995:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    12996:             number of examples!</p>
                   12997:           </div>
                   12998: 
1.67      hubertf  12999:           <div class="sect2" lang="en">
1.1       grant    13000:             <div class="titlepage">
                   13001:               <div>
                   13002:                 <div>
1.67      hubertf  13003:                   <h3 class="title"><a name=
1.68      rillig   13004:                   "bumping-pkgrevision"></a>16.1.10.&nbsp;How to
1.30      wiz      13005:                   handle incrementing versions when fixing an
                   13006:                   existing package</h3>
1.1       grant    13007:                 </div>
                   13008:               </div>
                   13009:             </div>
                   13010: 
                   13011:             <p>When making fixes to an existing package it can be
1.14      xtraeme  13012:             useful to change the version number in <code class=
                   13013:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    13014:             future versions by the original author, a
                   13015:             &#8220;<span class="quote">nb1</span>&#8221;,
                   13016:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   13017:             suffix can be used on package versions by setting
1.14      xtraeme  13018:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   13019:             The &#8220;<span class="quote">nb</span>&#8221; is
                   13020:             treated like a &#8220;<span class=
                   13021:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    13022:             <pre class="programlisting">
1.51      rillig   13023:     DISTNAME=       foo-17.42
                   13024:     PKGREVISION=    9
1.1       grant    13025: </pre>
                   13026: 
1.14      xtraeme  13027:             <p>will result in a <code class=
                   13028:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    13029:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   13030: 
                   13031:             <p>When a new release of the package is released, the
1.14      xtraeme  13032:             <code class="varname">PKGREVISION</code> should be
1.47      reed     13033:             removed, e.g. on a new minor release of the above
1.14      xtraeme  13034:             package, things should be like:</p>
1.1       grant    13035:             <pre class="programlisting">
1.51      rillig   13036:     DISTNAME=       foo-17.43
1.1       grant    13037: </pre>
                   13038:           </div>
                   13039: 
1.67      hubertf  13040:           <div class="sect2" lang="en">
1.1       grant    13041:             <div class="titlepage">
                   13042:               <div>
                   13043:                 <div>
1.30      wiz      13044:                   <h3 class="title"><a name=
1.68      rillig   13045:                   "portability-of-packages"></a>16.1.11.&nbsp;Portability
1.30      wiz      13046:                   of packages</h3>
1.1       grant    13047:                 </div>
                   13048:               </div>
                   13049:             </div>
                   13050: 
                   13051:             <p>One appealing feature of pkgsrc is that it runs on
                   13052:             many different platforms. As a result, it is important
                   13053:             to ensure, where possible, that packages in pkgsrc are
                   13054:             portable. There are some particular details you should
                   13055:             pay attention to while working on pkgsrc.</p>
                   13056: 
1.67      hubertf  13057:             <div class="sect3" lang="en">
1.1       grant    13058:               <div class="titlepage">
                   13059:                 <div>
                   13060:                   <div>
1.67      hubertf  13061:                     <h4 class="title"><a name=
1.68      rillig   13062:                     "install-scripts"></a>16.1.11.1.&nbsp;${INSTALL},
1.1       grant    13063:                     ${INSTALL_DATA_DIR}, ...</h4>
                   13064:                   </div>
                   13065:                 </div>
                   13066:               </div>
                   13067: 
1.14      xtraeme  13068:               <p>The BSD-compatible <span><strong class=
                   13069:               "command">install</strong></span> supplied with some
1.1       grant    13070:               operating systems will not perform more than one
                   13071:               operation at a time. As such, you should call
                   13072:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   13073:               etc. like this:</p>
                   13074:               <pre class="programlisting">
1.51      rillig   13075:     ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   13076:     ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.1       grant    13077: </pre>
                   13078:             </div>
                   13079:           </div>
                   13080:         </div>
                   13081: 
1.67      hubertf  13082:         <div class="sect1" lang="en">
1.1       grant    13083:           <div class="titlepage">
                   13084:             <div>
                   13085:               <div>
                   13086:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13087:                 "downloading-issues"></a>16.2.&nbsp;Possible
1.1       grant    13088:                 downloading issues</h2>
                   13089:               </div>
                   13090:             </div>
                   13091:           </div>
                   13092: 
1.67      hubertf  13093:           <div class="sect2" lang="en">
1.1       grant    13094:             <div class="titlepage">
                   13095:               <div>
                   13096:                 <div>
1.67      hubertf  13097:                   <h3 class="title"><a name=
1.68      rillig   13098:                   "no-plain-download"></a>16.2.1.&nbsp;Packages
1.30      wiz      13099:                   whose distfiles aren't available for plain
1.1       grant    13100:                   downloading</h3>
                   13101:                 </div>
                   13102:               </div>
                   13103:             </div>
                   13104: 
                   13105:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  13106:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   13107:             and a <span><strong class="command">make
1.45      wiz      13108:             fetch</strong></span> will call <code xmlns=
                   13109:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13110:             "filename">files/getsite.sh</code> with the name of
                   13111:             each file to download as an argument, expecting it to
                   13112:             output the URL of the directory from which to download
                   13113:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13114:             href=
1.1       grant    13115:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.45      wiz      13116:             target="_top"><code xmlns="" class=
                   13117:             "filename">graphics/ns-cult3d</code></a> is an example
                   13118:             of this usage.</p>
1.1       grant    13119: 
                   13120:             <p>If the download can't be automated, because the user
                   13121:             must submit personal information to apply for a
                   13122:             password, or must pay for the source, or whatever, you
1.14      xtraeme  13123:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   13124:             a macro which displays a message explaining the
                   13125:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   13126:             must be executable shell commands, not just a message.
                   13127:             (Generally, it executes <code class=
1.71    ! wiz      13128:             "varname">${ECHO}</code>). See one of the following
        !          13129:             packages for an example: <a xmlns=
1.20      ben      13130:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   13131:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
1.45      wiz      13132:             target="_top"><code xmlns="" class=
                   13133:             "filename">fonts/acroread-jpnfont</code></a>, <a xmlns=
1.20      ben      13134:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   13135:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
1.45      wiz      13136:             target="_top"><code xmlns="" class=
1.71    ! wiz      13137:             "filename">sysutils/storage-manager</code></a>.</p>
1.1       grant    13138:           </div>
                   13139: 
1.67      hubertf  13140:           <div class="sect2" lang="en">
1.1       grant    13141:             <div class="titlepage">
                   13142:               <div>
                   13143:                 <div>
1.30      wiz      13144:                   <h3 class="title"><a name=
1.68      rillig   13145:                   "modified-distfiles-same-name"></a>16.2.2.&nbsp;How
1.30      wiz      13146:                   to handle modified distfiles with the 'old'
                   13147:                   name</h3>
1.1       grant    13148:                 </div>
                   13149:               </div>
                   13150:             </div>
                   13151: 
                   13152:             <p>Sometimes authors of a software package make some
                   13153:             modifications after the software was released, and they
                   13154:             put up a new distfile without changing the package's
                   13155:             version number. If a package is already in pkgsrc at
1.32      wiz      13156:             that time, the checksum will no longer match. The
                   13157:             contents of the new distfile should be compared against
                   13158:             the old one before changing anything, to make sure the
                   13159:             distfile was really updated on purpose, and that no
                   13160:             trojan horse or so crept in. Then, the correct way to
                   13161:             work around this is to set <code class=
                   13162:             "varname">DIST_SUBDIR</code> to a unique directory
                   13163:             name, usually based on <code class=
                   13164:             "varname">PKGNAME_NOREV</code>. In case this happens
                   13165:             more often, <code class="varname">PKGNAME</code> can be
1.45      wiz      13166:             used (thus including the <code xmlns=
                   13167:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      13168:             "filename">nbX</code> suffix) or a date stamp can be
                   13169:             appended, like <code class=
                   13170:             "varname">${PKGNAME_NOREV}-YYYYMMDD</code>. Do not
1.45      wiz      13171:             forget regenerating the <code xmlns=
                   13172:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.32      wiz      13173:             "filename">distinfo</code> file after that, since it
                   13174:             contains the <code class="varname">DIST_SUBDIR</code>
                   13175:             path in the filenames. Furthermore, a mail to the
                   13176:             package's authors seems appropriate telling them that
                   13177:             changing distfiles after releases without changing the
                   13178:             file names is not good practice.</p>
1.1       grant    13179:           </div>
                   13180:         </div>
                   13181: 
1.67      hubertf  13182:         <div class="sect1" lang="en">
1.1       grant    13183:           <div class="titlepage">
                   13184:             <div>
                   13185:               <div>
                   13186:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13187:                 "configuration-gotchas"></a>16.3.&nbsp;Configuration
1.1       grant    13188:                 gotchas</h2>
                   13189:               </div>
                   13190:             </div>
                   13191:           </div>
                   13192: 
1.67      hubertf  13193:           <div class="sect2" lang="en">
1.1       grant    13194:             <div class="titlepage">
                   13195:               <div>
                   13196:                 <div>
1.67      hubertf  13197:                   <h3 class="title"><a name=
1.68      rillig   13198:                   "fixes.libtool"></a>16.3.1.&nbsp;Shared libraries
1.1       grant    13199:                   - libtool</h3>
                   13200:                 </div>
                   13201:               </div>
                   13202:             </div>
                   13203: 
                   13204:             <p>pkgsrc supports many different machines, with
                   13205:             different object formats like a.out and ELF, and
                   13206:             varying abilities to do shared library and dynamic
                   13207:             loading at all. To accompany this, varying commands and
                   13208:             options have to be passed to the compiler, linker, etc.
                   13209:             to get the Right Thing, which can be pretty annoying
                   13210:             especially if you don't have all the machines at your
                   13211:             hand to test things. The <a xmlns=
                   13212:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   13213:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.45      wiz      13214:             target="_top"><code xmlns="" class=
                   13215:             "filename">devel/libtool</code></a> pkg can help here,
                   13216:             as it just &#8220;<span class=
                   13217:             "quote">knows</span>&#8221; how to build both static
                   13218:             and dynamic libraries from a set of source files, thus
1.47      reed     13219:             being platform-independent.</p>
1.1       grant    13220: 
                   13221:             <p>Here's how to use libtool in a pkg in seven simple
                   13222:             steps:</p>
                   13223: 
                   13224:             <div class="orderedlist">
                   13225:               <ol type="1">
                   13226:                 <li>
1.14      xtraeme  13227:                   <p>Add <code class=
                   13228:                   "varname">USE_LIBTOOL=yes</code> to the package
                   13229:                   Makefile.</p>
1.1       grant    13230:                 </li>
                   13231: 
                   13232:                 <li>
                   13233:                   <p>For library objects, use &#8220;<span class=
                   13234:                   "quote">${LIBTOOL} --mode=compile
                   13235:                   ${CC}</span>&#8221; in place of
                   13236:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   13237:                   You could even add it to the definition of
1.14      xtraeme  13238:                   <code class="varname">CC</code>, if only
                   13239:                   libraries are being built in a given Makefile.
                   13240:                   This one command will build both PIC and non-PIC
                   13241:                   library objects, so you need not have separate
                   13242:                   shared and non-shared library rules.</p>
1.1       grant    13243:                 </li>
                   13244: 
                   13245:                 <li>
                   13246:                   <p>For the linking of the library, remove any
                   13247:                   &#8220;<span class="quote">ar</span>&#8221;,
                   13248:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   13249:                   and &#8220;<span class="quote">ld
                   13250:                   -Bshareable</span>&#8221; commands, and instead
                   13251:                   use:</p>
                   13252:                   <pre class="programlisting">
1.51      rillig   13253:     ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \
                   13254:         -rpath ${PREFIX}/lib -version-info major:minor
1.1       grant    13255: </pre>
                   13256: 
                   13257:                   <p>Note that the library is changed to have a
1.45      wiz      13258:                   <code xmlns=
                   13259:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13260:                   "filename">.la</code> extension, and the objects
                   13261:                   are changed to have a <code xmlns=
                   13262:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13263:                   "filename">.lo</code> extension. Change
                   13264:                   <code class="varname">OBJS</code> as necessary.
                   13265:                   This automatically creates all of the
1.45      wiz      13266:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13267:                   class="filename">.a</code>, <code xmlns=
                   13268:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13269:                   "filename">.so.major.minor</code>, and ELF
                   13270:                   symlinks (if necessary) in the build directory.
                   13271:                   Be sure to include &#8220;<span class=
1.1       grant    13272:                   "quote">-version-info</span>&#8221;, especially
                   13273:                   when major and minor are zero, as libtool will
                   13274:                   otherwise strip off the shared library
                   13275:                   version.</p>
                   13276: 
                   13277:                   <p>From the libtool manual:</p>
                   13278:                   <pre class="programlisting">
1.51      rillig   13279:     So, libtool library versions are described by three integers:
1.1       grant    13280: 
1.51      rillig   13281:     CURRENT
                   13282:         The most recent interface number that this library implements.
1.1       grant    13283: 
1.51      rillig   13284:     REVISION
                   13285:         The implementation number of the CURRENT interface.
1.1       grant    13286: 
1.51      rillig   13287:     AGE
                   13288:         The difference between the newest and oldest interfaces that
                   13289:         this library implements.  In other words, the library implements
                   13290:         all the interface numbers in the range from number `CURRENT -
                   13291:         AGE' to `CURRENT'.
1.68      rillig   13292: 
1.51      rillig   13293:     If two libraries have identical CURRENT and AGE numbers, then the
                   13294:     dynamic linker chooses the library with the greater REVISION number.
1.1       grant    13295: </pre>
                   13296: 
                   13297:                   <p>The &#8220;<span class=
                   13298:                   "quote">-release</span>&#8221; option will
                   13299:                   produce different results for a.out and ELF
                   13300:                   (excluding symlinks) in only one case. An ELF
                   13301:                   library of the form &#8220;<span class=
                   13302:                   "quote">libfoo-release.so.<span class=
                   13303:                   "emphasis"><em>x</em></span>.<span class=
                   13304:                   "emphasis"><em>y</em></span></span>&#8221; will
                   13305:                   have a symlink of &#8220;<span class=
                   13306:                   "quote">libfoo.so.<span class=
                   13307:                   "emphasis"><em>x</em></span>.<span class=
                   13308:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   13309:                   a.out platform. This is handled
                   13310:                   automatically.</p>
                   13311: 
                   13312:                   <p>The &#8220;<span class="quote">-rpath
                   13313:                   argument</span>&#8221; is the install directory
                   13314:                   of the library being built.</p>
                   13315: 
1.45      wiz      13316:                   <p>In the <code xmlns=
                   13317:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13318:                   "filename">PLIST</code>, include only the
                   13319:                   <code xmlns=
                   13320:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.19      hubertf  13321:                   "filename">.la</code> file, the other files will
                   13322:                   be added automatically.</p>
1.1       grant    13323:                 </li>
                   13324: 
                   13325:                 <li>
1.45      wiz      13326:                   <p>When linking shared object (<code xmlns=
                   13327:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13328:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      13329:                   loaded via <a href=
                   13330:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   13331:                   <span class="citerefentry"><span class=
                   13332:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   13333:                   shared libraries, use &#8220;<span class=
                   13334:                   "quote">-module -avoid-version</span>&#8221; to
                   13335:                   prevent them getting version tacked on.</p>
1.1       grant    13336: 
1.45      wiz      13337:                   <p>The <code xmlns=
                   13338:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13339:                   "filename">PLIST</code> file gets the
                   13340:                   <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13341:                   class="filename">foo.so</code> entry.</p>
1.1       grant    13342:                 </li>
                   13343: 
                   13344:                 <li>
                   13345:                   <p>When linking programs that depend on these
                   13346:                   libraries <span class=
                   13347:                   "emphasis"><em>before</em></span> they are
                   13348:                   installed, preface the <a href=
                   13349:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   13350:                   <span class="citerefentry"><span class=
                   13351:                   "refentrytitle">cc</span>(1)</span></a> or
                   13352:                   <a href=
                   13353:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   13354:                   <span class="citerefentry"><span class=
                   13355:                   "refentrytitle">ld</span>(1)</span></a> line with
                   13356:                   &#8220;<span class="quote">${LIBTOOL}
                   13357:                   --mode=link</span>&#8221;, and it will find the
                   13358:                   correct libraries (static or shared), but please
                   13359:                   be aware that libtool will not allow you to
                   13360:                   specify a relative path in -L (such as
                   13361:                   &#8220;<span class=
                   13362:                   "quote">-L../somelib</span>&#8221;), because it
                   13363:                   expects you to change that argument to be the
1.45      wiz      13364:                   <code xmlns=
                   13365:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13366:                   "filename">.la</code> file. e.g.</p>
1.1       grant    13367:                   <pre class="programlisting">
1.51      rillig   13368:     ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.1       grant    13369: </pre>
                   13370: 
                   13371:                   <p>should be changed to:</p>
                   13372:                   <pre class="programlisting">
1.51      rillig   13373:     ${LIBTOOL} --mode=link ${CC} -o <em class=
1.14      xtraeme  13374: "replaceable"><code>someprog</code></em> <em class=
                   13375: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    13376: </pre>
                   13377: 
                   13378:                   <p>and it will do the right thing with the
                   13379:                   libraries.</p>
                   13380:                 </li>
                   13381: 
                   13382:                 <li>
                   13383:                   <p>When installing libraries, preface the
                   13384:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   13385:                   <span class="citerefentry"><span class=
                   13386:                   "refentrytitle">install</span>(1)</span></a> or
                   13387:                   <a href=
                   13388:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   13389:                   <span class="citerefentry"><span class=
                   13390:                   "refentrytitle">cp</span>(1)</span></a> command
                   13391:                   with &#8220;<span class="quote">${LIBTOOL}
                   13392:                   --mode=install</span>&#8221;, and change the
1.45      wiz      13393:                   library name to <code xmlns=
                   13394:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13395:                   "filename">.la</code>. e.g.</p>
1.1       grant    13396:                   <pre class="programlisting">
1.51      rillig   13397:     ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.1       grant    13398: </pre>
                   13399: 
1.45      wiz      13400:                   <p>This will install the static <code xmlns=
                   13401:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13402:                   "filename">.a</code>, shared library, any needed
1.1       grant    13403:                   symlinks, and run <a href=
                   13404:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   13405:                   <span class="citerefentry"><span class=
                   13406:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   13407:                 </li>
                   13408: 
                   13409:                 <li>
1.45      wiz      13410:                   <p>In your <code xmlns=
                   13411:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   13412:                   "filename">PLIST</code>, include only the
                   13413:                   <code xmlns=
                   13414:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      13415:                   "filename">.la</code> file (this is a change from
                   13416:                   previous behaviour).</p>
1.1       grant    13417:                 </li>
                   13418:               </ol>
                   13419:             </div>
                   13420:           </div>
                   13421: 
1.67      hubertf  13422:           <div class="sect2" lang="en">
1.1       grant    13423:             <div class="titlepage">
                   13424:               <div>
                   13425:                 <div>
1.67      hubertf  13426:                   <h3 class="title"><a name=
1.68      rillig   13427:                   "using-libtool"></a>16.3.2.&nbsp;Using libtool on
1.30      wiz      13428:                   GNU packages that already support libtool</h3>
1.1       grant    13429:                 </div>
                   13430:               </div>
                   13431:             </div>
                   13432: 
1.14      xtraeme  13433:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   13434:             the package Makefile. This will override the package's
                   13435:             own libtool in most cases. For older libtool using
1.1       grant    13436:             packages, libtool is made by ltconfig script during the
                   13437:             do-configure step; you can check the libtool script
1.14      xtraeme  13438:             location by doing <span><strong class="command">make
                   13439:             configure; find work*/ -name
                   13440:             libtool</strong></span>.</p>
                   13441: 
                   13442:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   13443:             specifies which libtool scripts, relative to
                   13444:             <code class="varname">WRKSRC</code>, to override. By
                   13445:             default, it is set to &#8220;<span class=
                   13446:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   13447:             this does not match the location of the package's
                   13448:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  13449: 
1.45      wiz      13450:             <p>If you do not need <code xmlns=
                   13451:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13452:             "filename">*.a</code> static libraries built and
                   13453:             installed, then use <code class=
                   13454:             "varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.1       grant    13455: 
1.47      reed     13456:             <p>If your package makes use of the
                   13457:             platform-independent library for loading dynamic shared
                   13458:             objects, that comes with libtool (libltdl), you should
                   13459:             include devel/libltdl/buildlink3.mk.</p>
1.1       grant    13460: 
                   13461:             <p>Some packages use libtool incorrectly so that the
                   13462:             package may not work or build in some circumstances.
                   13463:             Some of the more common errors are:</p>
                   13464: 
                   13465:             <div class="itemizedlist">
                   13466:               <ul type="disc">
                   13467:                 <li>
                   13468:                   <p>The inclusion of a shared object (-module) as
                   13469:                   a dependent library in an executable or library.
                   13470:                   This in itself isn't a problem if one of two
                   13471:                   things has been done:</p>
                   13472: 
                   13473:                   <div class="orderedlist">
                   13474:                     <ol type="1">
                   13475:                       <li>
                   13476:                         <p>The shared object is named correctly,
1.45      wiz      13477:                         i.e. <code xmlns=
                   13478:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13479:                         class="filename">libfoo.la</code>, not
                   13480:                         <code xmlns=
                   13481:                         "http://www.w3.org/TR/xhtml1/transitional"
                   13482:                         class="filename">foo.la</code></p>
1.1       grant    13483:                       </li>
                   13484: 
                   13485:                       <li>
                   13486:                         <p>The -dlopen option is used when linking
                   13487:                         an executable.</p>
                   13488:                       </li>
                   13489:                     </ol>
                   13490:                   </div>
                   13491:                 </li>
                   13492: 
                   13493:                 <li>
                   13494:                   <p>The use of libltdl without the correct calls
                   13495:                   to initialisation routines. The function
                   13496:                   lt_dlinit() should be called and the macro
1.14      xtraeme  13497:                   <code class=
                   13498:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    13499:                   included in executables.</p>
                   13500:                 </li>
                   13501:               </ul>
                   13502:             </div>
                   13503:           </div>
                   13504: 
1.67      hubertf  13505:           <div class="sect2" lang="en">
1.1       grant    13506:             <div class="titlepage">
                   13507:               <div>
                   13508:                 <div>
1.67      hubertf  13509:                   <h3 class="title"><a name=
1.68      rillig   13510:                   "autoconf-automake"></a>16.3.3.&nbsp;GNU
1.1       grant    13511:                   Autoconf/Automake</h3>
                   13512:                 </div>
                   13513:               </div>
                   13514:             </div>
                   13515: 
                   13516:             <p>If a package needs GNU autoconf or automake to be
                   13517:             executed to regenerate the configure script and
                   13518:             Makefile.in makefile templates, then they should be
1.35      jmmv     13519:             executed in a pre-configure target.</p>
1.1       grant    13520: 
                   13521:             <p>For packages that need only autoconf:</p>
                   13522:             <pre class="programlisting">
1.51      rillig   13523:     AUTOCONF_REQD=  2.50            # if default version is not good enough
                   13524:     USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   13525:     ...
1.1       grant    13526: 
1.51      rillig   13527:     pre-configure:
                   13528:             cd ${WRKSRC}; autoconf
1.1       grant    13529: 
1.51      rillig   13530:     ...
1.1       grant    13531: </pre>
                   13532: 
                   13533:             <p>and for packages that need automake and
                   13534:             autoconf:</p>
                   13535:             <pre class="programlisting">
1.51      rillig   13536:     AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   13537:     USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   13538:     ...
1.1       grant    13539: 
1.51      rillig   13540:     pre-configure:
                   13541:             cd ${WRKSRC};                          \
                   13542:             aclocal; autoheader;                   \
                   13543:             automake -a --foreign -i; autoconf
                   13544: 
                   13545:     ...
1.1       grant    13546: </pre>
                   13547: 
                   13548:             <p>Packages which use GNU Automake will almost
1.35      jmmv     13549:             certainly require GNU Make.</p>
1.1       grant    13550: 
                   13551:             <p>There are times when the configure process makes
                   13552:             additional changes to the generated files, which then
                   13553:             causes the build process to try to re-execute the
                   13554:             automake sequence. This is prevented by touching
                   13555:             various files in the configure stage. If this causes
1.14      xtraeme  13556:             problems with your package you can set <code class=
                   13557:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    13558:             Makefile.</p>
                   13559:           </div>
                   13560:         </div>
                   13561: 
1.67      hubertf  13562:         <div class="sect1" lang="en">
1.1       grant    13563:           <div class="titlepage">
                   13564:             <div>
                   13565:               <div>
                   13566:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13567:                 "fixes-build"></a>16.4.&nbsp;Building the
1.55      rillig   13568:                 package</h2>
1.1       grant    13569:               </div>
                   13570:             </div>
                   13571:           </div>
                   13572: 
1.67      hubertf  13573:           <div class="sect2" lang="en">
1.1       grant    13574:             <div class="titlepage">
                   13575:               <div>
                   13576:                 <div>
1.67      hubertf  13577:                   <h3 class="title"><a name=
1.68      rillig   13578:                   "cpp-defines"></a>16.4.1.&nbsp;CPP defines</h3>
1.1       grant    13579:                 </div>
                   13580:               </div>
                   13581:             </div>
                   13582: 
1.55      rillig   13583:             <p>Sometimes you need to compile different code
                   13584:             depending on the target platform. The C preprocessor
                   13585:             has a set of predefined macros that can be queried by
                   13586:             using <code class="varname">#ifdef FOO</code> or
                   13587:             <code class="varname">#if defined(FOO)</code>. Among
                   13588:             these macros are usually ones that describe the target
                   13589:             CPU and operating system. Depending of which of the
                   13590:             macros are defined, you can write code that uses
1.61      rillig   13591:             features unique to a specific platform. Generally you
                   13592:             should rather use the GNU autotools (automake,
                   13593:             autoconf, etc.) to check for specific features (like
                   13594:             the existence of a header file, a function or a
                   13595:             library), but sometimes this is not possible or
                   13596:             desired.</p>
                   13597: 
                   13598:             <p>In that case you can use the predefined macros below
                   13599:             to configure your code to the platform it runs on.
                   13600:             Almost every operating system, hardware architecture
                   13601:             and compiler has its own macro. For example, if the
                   13602:             macros <code class="varname">__GNUC__</code>,
                   13603:             <code class="varname">__i386__</code> and <code class=
1.55      rillig   13604:             "varname">__NetBSD__</code> are all defined, you know
1.61      rillig   13605:             that you are using NetBSD on an i386 compatible CPU,
                   13606:             and your compiler is GCC.</p>
1.55      rillig   13607: 
1.67      hubertf  13608:             <div class="sect3" lang="en">
1.55      rillig   13609:               <div class="titlepage">
                   13610:                 <div>
                   13611:                   <div>
                   13612:                     <h4 class="title"><a name=
1.68      rillig   13613:                     "fixes-build-cpp-opsys"></a>16.4.1.1.&nbsp;CPP
1.55      rillig   13614:                     defines for operating systems</h4>
                   13615:                   </div>
                   13616:                 </div>
                   13617:               </div>
                   13618: 
                   13619:               <p>To distinguish between 4.4 BSD-derived systems and
                   13620:               the rest of the world, you should use the following
                   13621:               code.</p>
                   13622:               <pre class="programlisting">
1.51      rillig   13623:     #include &lt;sys/param.h&gt;
1.55      rillig   13624:     #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
1.60      rillig   13625:       /* BSD-specific code goes here */
1.55      rillig   13626:     #else
1.60      rillig   13627:       /* non-BSD-specific code goes here */
1.55      rillig   13628:     #endif
1.1       grant    13629: </pre>
                   13630: 
1.55      rillig   13631:               <p>If this distinction is not fine enough, you can
                   13632:               also use the following defines.</p>
                   13633:               <pre class="programlisting">
                   13634:     FreeBSD     __FreeBSD__
1.56      rillig   13635:     DragonFly   __DragonFly__
1.57      minskim  13636:     Interix     __INTERIX
1.55      rillig   13637:     Linux       linux, __linux, __linux__
                   13638:     NetBSD      __NetBSD__
                   13639:     OpenBSD     __OpenBSD__
1.60      rillig   13640:     Solaris     sun, __sun
1.1       grant    13641: </pre>
1.55      rillig   13642:             </div>
1.1       grant    13643: 
1.67      hubertf  13644:             <div class="sect3" lang="en">
1.55      rillig   13645:               <div class="titlepage">
                   13646:                 <div>
                   13647:                   <div>
1.67      hubertf  13648:                     <h4 class="title"><a name=
1.68      rillig   13649:                     "fixes-build-cpp-cpu"></a>16.4.1.2.&nbsp;CPP
1.55      rillig   13650:                     defines for CPUs</h4>
                   13651:                   </div>
                   13652:                 </div>
                   13653:               </div>
                   13654:               <pre class="programlisting">
                   13655:     i386        i386, __i386, __i386__
                   13656:     MIPS        __mips
                   13657:     SPARC       sparc, __sparc
                   13658: </pre>
                   13659:             </div>
                   13660: 
1.67      hubertf  13661:             <div class="sect3" lang="en">
1.55      rillig   13662:               <div class="titlepage">
                   13663:                 <div>
                   13664:                   <div>
                   13665:                     <h4 class="title"><a name=
1.68      rillig   13666:                     "fixes-build-cpp-compiler"></a>16.4.1.3.&nbsp;CPP
1.55      rillig   13667:                     defines for compilers</h4>
                   13668:                   </div>
                   13669:                 </div>
                   13670:               </div>
                   13671:               <pre class="programlisting">
                   13672:     GCC         __GNUC__ (major version), __GNUC_MINOR__
1.60      rillig   13673:     SunPro      __SUNPRO_C (0x570 for version 5.7)
1.55      rillig   13674: </pre>
                   13675:             </div>
1.1       grant    13676:           </div>
1.51      rillig   13677: 
1.67      hubertf  13678:           <div class="sect2" lang="en">
1.51      rillig   13679:             <div class="titlepage">
                   13680:               <div>
                   13681:                 <div>
1.67      hubertf  13682:                   <h3 class="title"><a name=
1.68      rillig   13683:                   "cpp-list-examples"></a>16.4.2.&nbsp;Examples of
1.60      rillig   13684:                   CPP defines for some platforms</h3>
                   13685:                 </div>
                   13686:               </div>
                   13687:             </div>
                   13688: 
                   13689:             <p>The list of the CPP identification macros for
                   13690:             hardware and operating system may depend on the
                   13691:             compiler that is used. The following list contains some
                   13692:             examples that may help you to choose the right ones.
                   13693:             For example, if you want to conditionally compile code
                   13694:             on Solaris, don't use <code class=
                   13695:             "varname">__sun__</code>, as the SunPro compiler does
                   13696:             not define it. Use <code class="varname">__sun</code>
                   13697:             instead.</p>
                   13698: 
                   13699:             <div class="variablelist">
                   13700:               <dl>
1.61      rillig   13701:                 <dt><span class="term">GCC 3.3.3 + SuSE Linux 9.1 +
                   13702:                 i386</span></dt>
                   13703: 
                   13704:                 <dd>
1.62      rillig   13705:                   <p>__ELF__, __gnu_linux__, __i386, __i386__,
1.61      rillig   13706:                   __linux, __linux__, __unix, __unix__, i386,
                   13707:                   linux, unix.</p>
                   13708:                 </dd>
                   13709: 
                   13710:                 <dt><span class="term">GCC 2.95 + NetBSD 1.6.2 +
                   13711:                 i386</span></dt>
                   13712: 
                   13713:                 <dd>
1.62      rillig   13714:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13715:                   i386.</p>
                   13716:                 </dd>
                   13717: 
                   13718:                 <dt><span class="term">GCC 3.3.3 + NetBSD 2.0 +
                   13719:                 i386</span></dt>
1.60      rillig   13720: 
                   13721:                 <dd>
1.62      rillig   13722:                   <p>__ELF__, __NetBSD__, __i386, __i386__,
1.61      rillig   13723:                   i386.</p>
1.60      rillig   13724:                 </dd>
                   13725: 
                   13726:                 <dt><span class="term">GCC 4 + Solaris 8 +
                   13727:                 SPARC</span></dt>
                   13728: 
                   13729:                 <dd>
                   13730:                   <p>__ELF__, __sparc, __sparc__, __sun, __sun__,
                   13731:                   __SVR4, __svr4__, __unix, __unix__, sparc, sun,
                   13732:                   unix.</p>
                   13733:                 </dd>
1.61      rillig   13734: 
                   13735:                 <dt><span class="term">SunPro 5.7 + Solaris 8 +
                   13736:                 SPARC</span></dt>
                   13737: 
                   13738:                 <dd>
                   13739:                   <p>__SVR4, __sparc, __sun, __unix, sparc, sun,
                   13740:                   unix.</p>
                   13741:                 </dd>
1.60      rillig   13742:               </dl>
                   13743:             </div>
                   13744:           </div>
                   13745: 
1.67      hubertf  13746:           <div class="sect2" lang="en">
1.60      rillig   13747:             <div class="titlepage">
                   13748:               <div>
                   13749:                 <div>
1.67      hubertf  13750:                   <h3 class="title"><a name=
1.68      rillig   13751:                   "cpp-list"></a>16.4.3.&nbsp;Getting a list of CPP
1.51      rillig   13752:                   defines</h3>
                   13753:                 </div>
                   13754:               </div>
                   13755:             </div>
                   13756: 
1.60      rillig   13757:             <p>If your system uses the GNU C Compiler, you can get
                   13758:             a list of symbols that are defined by default, e.g. to
                   13759:             identify the platform, with the following command:</p>
1.51      rillig   13760:             <pre class="programlisting">
                   13761:     gcc -E -dM - &lt; /dev/null 
                   13762: </pre>
1.60      rillig   13763: 
                   13764:             <p>On other systems you may get the list by using the
                   13765:             system's syscall trace utility (ktrace, truss, strace)
                   13766:             to have a look which arguments are passed to the actual
                   13767:             compiler.</p>
1.51      rillig   13768:           </div>
1.1       grant    13769:         </div>
                   13770: 
1.67      hubertf  13771:         <div class="sect1" lang="en">
1.1       grant    13772:           <div class="titlepage">
                   13773:             <div>
                   13774:               <div>
                   13775:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   13776:                 "package-specific-actions"></a>16.5.&nbsp;Package
1.1       grant    13777:                 specific actions</h2>
                   13778:               </div>
                   13779:             </div>
                   13780:           </div>
                   13781: 
1.67      hubertf  13782:           <div class="sect2" lang="en">
1.1       grant    13783:             <div class="titlepage">
                   13784:               <div>
                   13785:                 <div>
1.67      hubertf  13786:                   <h3 class="title"><a name=
1.68      rillig   13787:                   "user-interaction"></a>16.5.1.&nbsp;User
1.2       hubertf  13788:                   interaction</h3>
1.1       grant    13789:                 </div>
                   13790:               </div>
                   13791:             </div>
                   13792: 
                   13793:             <p>Occasionally, packages require interaction from the
                   13794:             user, and this can be in a number of ways:</p>
                   13795: 
                   13796:             <div class="itemizedlist">
                   13797:               <ul type="disc">
                   13798:                 <li>
                   13799:                   <p>help in fetching the distfiles</p>
                   13800:                 </li>
                   13801: 
                   13802:                 <li>
                   13803:                   <p>help to configure the package before it is
                   13804:                   built</p>
                   13805:                 </li>
                   13806: 
                   13807:                 <li>
                   13808:                   <p>help during the build process</p>
                   13809:                 </li>
                   13810: 
                   13811:                 <li>
                   13812:                   <p>help during the installation of a package</p>
                   13813:                 </li>
                   13814:               </ul>
                   13815:             </div>
                   13816: 
1.14      xtraeme  13817:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    13818:             definition is provided to notify the pkgsrc mechanism
                   13819:             of an interactive stage which will be needed, and this
1.45      wiz      13820:             should be set in the package's <code xmlns=
                   13821:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.47      reed     13822:             "filename">Makefile</code>, e.g.:</p>
1.1       grant    13823:             <pre class="programlisting">
1.51      rillig   13824:     INTERACTIVE_STAGE=      build
1.1       grant    13825: </pre>
                   13826: 
                   13827:             <p>Multiple interactive stages can be specified:</p>
                   13828:             <pre class="programlisting">
1.51      rillig   13829:     INTERACTIVE_STAGE=      configure install
1.1       grant    13830: </pre>
                   13831:           </div>
                   13832: 
1.67      hubertf  13833:           <div class="sect2" lang="en">
1.1       grant    13834:             <div class="titlepage">
                   13835:               <div>
                   13836:                 <div>
1.67      hubertf  13837:                   <h3 class="title"><a name=
1.68      rillig   13838:                   "handling-licenses"></a>16.5.2.&nbsp;Handling
1.1       grant    13839:                   licenses</h3>
                   13840:                 </div>
                   13841:               </div>
                   13842:             </div>
                   13843: 
1.44      gdt      13844:             <p>A package may be covered by a license which the user
                   13845:             has or has not agreed to accept. For these cases,
                   13846:             pkgsrc contains a mechanism to note that a package is
                   13847:             covered by a particular license, and the package cannot
                   13848:             be built unless the user has accepted the license.
                   13849:             (Installation of binary packages are not currently
                   13850:             subject to this mechanism.) Packages with licenses that
                   13851:             are either Open Source according to the Open Source
                   13852:             Initiative or Free according to the Free Software
                   13853:             Foundation will not be marked with a license tag.
                   13854:             Packages with licenses that have not been determined to
                   13855:             meet either definition will be marked with a license
                   13856:             tag referring to the license. This will prevent
                   13857:             building unless pkgsrc is informed that the license is
                   13858:             acceptable, and enables displaying the license.</p>
                   13859: 
                   13860:             <p>The license tag mechanism is intended to address
                   13861:             copyright-related issues surrounding building,
                   13862:             installing and using a package, and not to address
                   13863:             redistribution issues (see <code class=
                   13864:             "varname">RESTRICTED</code> and <code class=
                   13865:             "varname">NO_SRC_ON_FTP</code>, etc.). However, the
                   13866:             above definition of licenses for which tags are not
                   13867:             needed implies that packages with redistribution
                   13868:             restrictions should have tags.</p>
                   13869: 
                   13870:             <p>Denoting that a package is covered by a particular
1.45      wiz      13871:             license is done by placing the license in <code xmlns=
                   13872:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.44      gdt      13873:             "filename">pkgsrc/licenses</code> and setting the
                   13874:             <code class="varname">LICENSE</code> variable to a
                   13875:             string identifying the license, e.g. in <a xmlns=
1.14      xtraeme  13876:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.44      gdt      13877:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/xv/README.html"
1.45      wiz      13878:             target="_top"><code xmlns="" class=
                   13879:             "filename">graphics/xv</code></a>:</p>
1.1       grant    13880:             <pre class="programlisting">
1.51      rillig   13881:     LICENSE=        xv-license
1.1       grant    13882: </pre>
                   13883: 
                   13884:             <p>When trying to build, the user will get a notice
1.44      gdt      13885:             that the package is covered by a license which has not
                   13886:             been accepted:</p>
1.1       grant    13887:             <pre class="programlisting">
1.51      rillig   13888:     <code class="prompt">%</code> <strong class=
1.14      xtraeme  13889: "userinput"><code>make</code></strong>
1.51      rillig   13890:     ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   13891:     ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   13892:     ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   13893:     ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   13894:     *** Error code 1
1.1       grant    13895: </pre>
                   13896: 
1.14      xtraeme  13897:             <p>The license can be viewed with <span><strong class=
                   13898:             "command">make show-license</strong></span>, and if it
                   13899:             is considered appropriate, the line printed above can
1.45      wiz      13900:             be added to <code xmlns=
                   13901:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   13902:             "filename">/etc/mk.conf</code> to indicate acceptance
                   13903:             of the particular license:</p>
1.1       grant    13904:             <pre class="programlisting">
1.51      rillig   13905:     ACCEPTABLE_LICENSES+=xv-license
1.1       grant    13906: </pre>
                   13907: 
                   13908:             <p>When adding a package with a new license, the
1.45      wiz      13909:             license text should be added to <code xmlns=
                   13910:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13911:             "filename">pkgsrc/licenses</code> for displaying. A
                   13912:             list of known licenses can be seen in this directory as
                   13913:             well as by looking at the list of (commented out)
                   13914:             <code class="varname">ACCEPTABLE_LICENSES</code>
1.45      wiz      13915:             variable settings in <code xmlns=
                   13916:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  13917:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    13918: 
1.44      gdt      13919:             <p>The use of <code class=
                   13920:             "varname">LICENSE=shareware</code>, <code class=
                   13921:             "varname">LICENSE=no-commercial-use</code>, and similar
                   13922:             language is deprecated because it does not crisply
                   13923:             refer to a particular license text. Another problem
                   13924:             with such usage is that it does not enable a user to
                   13925:             denote acceptance of the license for a single package
                   13926:             without accepting the same license text for another
                   13927:             package. In particular, this can be inappropriate when
                   13928:             e.g. one accepts a particular license to indicate to
                   13929:             pkgsrc that a fee has been paid.</p>
1.1       grant    13930:           </div>
                   13931: 
1.67      hubertf  13932:           <div class="sect2" lang="en">
1.1       grant    13933:             <div class="titlepage">
                   13934:               <div>
                   13935:                 <div>
1.30      wiz      13936:                   <h3 class="title"><a name=
1.68      rillig   13937:                   "installing-score-files"></a>16.5.3.&nbsp;Installing
1.30      wiz      13938:                   score files</h3>
1.1       grant    13939:                 </div>
                   13940:               </div>
                   13941:             </div>
                   13942: 
                   13943:             <p>Certain packages, most of them in the games
                   13944:             category, install a score file that allows all users on
                   13945:             the system to record their highscores. In order for
                   13946:             this to work, the binaries need to be installed setgid
                   13947:             and the score files owned by the appropriate group
                   13948:             and/or owner (traditionally the "games" user/group).
                   13949:             The following variables, documented in more detail in
1.45      wiz      13950:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   13951:             class="filename">mk/defaults/mk.conf</code>, control
                   13952:             this behaviour: <code class=
1.14      xtraeme  13953:             "varname">SETGIDGAME</code>, <code class=
                   13954:             "varname">GAMEDATAMODE</code>, <code class=
                   13955:             "varname">GAMEGRP</code>, <code class=
                   13956:             "varname">GAMEMODE</code>, <code class=
                   13957:             "varname">GAMEOWN</code>.</p>
1.1       grant    13958: 
                   13959:             <p>Note that per default, setgid installation of games
1.14      xtraeme  13960:             is disabled; setting <code class=
                   13961:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    13962:             variables accordingly.</p>
                   13963: 
                   13964:             <p>A package should therefor never hard code file
1.14      xtraeme  13965:             ownership or access permissions but rely on
                   13966:             <code class="varname">INSTALL_GAME</code> and
                   13967:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   13968:             these correctly.</p>
1.1       grant    13969:           </div>
                   13970: 
1.67      hubertf  13971:           <div class="sect2" lang="en">
1.1       grant    13972:             <div class="titlepage">
                   13973:               <div>
                   13974:                 <div>
1.67      hubertf  13975:                   <h3 class="title"><a name=
1.68      rillig   13976:                   "perl-scripts"></a>16.5.4.&nbsp;Packages
1.30      wiz      13977:                   containing perl scripts</h3>
1.1       grant    13978:                 </div>
                   13979:               </div>
                   13980:             </div>
                   13981: 
                   13982:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  13983:             set <code class="varname">REPLACE_PERL</code> to ensure
                   13984:             that the proper interpreter path is set. <code class=
                   13985:             "varname">REPLACE_PERL</code> should contain a list of
                   13986:             scripts, relative to <code class=
                   13987:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    13988:           </div>
                   13989: 
1.67      hubertf  13990:           <div class="sect2" lang="en">
1.1       grant    13991:             <div class="titlepage">
                   13992:               <div>
                   13993:                 <div>
1.67      hubertf  13994:                   <h3 class="title"><a name=
1.68      rillig   13995:                   "hardcoded-paths"></a>16.5.5.&nbsp;Packages with
1.1       grant    13996:                   hardcoded paths to other interpreters</h3>
                   13997:                 </div>
                   13998:               </div>
                   13999:             </div>
                   14000: 
                   14001:             <p>Your package may also contain scripts with hardcoded
                   14002:             paths to other interpreters besides (or as well as)
                   14003:             perl. To correct the full pathname to the script
                   14004:             interpreter, you need to set the following definitions
1.45      wiz      14005:             in your <code xmlns=
                   14006:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14007:             "filename">Makefile</code> (we shall use
                   14008:             <span><strong class="command">tclsh</strong></span> in
                   14009:             this example):</p>
1.1       grant    14010:             <pre class="programlisting">
1.51      rillig   14011:     REPLACE_INTERPRETER+=   tcl
1.71    ! wiz      14012:     REPLACE.tcl.old=        .*/bin/tclsh
        !          14013:     REPLACE.tcl.new=        ${PREFIX}/bin/tclsh
        !          14014:     REPLACE_FILES.tcl=      # list of tcl scripts which need to be fixed,
1.51      rillig   14015:                             # relative to ${WRKSRC}, just as in REPLACE_PERL
1.1       grant    14016: </pre>
1.71    ! wiz      14017: 
        !          14018:             <div class="note" style=
        !          14019:             "margin-left: 0.5in; margin-right: 0.5in;">
        !          14020:               <h3 class="title">Note</h3>
        !          14021: 
        !          14022:               <p>Before March 2006, these variables were called
        !          14023:               <code class="varname">_REPLACE.*</code> and
        !          14024:               <code class="varname">_REPLACE_FILES.*</code>.</p>
        !          14025:             </div>
1.1       grant    14026:           </div>
                   14027: 
1.67      hubertf  14028:           <div class="sect2" lang="en">
1.1       grant    14029:             <div class="titlepage">
                   14030:               <div>
                   14031:                 <div>
1.67      hubertf  14032:                   <h3 class="title"><a name=
1.68      rillig   14033:                   "perl-modules"></a>16.5.6.&nbsp;Packages
1.30      wiz      14034:                   installing perl modules</h3>
1.1       grant    14035:                 </div>
                   14036:               </div>
                   14037:             </div>
                   14038: 
                   14039:             <p>Makefiles of packages providing perl5 modules should
1.45      wiz      14040:             include the Makefile fragment <code xmlns=
                   14041:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14042:             "filename">../../lang/perl5/module.mk</code>. It
                   14043:             provides a <span><strong class=
                   14044:             "command">do-configure</strong></span> target for the
                   14045:             standard perl configuration for such modules as well as
                   14046:             various hooks to tune this configuration. See comments
                   14047:             in this file for details.</p>
1.1       grant    14048: 
                   14049:             <p>Perl5 modules will install into different places
                   14050:             depending on the version of perl used during the build
                   14051:             process. To address this, pkgsrc will append lines to
1.45      wiz      14052:             the <code xmlns=
                   14053:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14054:             "filename">PLIST</code> corresponding to the files
                   14055:             listed in the installed <code xmlns=
                   14056:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14057:             "filename">.packlist</code> file generated by most
                   14058:             perl5 modules. This is invoked by defining <code class=
                   14059:             "varname">PERL5_PACKLIST</code> to a space-separated
                   14060:             list of paths to packlist files, e.g.:</p>
1.1       grant    14061:             <pre class="programlisting">
1.51      rillig   14062:     PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
1.1       grant    14063: </pre>
                   14064: 
1.14      xtraeme  14065:             <p>The variables <code class=
                   14066:             "varname">PERL5_SITELIB</code>, <code class=
                   14067:             "varname">PERL5_SITEARCH</code>, and <code class=
                   14068:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    14069:             locations in which perl5 modules may be installed, and
                   14070:             may be used by perl5 packages that don't have a
                   14071:             packlist. These three variables are also substituted
1.45      wiz      14072:             for in the <code xmlns=
                   14073:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14074:             "filename">PLIST</code>.</p>
1.1       grant    14075:           </div>
                   14076: 
1.67      hubertf  14077:           <div class="sect2" lang="en">
1.1       grant    14078:             <div class="titlepage">
                   14079:               <div>
                   14080:                 <div>
1.67      hubertf  14081:                   <h3 class="title"><a name=
1.68      rillig   14082:                   "faq.info-files"></a>16.5.7.&nbsp;Packages
1.1       grant    14083:                   installing info files</h3>
                   14084:                 </div>
                   14085:               </div>
                   14086:             </div>
                   14087: 
                   14088:             <p>Some packages install info files or use the
                   14089:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   14090:             &#8220;<span class="quote">install-info</span>&#8221;
                   14091:             commands. Each of the info files:</p>
                   14092: 
                   14093:             <div class="itemizedlist">
                   14094:               <ul type="disc">
                   14095:                 <li>
                   14096:                   <p>is considered to be installed in the directory
1.45      wiz      14097:                   <code xmlns=
                   14098:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14099:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    14100:                 </li>
                   14101: 
                   14102:                 <li>
                   14103:                   <p>is registered in the Info directory file
1.45      wiz      14104:                   <code xmlns=
                   14105:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14106:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    14107:                 </li>
                   14108: 
                   14109:                 <li>
                   14110:                   <p>and must be listed as a filename in the
1.14      xtraeme  14111:                   <code class="varname">INFO_FILES</code> variable
                   14112:                   in the package Makefile.</p>
1.1       grant    14113:                 </li>
                   14114:               </ul>
                   14115:             </div>
                   14116: 
1.14      xtraeme  14117:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    14118:             &#8220;<span class="quote">info</span>&#8221; and can
1.45      wiz      14119:             be overridden in the package Makefile. <code xmlns=
                   14120:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14121:             "filename">INSTALL</code> and <code xmlns=
                   14122:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14123:             "filename">DEINSTALL</code> scripts will be generated
                   14124:             to handle registration of the info files in the Info
1.1       grant    14125:             directory file. The &#8220;<span class=
                   14126:             "quote">install-info</span>&#8221; command used for the
                   14127:             info files registration is either provided by the
                   14128:             system, or by a special purpose package automatically
                   14129:             added as dependency if needed.</p>
                   14130: 
                   14131:             <p>A package which needs the &#8220;<span class=
                   14132:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  14133:             must define the variable <code class=
                   14134:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    14135:             minimum version of the &#8220;<span class=
                   14136:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  14137:             should be noted with the <code class=
                   14138:             "varname">TEXINFO_REQD</code> variable in the package
1.45      wiz      14139:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14140:             class="filename">Makefile</code>. By default, a minimum
                   14141:             version of 3.12 is required. If the system does not
                   14142:             provide a <span><strong class=
1.14      xtraeme  14143:             "command">makeinfo</strong></span> command or if it
                   14144:             does not match the required minimum, a build dependency
                   14145:             on the <a xmlns=
                   14146:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    14147:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.45      wiz      14148:             target="_top"><code xmlns="" class=
                   14149:             "filename">devel/gtexinfo</code></a> package will be
1.20      ben      14150:             added automatically.</p>
1.1       grant    14151: 
                   14152:             <p>The build and installation process of the software
                   14153:             provided by the package should not use the
1.14      xtraeme  14154:             <span><strong class=
                   14155:             "command">install-info</strong></span> command as the
                   14156:             registration of info files is the task of the package
1.45      wiz      14157:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14158:             class="filename">INSTALL</code> script, and it must use
                   14159:             the appropriate <span><strong class=
1.14      xtraeme  14160:             "command">makeinfo</strong></span> command.</p>
1.1       grant    14161: 
1.47      reed     14162:             <p>To achieve this goal, the pkgsrc infrastructure
1.14      xtraeme  14163:             creates overriding scripts for the <span><strong class=
                   14164:             "command">install-info</strong></span> and
                   14165:             <span><strong class="command">makeinfo</strong></span>
                   14166:             commands in a directory listed early in <code class=
                   14167:             "varname">PATH</code>.</p>
1.1       grant    14168: 
1.14      xtraeme  14169:             <p>The script overriding <span><strong class=
                   14170:             "command">install-info</strong></span> has no effect
                   14171:             except the logging of a message. The script overriding
                   14172:             <span><strong class="command">makeinfo</strong></span>
                   14173:             logs a message and according to the value of
                   14174:             <code class="varname">USE_MAKEINFO</code> and
                   14175:             <code class="varname">TEXINFO_REQD</code> either run
                   14176:             the appropriate <span><strong class=
                   14177:             "command">makeinfo</strong></span> command or exit on
                   14178:             error.</p>
1.1       grant    14179:           </div>
                   14180: 
1.67      hubertf  14181:           <div class="sect2" lang="en">
1.57      minskim  14182:             <div class="titlepage">
                   14183:               <div>
                   14184:                 <div>
1.67      hubertf  14185:                   <h3 class="title"><a name=
1.68      rillig   14186:                   "manpages"></a>16.5.8.&nbsp;Packages installing
1.57      minskim  14187:                   man pages</h3>
                   14188:                 </div>
                   14189:               </div>
                   14190:             </div>
                   14191: 
                   14192:             <p>Many packages install manual pages. The man pages
                   14193:             are installed under <code class=
                   14194:             "varname">${PREFIX}/${PKGMANDIR}</code> which is
                   14195:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14196:             class="filename">/usr/pkg/man</code> by default.
                   14197:             <code class="varname">PKGMANDIR</code> defaults to
                   14198:             &#8220;<span class="quote">man</span>&#8221;. For
                   14199:             example, you can set <code class=
                   14200:             "varname">PKGMANDIR</code> to &#8220;<span class=
                   14201:             "quote">share/man</span>&#8221; to have man pages
                   14202:             install under <code xmlns=
                   14203:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14204:             "filename">/usr/pkg/share/man/</code> by default.</p>
                   14205: 
                   14206:             <div class="note" style=
                   14207:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14208:               <h3 class="title">Note</h3>
                   14209: 
                   14210:               <p>The support for a custom <code class=
                   14211:               "varname">PKGMANDIR</code> is not complete.</p>
                   14212:             </div>
                   14213: 
                   14214:             <p>The <code xmlns=
                   14215:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14216:             "filename">PLIST</code> files can just use <code xmlns=
                   14217:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14218:             "filename">man/</code> as the top level directory for
                   14219:             the man page file entries and the pkgsrc framework will
                   14220:             convert as needed.</p>
                   14221: 
                   14222:             <p>Packages that are configured with <code class=
                   14223:             "varname">GNU_CONFIGURE</code> set as
                   14224:             &#8220;<span class="quote">yes</span>&#8221;, by
                   14225:             default will use the <code xmlns=
                   14226:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14227:             "filename">./configure</code> --mandir switch to set
                   14228:             where the man pages should be installed. The path is
                   14229:             <code class="varname">GNU_CONFIGURE_MANDIR</code> which
                   14230:             defaults to <code class=
                   14231:             "varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   14232: 
                   14233:             <p>Packages that use <code class=
                   14234:             "varname">GNU_CONFIGURE</code> but do not use --mandir,
                   14235:             can set <code class=
                   14236:             "varname">CONFIGURE_HAS_MANDIR</code> to
                   14237:             &#8220;<span class="quote">no</span>&#8221;. Or if the
                   14238:             <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   14239:             class="filename">./configure</code> script uses a
                   14240:             non-standard use of --mandir, you can set <code class=
                   14241:             "varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
                   14242: 
                   14243:             <p>See <a href="#manpage-compression" title=
                   14244:             "10.5.&nbsp;Man page compression">Section&nbsp;10.5,
                   14245:             &#8220;Man page compression&#8221;</a> for information
                   14246:             on installation of compressed manual pages.</p>
                   14247:           </div>
                   14248: 
1.67      hubertf  14249:           <div class="sect2" lang="en">
1.1       grant    14250:             <div class="titlepage">
                   14251:               <div>
                   14252:                 <div>
1.67      hubertf  14253:                   <h3 class="title"><a name=
1.68      rillig   14254:                   "gconf2-data-files"></a>16.5.9.&nbsp;Packages
1.30      wiz      14255:                   installing GConf2 data files</h3>
1.1       grant    14256:                 </div>
                   14257:               </div>
                   14258:             </div>
                   14259: 
1.45      wiz      14260:             <p>If a package installs <code xmlns=
                   14261:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14262:             "filename">.schemas</code> or <code xmlns=
                   14263:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14264:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    14265:             need to take some extra steps to make sure they get
                   14266:             registered in the database:</p>
                   14267: 
                   14268:             <div class="orderedlist">
                   14269:               <ol type="1">
                   14270:                 <li>
1.45      wiz      14271:                   <p>Include <code xmlns=
                   14272:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14273:                   "filename">../../devel/GConf2/schemas.mk</code>
1.45      wiz      14274:                   instead of its <code xmlns=
                   14275:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14276:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    14277:                   care of rebuilding the GConf2 database at
                   14278:                   installation and deinstallation time, and tells
                   14279:                   the package where to install GConf2 data files
                   14280:                   using some standard configure arguments. It also
                   14281:                   disallows any access to the database directly
                   14282:                   from the package.</p>
                   14283:                 </li>
                   14284: 
                   14285:                 <li>
                   14286:                   <p>Ensure that the package installs its
1.45      wiz      14287:                   <code xmlns=
                   14288:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14289:                   "filename">.schemas</code> files under
                   14290:                   <code xmlns=
                   14291:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14292:                   "filename">${PREFIX}/share/gconf/schemas</code>.
1.45      wiz      14293:                   If they get installed under <code xmlns=
                   14294:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14295:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    14296:                   manually patch the package.</p>
                   14297:                 </li>
                   14298: 
                   14299:                 <li>
                   14300:                   <p>Check the PLIST and remove any entries under
                   14301:                   the etc/gconf directory, as they will be handled
                   14302:                   automatically. See <a href="#faq.conf" title=
1.38      dillo    14303:                   "7.14.&nbsp;How do I change the location of configuration files?">
                   14304:                   Section&nbsp;7.14, &#8220;How do I change the
1.35      jmmv     14305:                   location of configuration files?&#8221;</a> for
                   14306:                   more information.</p>
1.1       grant    14307:                 </li>
                   14308: 
                   14309:                 <li>
1.14      xtraeme  14310:                   <p>Define the <code class=
                   14311:                   "varname">GCONF2_SCHEMAS</code> variable in your
1.45      wiz      14312:                   <code xmlns=
                   14313:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14314:                   "filename">Makefile</code> with a list of all
                   14315:                   <code xmlns=
                   14316:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14317:                   "filename">.schemas</code> files installed by the
                   14318:                   package, if any. Names must not contain any
                   14319:                   directories in them.</p>
1.1       grant    14320:                 </li>
                   14321: 
                   14322:                 <li>
1.14      xtraeme  14323:                   <p>Define the <code class=
                   14324:                   "varname">GCONF2_ENTRIES</code> variable in your
1.45      wiz      14325:                   <code xmlns=
                   14326:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14327:                   "filename">Makefile</code> with a list of all
                   14328:                   <code xmlns=
                   14329:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14330:                   "filename">.entries</code> files installed by the
                   14331:                   package, if any. Names must not contain any
                   14332:                   directories in them.</p>
1.1       grant    14333:                 </li>
                   14334:               </ol>
                   14335:             </div>
                   14336:           </div>
                   14337: 
1.67      hubertf  14338:           <div class="sect2" lang="en">
1.1       grant    14339:             <div class="titlepage">
                   14340:               <div>
                   14341:                 <div>
1.30      wiz      14342:                   <h3 class="title"><a name=
1.68      rillig   14343:                   "scrollkeeper-data-files"></a>16.5.10.&nbsp;Packages
1.30      wiz      14344:                   installing scrollkeeper data files</h3>
1.1       grant    14345:                 </div>
                   14346:               </div>
                   14347:             </div>
                   14348: 
1.45      wiz      14349:             <p>If a package installs <code xmlns=
                   14350:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14351:             "filename">.omf</code> files, used by scrollkeeper, you
                   14352:             need to take some extra steps to make sure they get
                   14353:             registered in the database:</p>
1.1       grant    14354: 
                   14355:             <div class="orderedlist">
                   14356:               <ol type="1">
                   14357:                 <li>
1.45      wiz      14358:                   <p>Include <code xmlns=
                   14359:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14360:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
1.45      wiz      14361:                   instead of its <code xmlns=
                   14362:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14363:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    14364:                   care of rebuilding the scrollkeeper database at
                   14365:                   installation and deinstallation time, and
                   14366:                   disallows any access to it directly from the
                   14367:                   package.</p>
                   14368:                 </li>
                   14369: 
                   14370:                 <li>
                   14371:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14372:                   the <code xmlns=
                   14373:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14374:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    14375:                   as they will be handled automatically.</p>
                   14376:                 </li>
                   14377: 
                   14378:                 <li>
1.45      wiz      14379:                   <p>Remove the <code xmlns=
                   14380:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14381:                   "filename">share/omf</code> directory from the
                   14382:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    14383:                 </li>
                   14384:               </ol>
                   14385:             </div>
                   14386:           </div>
                   14387: 
1.67      hubertf  14388:           <div class="sect2" lang="en">
1.1       grant    14389:             <div class="titlepage">
                   14390:               <div>
                   14391:                 <div>
1.67      hubertf  14392:                   <h3 class="title"><a name=
1.68      rillig   14393:                   "x11-fonts"></a>16.5.11.&nbsp;Packages installing
1.1       grant    14394:                   X11 fonts</h3>
                   14395:                 </div>
                   14396:               </div>
                   14397:             </div>
                   14398: 
                   14399:             <p>If a package installs font files, you will need to
                   14400:             rebuild the fonts database in the directory where they
                   14401:             get installed at installation and deinstallation time.
1.65      hubertf  14402:             This can be automatically done by using the pkginstall
                   14403:             framework.</p>
1.1       grant    14404: 
1.65      hubertf  14405:             <p>You can list the directories where fonts are
                   14406:             installed in the <code class=
                   14407:             "varname">FONTS_DIRS.<em class=
                   14408:             "replaceable"><code>type</code></em></code> variables,
                   14409:             where <em class="replaceable"><code>type</code></em>
                   14410:             can be one of &#8220;<span class=
                   14411:             "quote">ttf</span>&#8221;, &#8220;<span class=
                   14412:             "quote">type1</span>&#8221; or &#8220;<span class=
                   14413:             "quote">x11</span>&#8221;. Also make sure that the
                   14414:             database file <code xmlns=
1.45      wiz      14415:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14416:             "filename">fonts.dir</code> is not listed in the
1.1       grant    14417:             PLIST.</p>
                   14418: 
                   14419:             <p>Note that you should not create new directories for
                   14420:             fonts; instead use the standard ones to avoid that the
                   14421:             user needs to manually configure his X server to find
                   14422:             them.</p>
                   14423:           </div>
                   14424: 
1.67      hubertf  14425:           <div class="sect2" lang="en">
1.1       grant    14426:             <div class="titlepage">
                   14427:               <div>
                   14428:                 <div>
1.67      hubertf  14429:                   <h3 class="title"><a name=
1.68      rillig   14430:                   "gtk2-modules"></a>16.5.12.&nbsp;Packages
1.30      wiz      14431:                   installing GTK2 modules</h3>
1.1       grant    14432:                 </div>
                   14433:               </div>
                   14434:             </div>
                   14435: 
1.47      reed     14436:             <p>If a package installs GTK2 immodules or loaders, you
1.1       grant    14437:             need to take some extra steps to get them registered in
                   14438:             the GTK2 database properly:</p>
                   14439: 
                   14440:             <div class="orderedlist">
                   14441:               <ol type="1">
                   14442:                 <li>
1.45      wiz      14443:                   <p>Include <code xmlns=
                   14444:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14445:                   "filename">../../x11/gtk2/modules.mk</code>
1.45      wiz      14446:                   instead of its <code xmlns=
                   14447:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14448:                   "filename">buildlink3.mk</code> file. This takes
                   14449:                   care of rebuilding the database at installation
                   14450:                   and deinstallation time.</p>
1.1       grant    14451:                 </li>
                   14452: 
                   14453:                 <li>
1.14      xtraeme  14454:                   <p>Set <code class=
                   14455:                   "varname">GTK2_IMMODULES=YES</code> if your
                   14456:                   package installs GTK2 immodules.</p>
1.1       grant    14457:                 </li>
                   14458: 
                   14459:                 <li>
1.14      xtraeme  14460:                   <p>Set <code class=
                   14461:                   "varname">GTK2_LOADERS=YES</code> if your package
                   14462:                   installs GTK2 loaders.</p>
1.1       grant    14463:                 </li>
                   14464: 
                   14465:                 <li>
1.47      reed     14466:                   <p>Patch the package to not touch any of the GTK2
1.1       grant    14467:                   databases directly. These are:</p>
                   14468: 
                   14469:                   <div class="itemizedlist">
                   14470:                     <ul type="disc">
                   14471:                       <li>
1.45      wiz      14472:                         <p><code xmlns=
                   14473:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14474:                         class=
1.14      xtraeme  14475:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    14476:                       </li>
                   14477: 
                   14478:                       <li>
1.45      wiz      14479:                         <p><code xmlns=
                   14480:                         "http://www.w3.org/TR/xhtml1/transitional"
                   14481:                         class=
1.14      xtraeme  14482:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    14483:                       </li>
                   14484:                     </ul>
                   14485:                   </div>
                   14486:                 </li>
                   14487: 
                   14488:                 <li>
                   14489:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14490:                   the <code xmlns=
                   14491:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14492:                   "filename">libdata/gtk-2.0</code> directory, as
                   14493:                   they will be handled automatically.</p>
1.1       grant    14494:                 </li>
                   14495:               </ol>
                   14496:             </div>
                   14497:           </div>
                   14498: 
1.67      hubertf  14499:           <div class="sect2" lang="en">
1.1       grant    14500:             <div class="titlepage">
                   14501:               <div>
                   14502:                 <div>
1.67      hubertf  14503:                   <h3 class="title"><a name=
1.68      rillig   14504:                   "sgml-xml-data"></a>16.5.13.&nbsp;Packages
1.30      wiz      14505:                   installing SGML or XML data</h3>
1.1       grant    14506:                 </div>
                   14507:               </div>
                   14508:             </div>
                   14509: 
                   14510:             <p>If a package installs SGML or XML data files that
                   14511:             need to be registered in system-wide catalogs (like
                   14512:             DTDs, sub-catalogs, etc.), you need to take some extra
                   14513:             steps:</p>
                   14514: 
                   14515:             <div class="orderedlist">
                   14516:               <ol type="1">
                   14517:                 <li>
1.45      wiz      14518:                   <p>Include <code xmlns=
                   14519:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14520:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
1.45      wiz      14521:                   in your <code xmlns=
                   14522:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14523:                   "filename">Makefile</code>, which takes care of
                   14524:                   registering those files in system-wide catalogs
                   14525:                   at installation and deinstallation time.</p>
1.1       grant    14526:                 </li>
                   14527: 
                   14528:                 <li>
1.14      xtraeme  14529:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   14530:                   to the full path of any SGML catalogs installed
                   14531:                   by the package.</p>
1.1       grant    14532:                 </li>
                   14533: 
                   14534:                 <li>
1.14      xtraeme  14535:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   14536:                   to the full path of any XML catalogs installed by
1.1       grant    14537:                   the package.</p>
                   14538:                 </li>
                   14539: 
                   14540:                 <li>
1.14      xtraeme  14541:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   14542:                   to individual entries to be added to the SGML
1.1       grant    14543:                   catalog. These come in groups of three strings;
                   14544:                   see xmlcatmgr(1) for more information
                   14545:                   (specifically, arguments recognized by the 'add'
                   14546:                   action). Note that you will normally not use this
                   14547:                   variable.</p>
                   14548:                 </li>
                   14549: 
                   14550:                 <li>
1.14      xtraeme  14551:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   14552:                   to individual entries to be added to the XML
1.1       grant    14553:                   catalog. These come in groups of three strings;
                   14554:                   see xmlcatmgr(1) for more information
                   14555:                   (specifically, arguments recognized by the 'add'
                   14556:                   action). Note that you will normally not use this
                   14557:                   variable.</p>
                   14558:                 </li>
                   14559:               </ol>
                   14560:             </div>
                   14561:           </div>
                   14562: 
1.67      hubertf  14563:           <div class="sect2" lang="en">
1.1       grant    14564:             <div class="titlepage">
                   14565:               <div>
                   14566:                 <div>
1.67      hubertf  14567:                   <h3 class="title"><a name=
1.68      rillig   14568:                   "mime-database"></a>16.5.14.&nbsp;Packages
1.30      wiz      14569:                   installing extensions to the MIME database</h3>
1.1       grant    14570:                 </div>
                   14571:               </div>
                   14572:             </div>
                   14573: 
                   14574:             <p>If a package provides extensions to the MIME
1.45      wiz      14575:             database by installing <code xmlns=
                   14576:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14577:             "filename">.xml</code> files inside <code xmlns=
                   14578:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14579:             "filename">${PREFIX}/share/mime/packages</code>, you
                   14580:             need to take some extra steps to ensure that the
                   14581:             database is kept consistent with respect to these new
                   14582:             files:</p>
1.1       grant    14583: 
                   14584:             <div class="orderedlist">
                   14585:               <ol type="1">
                   14586:                 <li>
1.45      wiz      14587:                   <p>Include <code xmlns=
                   14588:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14589:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
1.45      wiz      14590:                   (avoid using the <code xmlns=
                   14591:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14592:                   "filename">buildlink3.mk</code> file from this
                   14593:                   same directory, which is reserved for inclusion
1.45      wiz      14594:                   from other <code xmlns=
                   14595:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14596:                   "filename">buildlink3.mk</code> files). It takes
                   14597:                   care of rebuilding the MIME database at
                   14598:                   installation and deinstallation time, and
                   14599:                   disallows any access to it directly from the
1.1       grant    14600:                   package.</p>
                   14601:                 </li>
                   14602: 
                   14603:                 <li>
                   14604:                   <p>Check the PLIST and remove any entries under
1.45      wiz      14605:                   the <code xmlns=
                   14606:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14607:                   "filename">share/mime</code> directory,
                   14608:                   <span class="emphasis"><em>except</em></span> for
                   14609:                   files saved under <code xmlns=
                   14610:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14611:                   "filename">share/mime/packages</code>. The former
1.1       grant    14612:                   are handled automatically by the
1.47      reed     14613:                   update-mime-database program, but the latter are
1.1       grant    14614:                   package-dependent and must be removed by the
                   14615:                   package that installed them in the first
                   14616:                   place.</p>
                   14617:                 </li>
                   14618: 
                   14619:                 <li>
1.45      wiz      14620:                   <p>Remove any <code xmlns=
                   14621:                   "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14622:                   "filename">share/mime/*</code> directories from
                   14623:                   the PLIST. They will be handled by the
1.1       grant    14624:                   shared-mime-info package.</p>
                   14625:                 </li>
                   14626:               </ol>
                   14627:             </div>
                   14628:           </div>
                   14629: 
1.67      hubertf  14630:           <div class="sect2" lang="en">
1.1       grant    14631:             <div class="titlepage">
                   14632:               <div>
                   14633:                 <div>
1.67      hubertf  14634:                   <h3 class="title"><a name=
1.68      rillig   14635:                   "intltool"></a>16.5.15.&nbsp;Packages using
1.1       grant    14636:                   intltool</h3>
                   14637:                 </div>
                   14638:               </div>
                   14639:             </div>
                   14640: 
                   14641:             <p>If a package uses intltool during its build, include
1.45      wiz      14642:             the <code xmlns=
                   14643:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14644:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    14645:             file, which forces it to use the intltool package
                   14646:             provided by pkgsrc, instead of the one bundled with the
                   14647:             distribution file.</p>
                   14648: 
                   14649:             <p>This tracks intltool's build-time dependencies and
                   14650:             uses the latest available version; this way, the
                   14651:             package benefits of any bug fixes that may have
                   14652:             appeared since it was released.</p>
                   14653:           </div>
1.18      xtraeme  14654: 
1.67      hubertf  14655:           <div class="sect2" lang="en">
1.18      xtraeme  14656:             <div class="titlepage">
                   14657:               <div>
                   14658:                 <div>
1.67      hubertf  14659:                   <h3 class="title"><a name=
1.68      rillig   14660:                   "startup-scripts"></a>16.5.16.&nbsp;Packages
1.30      wiz      14661:                   installing startup scripts</h3>
1.18      xtraeme  14662:                 </div>
                   14663:               </div>
                   14664:             </div>
                   14665: 
                   14666:             <p>If a package contains a rc.d script, it won't be
                   14667:             copied into the startup directory by default, but you
                   14668:             can enable it, by adding the option <code class=
1.45      wiz      14669:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code xmlns=
                   14670:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14671:             "filename">/etc/mk.conf</code>. This option will copy
1.45      wiz      14672:             the scripts into <code xmlns=
                   14673:             "http://www.w3.org/TR/xhtml1/transitional" class=
1.18      xtraeme  14674:             "filename">/etc/rc.d</code> when a package is
                   14675:             installed, and it will automatically remove the scripts
                   14676:             when the package is deinstalled.</p>
                   14677:           </div>
1.57      minskim  14678: 
1.67      hubertf  14679:           <div class="sect2" lang="en">
1.57      minskim  14680:             <div class="titlepage">
                   14681:               <div>
                   14682:                 <div>
1.67      hubertf  14683:                   <h3 class="title"><a name=
1.68      rillig   14684:                   "tex-packages"></a>16.5.17.&nbsp;Packages
1.57      minskim  14685:                   installing TeX modules</h3>
                   14686:                 </div>
                   14687:               </div>
                   14688:             </div>
                   14689: 
                   14690:             <p>If a package installs TeX packages into the texmf
                   14691:             tree, the <code xmlns=
                   14692:             "http://www.w3.org/TR/xhtml1/transitional" class=
                   14693:             "filename">ls-R</code> database of the tree needs to be
                   14694:             updated.</p>
                   14695: 
                   14696:             <div class="note" style=
                   14697:             "margin-left: 0.5in; margin-right: 0.5in;">
                   14698:               <h3 class="title">Note</h3>
                   14699: 
                   14700:               <p>Except the main TeX packages such as teTeX-texmf,
                   14701:               packages should install files into <code class=
                   14702:               "varname">PKG_LOCALTEXMFPREFIX</code>, not
                   14703:               <code class="varname">PKG_TEXMFPREFIX</code>.</p>
                   14704:             </div>
                   14705: 
                   14706:             <div class="orderedlist">
                   14707:               <ol type="1">
                   14708:                 <li>
                   14709:                   <p>Include <code xmlns=
                   14710:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14711:                   "filename">../../print/teTeX/module.mk</code>
                   14712:                   instead of <code xmlns=
                   14713:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14714:                   "filename">../../mk/tex.buildlink3.mk</code>.
                   14715:                   This takes care of rebuilding the <code xmlns=
                   14716:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14717:                   "filename">ls-R</code> database at installation
                   14718:                   and deinstallation time.</p>
                   14719:                 </li>
                   14720: 
                   14721:                 <li>
                   14722:                   <p>If your package installs files into a texmf
                   14723:                   tree other than the one at <code class=
                   14724:                   "varname">PKG_LOCALTEXMFPREFIX</code>, set
                   14725:                   <code class="varname">TEXMFDIRS</code> to the
                   14726:                   list of all texmf trees that need database
                   14727:                   update.</p>
1.64      kim      14728: 
                   14729:                   <p>If your package also installs font map files
                   14730:                   that need to be registered using
                   14731:                   <span><strong class=
                   14732:                   "command">updmap</strong></span>, set
                   14733:                   <code class="varname">TEX_FONTMAPS</code> to the
                   14734:                   list of all such font map files. Then
                   14735:                   <span><strong class=
                   14736:                   "command">updmap</strong></span> will be run
                   14737:                   automatically at installation/deinstallation to
                   14738:                   enable/disable font map files for TeX output
                   14739:                   drivers.</p>
1.57      minskim  14740:                 </li>
                   14741: 
                   14742:                 <li>
                   14743:                   <p>Make sure that none of <code xmlns=
                   14744:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14745:                   "filename">ls-R</code> databases are included in
                   14746:                   <code xmlns=
                   14747:                   "http://www.w3.org/TR/xhtml1/transitional" class=
                   14748:                   "filename">PLIST</code>, as they will be removed
                   14749:                   only by the teTeX-bin package.</p>
                   14750:                 </li>
                   14751:               </ol>
                   14752:             </div>
                   14753:           </div>
1.1       grant    14754:         </div>
                   14755: 
1.67      hubertf  14756:         <div class="sect1" lang="en">
1.1       grant    14757:           <div class="titlepage">
                   14758:             <div>
                   14759:               <div>
                   14760:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   14761:                 "feedback-to-author"></a>16.6.&nbsp;Feedback to the
1.30      wiz      14762:                 author</h2>
1.1       grant    14763:               </div>
                   14764:             </div>
                   14765:           </div>
                   14766: 
                   14767:           <p>If you have found any bugs in the package you make
                   14768:           available, if you had to do special steps to make it run
                   14769:           under NetBSD or if you enhanced the software in various
                   14770:           other ways, be sure to report these changes back to the
                   14771:           original author of the program! With that kind of
                   14772:           support, the next release of the program can incorporate
                   14773:           these fixes, and people not using the NetBSD packages
                   14774:           system can win from your efforts.</p>
                   14775: 
                   14776:           <p>Support the idea of free software!</p>
                   14777:         </div>
                   14778:       </div>
                   14779: 
1.67      hubertf  14780:       <div class="chapter" lang="en">
1.1       grant    14781:         <div class="titlepage">
                   14782:           <div>
                   14783:             <div>
1.67      hubertf  14784:               <h2 class="title"><a name=
1.68      rillig   14785:               "debug"></a>Chapter&nbsp;17.&nbsp;Debugging</h2>
1.1       grant    14786:             </div>
                   14787:           </div>
                   14788:         </div>
                   14789: 
                   14790:         <p>To check out all the gotchas when building a package,
                   14791:         here are the steps that I do in order to get a package
                   14792:         working. Please note this is basically the same as what was
                   14793:         explained in the previous sections, only with some
                   14794:         debugging aids.</p>
                   14795: 
                   14796:         <div class="itemizedlist">
                   14797:           <ul type="disc">
                   14798:             <li>
1.14      xtraeme  14799:               <p>Be sure to set <code class=
1.45      wiz      14800:               "varname">PKG_DEVELOPER=1</code> in <code xmlns=
                   14801:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14802:               "filename">/etc/mk.conf</code></p>
1.1       grant    14803:             </li>
                   14804: 
                   14805:             <li>
                   14806:               <p>Install <a xmlns=
                   14807:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14808:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.45      wiz      14809:               target="_top"><code xmlns="" class=
                   14810:               "filename">pkgtools/url2pkg</code></a>, create a
1.20      ben      14811:               directory for a new package, change into it, then run
                   14812:               <span><strong class=
                   14813:               "command">url2pkg</strong></span>:</p>
1.1       grant    14814:               <pre class="screen">
1.14      xtraeme  14815: <code class="prompt">%</code> <strong class=
                   14816: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   14817: "replaceable"><code>category</code></em>/<em class=
                   14818: "replaceable"><code>examplepkg</code></em></code></strong>
                   14819: <code class="prompt">%</code> <strong class=
                   14820: "userinput"><code>cd /usr/pkgsrc/<em class=
                   14821: "replaceable"><code>category</code></em>/<em class=
                   14822: "replaceable"><code>examplepkg</code></em></code></strong>
                   14823: <code class="prompt">%</code> <strong class=
                   14824: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    14825: </pre>
                   14826:             </li>
                   14827: 
                   14828:             <li>
1.45      wiz      14829:               <p>Edit the <code xmlns=
                   14830:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14831:               "filename">Makefile</code> as requested.</p>
1.1       grant    14832:             </li>
                   14833: 
                   14834:             <li>
1.45      wiz      14835:               <p>Fill in the <code xmlns=
                   14836:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14837:               "filename">DESCR</code> file</p>
1.1       grant    14838:             </li>
                   14839: 
                   14840:             <li>
1.14      xtraeme  14841:               <p>Run <span><strong class="command">make
                   14842:               configure</strong></span></p>
1.1       grant    14843:             </li>
                   14844: 
                   14845:             <li>
                   14846:               <p>Add any dependencies glimpsed from documentation
1.45      wiz      14847:               and the configure step to the package's <code xmlns=
                   14848:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14849:               "filename">Makefile</code>.</p>
1.1       grant    14850:             </li>
                   14851: 
                   14852:             <li>
                   14853:               <p>Make the package compile, doing multiple rounds
                   14854:               of</p>
                   14855:               <pre class="screen">
1.14      xtraeme  14856: <code class="prompt">%</code> <strong class=
                   14857: "userinput"><code>make</code></strong>
                   14858: <code class="prompt">%</code> <strong class=
                   14859: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   14860: <code class="prompt">%</code> <strong class=
                   14861: "userinput"><code>mkpatches</code></strong>
                   14862: <code class="prompt">%</code> <strong class=
                   14863: "userinput"><code>patchdiff</code></strong>
                   14864: <code class="prompt">%</code> <strong class=
                   14865: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   14866: <code class="prompt">%</code> <strong class=
                   14867: "userinput"><code>make mps</code></strong>
                   14868: <code class="prompt">%</code> <strong class=
                   14869: "userinput"><code>make clean</code></strong>
1.1       grant    14870: </pre>
                   14871: 
                   14872:               <p>Doing as non-root user will ensure that no files
                   14873:               are modified that shouldn't be, especially during the
1.14      xtraeme  14874:               build phase. <span><strong class=
                   14875:               "command">mkpatches</strong></span>,
                   14876:               <span><strong class=
                   14877:               "command">patchdiff</strong></span> and
                   14878:               <span><strong class="command">pkgvi</strong></span>
                   14879:               are from the <a xmlns=
1.1       grant    14880:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14881:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.45      wiz      14882:               target="_top"><code xmlns="" class=
                   14883:               "filename">pkgtools/pkgdiff</code></a> package.</p>
1.1       grant    14884:             </li>
                   14885: 
                   14886:             <li>
1.45      wiz      14887:               <p>Look at the <code xmlns=
                   14888:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14889:               "filename">Makefile</code>, fix if necessary; see
                   14890:               <a href="#components.Makefile" title=
1.38      dillo    14891:               "8.1.&nbsp;Makefile">Section&nbsp;8.1,
1.45      wiz      14892:               &#8220;<code xmlns=
                   14893:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14894:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    14895:             </li>
                   14896: 
                   14897:             <li>
1.45      wiz      14898:               <p>Generate a <code xmlns=
                   14899:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14900:               "filename">PLIST</code>:</p>
1.1       grant    14901:               <pre class="screen">
1.14      xtraeme  14902: <code class="prompt">#</code> <strong class=
                   14903: "userinput"><code>make install</code></strong>
                   14904: <code class="prompt">#</code> <strong class=
                   14905: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   14906: <code class="prompt">#</code> <strong class=
                   14907: "userinput"><code>make deinstall</code></strong>
                   14908: <code class="prompt">#</code> <strong class=
                   14909: "userinput"><code>make install</code></strong>
                   14910: <code class="prompt">#</code> <strong class=
                   14911: "userinput"><code>make deinstall</code></strong>
1.1       grant    14912: </pre>
                   14913: 
1.45      wiz      14914:               <p>You usually need to be <code xmlns=
                   14915:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  14916:               "username">root</code> to do this. Look if there are
1.1       grant    14917:               any files left:</p>
                   14918:               <pre class="screen">
1.14      xtraeme  14919: <code class="prompt">#</code> <strong class=
                   14920: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14921: </pre>
                   14922: 
                   14923:               <p>If this reveals any files that are missing in
1.45      wiz      14924:               <code xmlns=
                   14925:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14926:               "filename">PLIST</code>, add them.</p>
1.1       grant    14927:             </li>
                   14928: 
                   14929:             <li>
1.45      wiz      14930:               <p>Now that the <code xmlns=
                   14931:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   14932:               "filename">PLIST</code> is OK, install the package
                   14933:               again and make a binary package:</p>
1.1       grant    14934:               <pre class="screen">
1.14      xtraeme  14935: <code class="prompt">#</code> <strong class=
                   14936: "userinput"><code>make reinstall</code></strong>
                   14937: <code class="prompt">#</code> <strong class=
                   14938: "userinput"><code>make package</code></strong>
1.1       grant    14939: </pre>
                   14940:             </li>
                   14941: 
                   14942:             <li>
                   14943:               <p>Delete the installed package:</p>
                   14944:               <pre class="screen">
1.14      xtraeme  14945: <code class="prompt">#</code> <strong class=
                   14946: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    14947: </pre>
                   14948:             </li>
                   14949: 
                   14950:             <li>
1.14      xtraeme  14951:               <p>Repeat the above <span><strong class=
                   14952:               "command">make print-PLIST</strong></span> command,
                   14953:               which shouldn't find anything now:</p>
1.1       grant    14954:               <pre class="screen">
1.14      xtraeme  14955: <code class="prompt">#</code> <strong class=
                   14956: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    14957: </pre>
                   14958:             </li>
                   14959: 
                   14960:             <li>
                   14961:               <p>Reinstall the binary package:</p>
                   14962:               <pre class="screen">
1.14      xtraeme  14963: <code class="prompt">#</code> <strong class=
                   14964: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    14965: </pre>
                   14966:             </li>
                   14967: 
                   14968:             <li>
                   14969:               <p>Play with it. Make sure everything works.</p>
                   14970:             </li>
                   14971: 
                   14972:             <li>
1.14      xtraeme  14973:               <p>Run <span><strong class=
                   14974:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    14975:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   14976:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      14977:               target="_top"><code xmlns="" class=
                   14978:               "filename">pkgtools/pkglint</code></a>, and fix the
1.20      ben      14979:               problems it reports:</p>
1.1       grant    14980:               <pre class="screen">
1.14      xtraeme  14981: <code class="prompt">#</code> <strong class=
                   14982: "userinput"><code>pkglint</code></strong>
1.1       grant    14983: </pre>
                   14984:             </li>
                   14985: 
                   14986:             <li>
                   14987:               <p>Submit (or commit, if you have cvs access); see
                   14988:               <a href="#submit" title=
1.68      rillig   14989:               "Chapter&nbsp;18.&nbsp;Submitting and Committing">Chapter&nbsp;18,
1.1       grant    14990:               <i>Submitting and Committing</i></a>.</p>
                   14991:             </li>
                   14992:           </ul>
                   14993:         </div>
                   14994:       </div>
                   14995: 
1.67      hubertf  14996:       <div class="chapter" lang="en">
1.1       grant    14997:         <div class="titlepage">
                   14998:           <div>
                   14999:             <div>
1.67      hubertf  15000:               <h2 class="title"><a name=
1.68      rillig   15001:               "submit"></a>Chapter&nbsp;18.&nbsp;Submitting and
1.1       grant    15002:               Committing</h2>
                   15003:             </div>
                   15004:           </div>
                   15005:         </div>
                   15006: 
                   15007:         <div class="toc">
                   15008:           <p><b>Table of Contents</b></p>
                   15009: 
                   15010:           <dl>
1.30      wiz      15011:             <dt><span class="sect1"><a href=
1.68      rillig   15012:             "#submitting-your-package">18.1. Submitting your
1.30      wiz      15013:             packages</a></span></dt>
1.1       grant    15014: 
1.30      wiz      15015:             <dt><span class="sect1"><a href=
1.68      rillig   15016:             "#general-notes-for-changes">18.2. General notes when
1.41      wiz      15017:             adding, updating, or removing packages</a></span></dt>
                   15018: 
                   15019:             <dt><span class="sect1"><a href=
1.68      rillig   15020:             "#committing-importing">18.3. Committing: Importing a
1.30      wiz      15021:             package into CVS</a></span></dt>
1.1       grant    15022: 
1.30      wiz      15023:             <dt><span class="sect1"><a href=
1.68      rillig   15024:             "#updating-package">18.4. Updating a package to a newer
1.30      wiz      15025:             version</a></span></dt>
1.1       grant    15026: 
1.68      rillig   15027:             <dt><span class="sect1"><a href="#moving-package">18.5.
1.2       hubertf  15028:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    15029:           </dl>
                   15030:         </div>
                   15031: 
1.67      hubertf  15032:         <div class="sect1" lang="en">
1.1       grant    15033:           <div class="titlepage">
                   15034:             <div>
                   15035:               <div>
                   15036:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15037:                 "submitting-your-package"></a>18.1.&nbsp;Submitting
1.30      wiz      15038:                 your packages</h2>
1.1       grant    15039:               </div>
                   15040:             </div>
                   15041:           </div>
                   15042: 
                   15043:           <p>You have to separate between binary and
                   15044:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   15045:           packages here:</p>
                   15046: 
                   15047:           <div class="itemizedlist">
                   15048:             <ul type="disc">
                   15049:               <li>
                   15050:                 <p>precompiled binary packages</p>
                   15051: 
                   15052:                 <p>Our policy is that we accept binaries only from
                   15053:                 pkgsrc developers to guarantee that the packages
                   15054:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  15055:                 annoy anyone but rather to protect our users!
1.1       grant    15056:                 You're still free to put up your home-made binary
1.13      hubertf  15057:                 packages and tell the world where to get them.
                   15058:                 NetBSD developers doing bulk builds and wanting to
                   15059:                 upload them please see <a href="#bulk-upload"
1.38      dillo    15060:                 title="6.3.8.&nbsp;Uploading results of a bulk build">
                   15061:                 Section&nbsp;6.3.8, &#8220;Uploading results of a
1.13      hubertf  15062:                 bulk build&#8221;</a>.</p>
1.1       grant    15063:               </li>
                   15064: 
                   15065:               <li>
                   15066:                 <p>packages</p>
                   15067: 
                   15068:                 <p>First, check that your package is complete,
                   15069:                 compiles and runs well; see <a href="#debug" title=
1.68      rillig   15070:                 "Chapter&nbsp;17.&nbsp;Debugging">Chapter&nbsp;17,
1.1       grant    15071:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      15072:                 Next, generate an uuencoded gzipped <a href=
                   15073:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   15074:                 <span class="citerefentry"><span class=
                   15075:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    15076:                 preferably with all files in a single directory.
1.14      xtraeme  15077:                 Finally, <span><strong class=
                   15078:                 "command">send-pr</strong></span> with category
1.1       grant    15079:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   15080:                 synopsis which includes the package name and
                   15081:                 version number, a short description of your package
                   15082:                 (contents of the COMMENT variable or DESCR file are
                   15083:                 OK) and attach the archive to your PR.</p>
                   15084: 
                   15085:                 <p>If you want to submit several packages, please
                   15086:                 send a separate PR for each one, it's easier for us
                   15087:                 to track things that way.</p>
                   15088: 
                   15089:                 <p>Alternatively, you can also import new packages
                   15090:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   15091:                 work-in-progress</span>&#8221;); see the homepage
                   15092:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   15093:                 target=
                   15094:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   15095:                 details.</p>
                   15096:               </li>
                   15097:             </ul>
                   15098:           </div>
                   15099:         </div>
                   15100: 
1.67      hubertf  15101:         <div class="sect1" lang="en">
1.1       grant    15102:           <div class="titlepage">
                   15103:             <div>
                   15104:               <div>
                   15105:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15106:                 "general-notes-for-changes"></a>18.2.&nbsp;General
1.41      wiz      15107:                 notes when adding, updating, or removing
                   15108:                 packages</h2>
                   15109:               </div>
                   15110:             </div>
                   15111:           </div>
                   15112: 
                   15113:           <p>Please note all package additions, updates, moves, and
1.45      wiz      15114:           removals in <code xmlns=
                   15115:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      15116:           "filename">pkgsrc/doc/CHANGES</code>. It's very important
                   15117:           to keep this file up to date and conforming to the
                   15118:           existing format, because it will be used by scripts to
                   15119:           automatically update pages on <a href=
                   15120:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
1.45      wiz      15121:           and other sites. Additionally, check the <code xmlns=
                   15122:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      15123:           "filename">pkgsrc/doc/TODO</code> file and remove the
                   15124:           entry for the package you updated or removed, in case it
                   15125:           was mentioned there.</p>
                   15126: 
1.71    ! wiz      15127:           <p>When the <code class="varname">PKGREVISION</code> of a
        !          15128:           package is bumped, the change should appear in
        !          15129:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          15130:           class="filename">pkgsrc/doc/CHANGES</code> if it is
        !          15131:           security related or otherwise relevant. Mass bumps that
        !          15132:           result from a dependency being updated should not be
        !          15133:           mentioned. In all other cases it's the developer's
        !          15134:           decision.</p>
        !          15135: 
1.41      wiz      15136:           <p>There is a make target that helps in creating proper
1.45      wiz      15137:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   15138:           class="filename">CHANGES</code> entries:
1.41      wiz      15139:           <span><strong class="command">make
                   15140:           changes-entry</strong></span>. It uses the optional
                   15141:           <code class="varname">CTYPE</code> and <code class=
                   15142:           "varname">NETBSD_LOGIN_NAME</code> variables. The general
1.45      wiz      15143:           usage is to first make sure that your <code xmlns=
                   15144:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      15145:           "filename">CHANGES</code> file is up-to-date (to avoid
                   15146:           having to resolve conflicts later-on) and then to
                   15147:           <span><strong class="command">cd</strong></span> to the
                   15148:           package directory. For package updates,
                   15149:           <span><strong class="command">make
                   15150:           changes-entry</strong></span> is enough. For new
                   15151:           packages, or package moves or removals, set the
                   15152:           <code class="varname">CTYPE</code> variable on the
                   15153:           command line to "Added", "Moved", or "Removed". You can
                   15154:           set <code class="varname">NETBSD_LOGIN_NAME</code> in
1.45      wiz      15155:           <code xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   15156:           class="filename">/etc/mk.conf</code> if your local login
                   15157:           name is not the same as your NetBSD login name. Don't
                   15158:           forget to commit the changes to <code xmlns=
                   15159:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.41      wiz      15160:           "filename">pkgsrc/doc/CHANGES</code>!</p>
                   15161:         </div>
                   15162: 
1.67      hubertf  15163:         <div class="sect1" lang="en">
1.41      wiz      15164:           <div class="titlepage">
                   15165:             <div>
                   15166:               <div>
                   15167:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15168:                 "committing-importing"></a>18.3.&nbsp;Committing:
1.30      wiz      15169:                 Importing a package into CVS</h2>
1.1       grant    15170:               </div>
                   15171:             </div>
                   15172:           </div>
                   15173: 
                   15174:           <p>This section is only of interest for pkgsrc developers
                   15175:           with write access to the pkgsrc repository. Please
                   15176:           remember that cvs imports files relative to the current
                   15177:           working directory, and that the pathname that you give
1.14      xtraeme  15178:           the <span><strong class="command">cvs
                   15179:           import</strong></span> command is so that it knows where
                   15180:           to place the files in the repository. Newly created
                   15181:           packages should be imported with a vendor tag of
                   15182:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   15183:           release tag of &#8220;<span class=
                   15184:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    15185:           <pre class="programlisting">
1.51      rillig   15186:     <code class="prompt">$</code> cd .../pkgsrc/category/pkgname
                   15187:     <code class=
                   15188: "prompt">$</code> cvs import pkgsrc/category/pkgname TNF pkgsrc-base
1.1       grant    15189: </pre>
                   15190: 
                   15191:           <p>Remember to move the directory from which you imported
                   15192:           out of the way, or cvs will complain the next time you
                   15193:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   15194:           source tree. Also don't forget to add the new package to
1.45      wiz      15195:           the category's <code xmlns=
                   15196:           "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15197:           "filename">Makefile</code>.</p>
1.1       grant    15198: 
                   15199:           <p>The commit message of the initial import should
1.45      wiz      15200:           include part of the <code xmlns=
                   15201:           "http://www.w3.org/TR/xhtml1/transitional" class=
                   15202:           "filename">DESCR</code> file, so people reading the
                   15203:           mailing lists know what the package is/does.</p>
1.1       grant    15204: 
                   15205:           <p>For new packages, &#8220;<span class="quote">cvs
                   15206:           import</span>&#8221; is preferred to &#8220;<span class=
                   15207:           "quote">cvs add</span>&#8221; because the former gets
                   15208:           everything with a single command, and provides a
                   15209:           consistent tag.</p>
                   15210:         </div>
                   15211: 
1.67      hubertf  15212:         <div class="sect1" lang="en">
1.1       grant    15213:           <div class="titlepage">
                   15214:             <div>
                   15215:               <div>
                   15216:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15217:                 "updating-package"></a>18.4.&nbsp;Updating a
1.30      wiz      15218:                 package to a newer version</h2>
1.1       grant    15219:               </div>
                   15220:             </div>
                   15221:           </div>
                   15222: 
                   15223:           <p>Please always put a concise, appropriate and relevant
                   15224:           summary of the changes between old and new versions into
                   15225:           the commit log when updating a package. There are various
                   15226:           reasons for this:</p>
                   15227: 
                   15228:           <div class="itemizedlist">
                   15229:             <ul type="disc">
                   15230:               <li>
                   15231:                 <p>A URL is volatile, and can change over time. It
                   15232:                 may go away completely or its information may be
                   15233:                 overwritten by newer information.</p>
                   15234:               </li>
                   15235: 
                   15236:               <li>
                   15237:                 <p>Having the change information between old and
                   15238:                 new versions in our CVS repository is very useful
                   15239:                 for people who use either cvs or anoncvs.</p>
                   15240:               </li>
                   15241: 
                   15242:               <li>
                   15243:                 <p>Having the change information between old and
                   15244:                 new versions in our CVS repository is very useful
                   15245:                 for people who read the pkgsrc-changes mailing
                   15246:                 list, so that they can make tactical decisions
                   15247:                 about when to upgrade the package.</p>
                   15248:               </li>
                   15249:             </ul>
                   15250:           </div>
                   15251: 
1.18      xtraeme  15252:           <p>Please also recognize that, just because a new version
1.1       grant    15253:           of a package has been released, it should not
                   15254:           automatically be upgraded in the CVS repository. We
                   15255:           prefer to be conservative in the packages that are
                   15256:           included in pkgsrc - development or beta packages are not
                   15257:           really the best thing for most places in which pkgsrc is
                   15258:           used. Please use your judgement about what should go into
                   15259:           pkgsrc, and bear in mind that stability is to be
                   15260:           preferred above new and possibly untested features.</p>
                   15261:         </div>
                   15262: 
1.67      hubertf  15263:         <div class="sect1" lang="en">
1.1       grant    15264:           <div class="titlepage">
                   15265:             <div>
                   15266:               <div>
                   15267:                 <h2 class="title" style="clear: both"><a name=
1.68      rillig   15268:                 "moving-package"></a>18.5.&nbsp;Moving a package in
1.30      wiz      15269:                 pkgsrc</h2>
1.1       grant    15270:               </div>
                   15271:             </div>
                   15272:           </div>
                   15273: 
                   15274:           <div class="orderedlist">
                   15275:             <ol type="1">
                   15276:               <li>
                   15277:                 <p>Make a copy of the directory somewhere else.</p>
                   15278:               </li>
                   15279: 
                   15280:               <li>
                   15281:                 <p>Remove all CVS dirs.</p>
                   15282: 
                   15283:                 <p>Alternatively to the first two steps you can
                   15284:                 also do:</p>
                   15285:                 <pre class="screen">
1.14      xtraeme  15286: <code class="prompt">%</code> <strong class=
                   15287: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    15288: </pre>
                   15289: 
                   15290:                 <p>and use that for further work.</p>
                   15291:               </li>
                   15292: 
                   15293:               <li>
1.14      xtraeme  15294:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   15295:                 any <code class="varname">DEPENDS</code> paths that
                   15296:                 just did &#8220;<span class=
1.1       grant    15297:                 "quote">../package</span>&#8221; instead of
                   15298:                 &#8220;<span class=
                   15299:                 "quote">../../category/package</span>&#8221;.</p>
                   15300:               </li>
                   15301: 
                   15302:               <li>
1.14      xtraeme  15303:                 <p><span><strong class="command">cvs
                   15304:                 import</strong></span> the modified package in the
                   15305:                 new place.</p>
1.1       grant    15306:               </li>
                   15307: 
                   15308:               <li>
                   15309:                 <p>Check if any package depends on it:</p>
                   15310:                 <pre class="screen">
1.14      xtraeme  15311: <code class="prompt">%</code> <strong class=
                   15312: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   15313: <code class="prompt">%</code> <strong class=
                   15314: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    15315: </pre>
                   15316:               </li>
                   15317: 
                   15318:               <li>
                   15319:                 <p>Fix paths in packages from step 5 to point to
                   15320:                 new location.</p>
                   15321:               </li>
                   15322: 
                   15323:               <li>
1.14      xtraeme  15324:                 <p><span><strong class="command">cvs rm
                   15325:                 (-f)</strong></span> the package at the old
                   15326:                 location.</p>
1.1       grant    15327:               </li>
                   15328: 
                   15329:               <li>
1.45      wiz      15330:                 <p>Remove from <code xmlns=
                   15331:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15332:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    15333:               </li>
                   15334: 
                   15335:               <li>
1.45      wiz      15336:                 <p>Add to <code xmlns=
                   15337:                 "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15338:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    15339:               </li>
                   15340: 
                   15341:               <li>
                   15342:                 <p>Commit the changed and removed files:</p>
                   15343:                 <pre class="screen">
1.14      xtraeme  15344: <code class="prompt">%</code> <strong class=
                   15345: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    15346: </pre>
                   15347: 
                   15348:                 <p>(and any packages from step 5, of course).</p>
                   15349:               </li>
                   15350:             </ol>
                   15351:           </div>
                   15352:         </div>
                   15353:       </div>
1.69      rillig   15354: 
                   15355:       <div class="chapter" lang="en">
                   15356:         <div class="titlepage">
                   15357:           <div>
                   15358:             <div>
                   15359:               <h2 class="title"><a name=
                   15360:               "porting"></a>Chapter&nbsp;19.&nbsp;Porting
                   15361:               pkgsrc</h2>
                   15362:             </div>
                   15363:           </div>
                   15364:         </div>
                   15365: 
                   15366:         <div class="toc">
                   15367:           <p><b>Table of Contents</b></p>
                   15368: 
                   15369:           <dl>
                   15370:             <dt><span class="sect1"><a href="#porting.opsys">19.1.
                   15371:             Porting pkgsrc to a new operating
                   15372:             system</a></span></dt>
                   15373: 
                   15374:             <dt><span class="sect1"><a href=
                   15375:             "#porting.compiler">19.2. Adding support for a new
                   15376:             compiler</a></span></dt>
                   15377:           </dl>
                   15378:         </div>
                   15379: 
                   15380:         <p>The pkgsrc system has already been ported to many
                   15381:         operating systems, hardware architectures and compilers.
                   15382:         This chapter explains the necessary steps to make pkgsrc
                   15383:         even more portable.</p>
                   15384: 
                   15385:         <div class="sect1" lang="en">
                   15386:           <div class="titlepage">
                   15387:             <div>
                   15388:               <div>
                   15389:                 <h2 class="title" style="clear: both"><a name=
                   15390:                 "porting.opsys"></a>19.1.&nbsp;Porting pkgsrc to a
                   15391:                 new operating system</h2>
                   15392:               </div>
                   15393:             </div>
                   15394:           </div>
                   15395: 
                   15396:           <p>To port pkgsrc to a new operating system (called
                   15397:           <code class="literal">MyOS</code> in this example), you
                   15398:           need to touch the following files:</p>
                   15399: 
                   15400:           <div class="variablelist">
                   15401:             <dl>
                   15402:               <dt><span class="term"><code xmlns=
                   15403:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15404:               "filename">bootstrap/mods/mk/<em class=
                   15405:               "replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
                   15406: 
                   15407:               <dd>
                   15408:                 <p>This file contains some basic definitions, for
                   15409:                 example the name of the C compiler.</p>
                   15410:               </dd>
                   15411: 
                   15412:               <dt><span class="term"><code xmlns=
                   15413:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15414:               "filename">mk/bsd.prefs.mk</code></span></dt>
                   15415: 
                   15416:               <dd>
                   15417:                 <p>Insert code that defines the variables
                   15418:                 <code class="varname">OPSYS</code>, <code class=
                   15419:                 "varname">OS_VERSION</code>, <code class=
                   15420:                 "varname">LOWER_OS_VERSION</code>, <code class=
                   15421:                 "varname">LOWER_VENDOR</code>, <code class=
                   15422:                 "varname">MACHINE_ARCH</code>, <code class=
                   15423:                 "varname">OBJECT_FMT</code>, <code class=
                   15424:                 "varname">APPEND_ELF</code>, and the other
                   15425:                 variables that appear in this file.</p>
                   15426:               </dd>
                   15427: 
                   15428:               <dt><span class="term"><code xmlns=
                   15429:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15430:               "filename">mk/platform/MyOS.mk</code></span></dt>
                   15431: 
                   15432:               <dd>
                   15433:                 <p>This file contains the platform-specific
                   15434:                 definitions that are used by pkgsrc. Start by
                   15435:                 copying one of the other files and edit it to your
                   15436:                 needs.</p>
                   15437:               </dd>
                   15438: 
                   15439:               <dt><span class="term"><code xmlns=
                   15440:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15441:               "filename">mk/platform/MyOS.pkg.dist</code></span></dt>
                   15442: 
                   15443:               <dd>
                   15444:                 <p>This file contains a list of directories,
                   15445:                 together with their permission bits and ownership.
                   15446:                 These directories will be created automatically
                   15447:                 with every package that does not explicitly set
                   15448:                 <code class="varname">NO_MTREE</code>. There have
                   15449:                 been some discussions about whether this file is
                   15450:                 needed at all, but with no result.</p>
                   15451:               </dd>
                   15452: 
                   15453:               <dt><span class="term"><code xmlns=
                   15454:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15455:               "filename">mk/platform/MyOS.x11.dist</code></span></dt>
                   15456: 
                   15457:               <dd>
                   15458:                 <p>Just copy one of the pre-existing x11.dist files
                   15459:                 to your <code xmlns=
                   15460:                 "http://www.w3.org/TR/xhtml1/transitional" class=
                   15461:                 "filename"><em class=
                   15462:                 "replaceable"><code>MyOS</code></em>.x11.dist</code>.</p>
                   15463:               </dd>
                   15464: 
                   15465:               <dt><span class="term"><code xmlns=
                   15466:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15467:               "filename">mk/tools/bootstrap.mk</code></span></dt>
                   15468: 
                   15469:               <dd>
                   15470:                 <p>On some operating systems, the tools that are
                   15471:                 provided with the base system are not good enough
                   15472:                 for pkgsrc. For example, there are many versions of
                   15473:                 <a href=
                   15474:                 "http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-current">
                   15475:                 <span class="citerefentry"><span class=
                   15476:                 "refentrytitle">sed</span>(1)</span></a> that have
                   15477:                 a narrow limit on the line length they can process.
                   15478:                 Therefore pkgsrc brings its own tools, which can be
                   15479:                 enabled here.</p>
                   15480:               </dd>
                   15481: 
                   15482:               <dt><span class="term"><code xmlns=
                   15483:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   15484:               "filename">mk/tools/<em class=
                   15485:               "replaceable"><code>MyOS</code></em>.mk</code></span></dt>
                   15486: 
                   15487:               <dd>
                   15488:                 <p>This file defines the paths to all the tools
                   15489:                 that are needed by one or the other package in
                   15490:                 pkgsrc, as well as by pkgsrc itself. Find out where
                   15491:                 these tools are on your platform and add them.</p>
                   15492:               </dd>
                   15493:             </dl>
                   15494:           </div>
                   15495: 
                   15496:           <p>Now, you should be able to build some basic packages,
                   15497:           like <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   15498:           href=
                   15499:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/perl5/README.html"
                   15500:           target="_top"><code xmlns="" class=
                   15501:           "filename">lang/perl5</code></a>, <a xmlns=
                   15502:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   15503:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/shells/bash/README.html"
                   15504:           target="_top"><code xmlns="" class=
                   15505:           "filename">shells/bash</code></a>.</p>
                   15506:         </div>
                   15507: 
                   15508:         <div class="sect1" lang="en">
                   15509:           <div class="titlepage">
                   15510:             <div>
                   15511:               <div>
                   15512:                 <h2 class="title" style="clear: both"><a name=
                   15513:                 "porting.compiler"></a>19.2.&nbsp;Adding support
                   15514:                 for a new compiler</h2>
                   15515:               </div>
                   15516:             </div>
                   15517:           </div>
                   15518: 
                   15519:           <p>TODO</p>
                   15520:         </div>
                   15521:       </div>
1.1       grant    15522:     </div>
                   15523: 
1.67      hubertf  15524:     <div class="appendix" lang="en">
1.1       grant    15525:       <div class="titlepage">
                   15526:         <div>
                   15527:           <div>
1.67      hubertf  15528:             <h2 class="title"><a name=
1.46      gdt      15529:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
1.1       grant    15530:             package: bison</h2>
                   15531:           </div>
                   15532:         </div>
                   15533:       </div>
                   15534: 
                   15535:       <div class="toc">
                   15536:         <p><b>Table of Contents</b></p>
                   15537: 
                   15538:         <dl>
1.46      gdt      15539:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    15540:           files</a></span></dt>
                   15541: 
                   15542:           <dd>
                   15543:             <dl>
1.30      wiz      15544:               <dt><span class="sect2"><a href=
1.46      gdt      15545:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    15546: 
1.30      wiz      15547:               <dt><span class="sect2"><a href=
1.46      gdt      15548:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    15549: 
1.30      wiz      15550:               <dt><span class="sect2"><a href=
1.46      gdt      15551:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    15552: 
1.30      wiz      15553:               <dt><span class="sect2"><a href=
1.46      gdt      15554:               "#checking-package-with-pkglint">A.1.4. Checking a
1.30      wiz      15555:               package with <span><strong class=
1.14      xtraeme  15556:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    15557:             </dl>
                   15558:           </dd>
                   15559: 
1.46      gdt      15560:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
1.30      wiz      15561:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    15562:         </dl>
                   15563:       </div>
                   15564: 
                   15565:       <p>We checked to find a piece of software that wasn't in the
                   15566:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  15567:       would want to have <span><strong class=
                   15568:       "command">bison</strong></span> when Berkeley
                   15569:       <span><strong class="command">yacc</strong></span> is already
                   15570:       present in the tree is beyond us, but it's useful for the
                   15571:       purposes of this exercise.</p>
1.1       grant    15572: 
1.67      hubertf  15573:       <div class="sect1" lang="en">
1.1       grant    15574:         <div class="titlepage">
                   15575:           <div>
                   15576:             <div>
                   15577:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15578:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    15579:             </div>
                   15580:           </div>
                   15581:         </div>
                   15582: 
1.67      hubertf  15583:         <div class="sect2" lang="en">
1.1       grant    15584:           <div class="titlepage">
                   15585:             <div>
                   15586:               <div>
1.67      hubertf  15587:                 <h3 class="title"><a name=
1.46      gdt      15588:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    15589:               </div>
                   15590:             </div>
                   15591:           </div>
                   15592:           <pre class="programlisting">
1.51      rillig   15593:     # $NetBSD$
                   15594:     #
1.1       grant    15595: 
1.51      rillig   15596:     DISTNAME=       bison-1.25
                   15597:     CATEGORIES=     devel
                   15598:     MASTER_SITES=   ${MASTER_SITE_GNU}
1.1       grant    15599: 
1.51      rillig   15600:     MAINTAINER=     thorpej@NetBSD.org
                   15601:     HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   15602:     COMMENT=        GNU yacc clone
1.1       grant    15603: 
1.51      rillig   15604:     GNU_CONFIGURE=  yes
                   15605:     INFO_FILES=     bison.info
1.1       grant    15606: 
1.51      rillig   15607:     .include "../../mk/bsd.pkg.mk"
1.1       grant    15608: </pre>
                   15609:         </div>
                   15610: 
1.67      hubertf  15611:         <div class="sect2" lang="en">
1.1       grant    15612:           <div class="titlepage">
                   15613:             <div>
                   15614:               <div>
1.67      hubertf  15615:                 <h3 class="title"><a name=
1.46      gdt      15616:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    15617:               </div>
                   15618:             </div>
                   15619:           </div>
                   15620:           <pre class="programlisting">
1.51      rillig   15621:     GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   15622:     improvements.  Why you would want this when Berkeley <a href=
1.1       grant    15623: "http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-current"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.51      rillig   15624:     of the NetBSD source tree is beyond me.
1.1       grant    15625: </pre>
                   15626:         </div>
                   15627: 
1.67      hubertf  15628:         <div class="sect2" lang="en">
1.1       grant    15629:           <div class="titlepage">
                   15630:             <div>
                   15631:               <div>
1.67      hubertf  15632:                 <h3 class="title"><a name=
1.46      gdt      15633:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    15634:               </div>
                   15635:             </div>
                   15636:           </div>
                   15637:           <pre class="programlisting">
1.51      rillig   15638:     @comment $NetBSD$
                   15639:     bin/bison
                   15640:     man/man1/bison.1.gz
                   15641:     share/bison.simple
                   15642:     share/bison.hairy
1.1       grant    15643: </pre>
                   15644:         </div>
                   15645: 
1.67      hubertf  15646:         <div class="sect2" lang="en">
1.1       grant    15647:           <div class="titlepage">
                   15648:             <div>
                   15649:               <div>
1.30      wiz      15650:                 <h3 class="title"><a name=
1.46      gdt      15651:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
1.30      wiz      15652:                 a package with <span><strong class=
1.14      xtraeme  15653:                 "command">pkglint</strong></span></h3>
1.1       grant    15654:               </div>
                   15655:             </div>
                   15656:           </div>
                   15657: 
                   15658:           <p>The NetBSD package system comes with <a xmlns=
                   15659:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   15660:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.45      wiz      15661:           target="_top"><code xmlns="" class=
                   15662:           "filename">pkgtools/pkglint</code></a> which helps to
                   15663:           check the contents of these files. After installation it
                   15664:           is quite easy to use, just change to the directory of the
1.20      ben      15665:           package you wish to examine and execute
                   15666:           <span><strong class=
                   15667:           "command">pkglint</strong></span>:</p>
1.1       grant    15668:           <pre class="screen">
1.14      xtraeme  15669: <code class="prompt">$</code> <strong class=
                   15670: "userinput"><code>pkglint</code></strong>
1.1       grant    15671: looks fine.
                   15672: </pre>
                   15673: 
                   15674:           <p>Depending on the supplied command line arguments (see
1.60      rillig   15675:           pkglint(1)), more checks will be performed. Use e.g.
                   15676:           <span><strong class="command">pkglint -Call
                   15677:           -Wall</strong></span> for a very thorough check.</p>
1.1       grant    15678:         </div>
                   15679:       </div>
                   15680: 
1.67      hubertf  15681:       <div class="sect1" lang="en">
1.1       grant    15682:         <div class="titlepage">
                   15683:           <div>
                   15684:             <div>
                   15685:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15686:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
1.30      wiz      15687:               installing, packaging</h2>
1.1       grant    15688:             </div>
                   15689:           </div>
                   15690:         </div>
                   15691: 
                   15692:         <p>Create the directory where the package lives, plus any
                   15693:         auxiliary directories:</p>
                   15694:         <pre class="screen">
1.14      xtraeme  15695: <code class="prompt">#</code> <strong class=
                   15696: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   15697: <code class="prompt">#</code> <strong class=
                   15698: "userinput"><code>mkdir bison</code></strong>
                   15699: <code class="prompt">#</code> <strong class=
                   15700: "userinput"><code>cd bison</code></strong>
                   15701: <code class="prompt">#</code> <strong class=
                   15702: "userinput"><code>mkdir patches</code></strong>
1.1       grant    15703: </pre>
                   15704: 
1.45      wiz      15705:         <p>Create <code xmlns=
                   15706:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15707:         "filename">Makefile</code>, <code xmlns=
                   15708:         "http://www.w3.org/TR/xhtml1/transitional" class=
                   15709:         "filename">DESCR</code> and <code xmlns=
                   15710:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15711:         "filename">PLIST</code> (see <a href="#components" title=
1.38      dillo    15712:         "Chapter&nbsp;8.&nbsp;Package components - files, directories and contents">
1.67      hubertf  15713:         Chapter&nbsp;8, <i>Package components - files, directories
                   15714:         and contents</i></a>) then continue with fetching the
1.1       grant    15715:         distfile:</p>
                   15716:         <pre class="screen">
1.14      xtraeme  15717: <code class="prompt">#</code> <strong class=
                   15718: "userinput"><code>make fetch</code></strong>
1.1       grant    15719: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   15720: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   15721: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15722: ftp: Error retrieving file: 500 Internal error
                   15723: 
                   15724: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   15725: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15726: ftp: Error retrieving file: 500 Internal error
                   15727: 
                   15728: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   15729: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   15730: Successfully retrieved file.
                   15731: </pre>
                   15732: 
1.45      wiz      15733:         <p>Generate the checksum of the distfile into <code xmlns=
                   15734:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  15735:         "filename">distinfo</code>:</p>
1.1       grant    15736:         <pre class="screen">
1.14      xtraeme  15737: <code class="prompt">#</code> <strong class=
                   15738: "userinput"><code>make makesum</code></strong>
1.1       grant    15739: </pre>
                   15740: 
                   15741:         <p>Now compile:</p>
                   15742:         <pre class="screen">
1.14      xtraeme  15743: <code class="prompt">#</code> <strong class=
                   15744: "userinput"><code>make</code></strong>
1.1       grant    15745: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15746: ===&gt;  Extracting for bison-1.25
                   15747: ===&gt;  Patching for bison-1.25
                   15748: ===&gt;   Ignoring empty patch directory
                   15749: ===&gt;  Configuring for bison-1.25
                   15750: creating cache ./config.cache
                   15751: checking for gcc... cc
                   15752: checking whether we are using GNU C... yes
                   15753: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   15754: checking how to run the C preprocessor... cc -E
                   15755: checking for minix/config.h... no
                   15756: checking for POSIXized ISC... no
                   15757: checking whether cross-compiling... no
                   15758: checking for ANSI C header files... yes
                   15759: checking for string.h... yes
                   15760: checking for stdlib.h... yes
                   15761: checking for memory.h... yes
                   15762: checking for working const... yes
                   15763: checking for working alloca.h... no
                   15764: checking for alloca... yes
                   15765: checking for strerror... yes
                   15766: updating cache ./config.cache
                   15767: creating ./config.status
                   15768: creating Makefile
                   15769: ===&gt;  Building for bison-1.25
                   15770: 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
                   15771: 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
                   15772: 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
                   15773: 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
                   15774: 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
1.68      rillig   15775: 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
1.1       grant    15776: 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
                   15777: 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
                   15778: 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
                   15779: 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
                   15780: 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
                   15781: 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
                   15782: 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
                   15783: 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
                   15784: 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
                   15785: 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
                   15786: 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
                   15787: 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
                   15788: 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
                   15789: 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
                   15790: 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
                   15791: 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
                   15792: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   15793: rm -f bison.s1
                   15794: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   15795: </pre>
                   15796: 
                   15797:         <p>Everything seems OK, so install the files:</p>
                   15798:         <pre class="screen">
1.14      xtraeme  15799: <code class="prompt">#</code> <strong class=
                   15800: "userinput"><code>make install</code></strong>
1.1       grant    15801: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15802: ===&gt;  Installing for bison-1.25
                   15803: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   15804: rm -f /usr/pkg/bin/bison
                   15805: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   15806: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   15807: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   15808: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   15809: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   15810: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   15811: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   15812: ===&gt;  Registering installation for bison-1.25
                   15813: </pre>
                   15814: 
                   15815:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  15816:         remove it with <span><strong class="command">pkg_delete
                   15817:         bison</strong></span>. Should you decide that you want a
                   15818:         binary package, do this now:</p>
1.1       grant    15819:         <pre class="screen">
1.14      xtraeme  15820: <code class="prompt">#</code> <strong class=
                   15821: "userinput"><code>make package</code></strong>
1.1       grant    15822: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   15823: ===&gt;  Building package for bison-1.25
                   15824: Creating package bison-1.25.tgz
                   15825: Registering depends:.
                   15826: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   15827: </pre>
                   15828: 
                   15829:         <p>Now that you don't need the source and object files any
                   15830:         more, clean up:</p>
                   15831:         <pre class="screen">
1.14      xtraeme  15832: <code class="prompt">#</code> <strong class=
                   15833: "userinput"><code>make clean</code></strong>
1.1       grant    15834: ===&gt;  Cleaning for bison-1.25
                   15835: </pre>
                   15836:       </div>
                   15837:     </div>
                   15838: 
1.67      hubertf  15839:     <div class="appendix" lang="en">
1.1       grant    15840:       <div class="titlepage">
                   15841:         <div>
                   15842:           <div>
1.67      hubertf  15843:             <h2 class="title"><a name=
1.46      gdt      15844:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
1.1       grant    15845:           </div>
                   15846:         </div>
                   15847:       </div>
                   15848: 
                   15849:       <div class="toc">
                   15850:         <p><b>Table of Contents</b></p>
                   15851: 
                   15852:         <dl>
1.46      gdt      15853:           <dt><span class="sect1"><a href="#logs.building">B.1.
1.1       grant    15854:           Building figlet</a></span></dt>
                   15855: 
1.46      gdt      15856:           <dt><span class="sect1"><a href="#logs.package">B.2.
1.1       grant    15857:           Packaging figlet</a></span></dt>
                   15858:         </dl>
                   15859:       </div>
                   15860: 
1.67      hubertf  15861:       <div class="sect1" lang="en">
1.1       grant    15862:         <div class="titlepage">
                   15863:           <div>
                   15864:             <div>
                   15865:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15866:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
1.1       grant    15867:             </div>
                   15868:           </div>
                   15869:         </div>
                   15870:         <pre class="screen">
1.14      xtraeme  15871: <code class="prompt">#</code> <strong class=
                   15872: "userinput"><code>make</code></strong>
1.1       grant    15873: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15874: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   15875: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   15876: =&gt; [172219 bytes]
                   15877: Connected to ftp.plig.net.
                   15878: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   15879: 331 Guest login ok, send your complete e-mail address as password.
                   15880: 230-You are user #5 of 500 simultaneous users allowed.
                   15881: 230-
1.68      rillig   15882: 230-  ___ _             _ _
                   15883: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___
1.1       grant    15884: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   15885: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   15886: 230-         |_|   |_|     |___|         |___|
                   15887: 230-
                   15888: 230-** Welcome to ftp.plig.org **
                   15889: 230-
                   15890: 230-Please note that all transfers from this FTP site are logged. If you
                   15891: 230-do not like this, please disconnect now.
                   15892: 230-
                   15893: 230-This arhive is available via
                   15894: 230-
                   15895: 230-HTTP:  http://ftp.plig.org/
                   15896: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   15897: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   15898: 230-
                   15899: 230-Please email comments, bug reports and requests for packages to be
1.68      rillig   15900: 230-mirrored to ftp-admin@plig.org.
1.1       grant    15901: 230-
                   15902: 230-
                   15903: 230 Logged in anonymously.
                   15904: Remote system type is UNIX.
                   15905: Using binary mode to transfer files.
                   15906: 200 Type okay.
                   15907: 250 "/pub" is new cwd.
                   15908: 250-"/pub/figlet" is new cwd.
                   15909: 250-
                   15910: 250-Welcome to the figlet archive at ftp.figlet.org
1.68      rillig   15911: 250-
1.1       grant    15912: 250-    ftp://ftp.figlet.org/pub/figlet/
                   15913: 250-
                   15914: 250-The official FIGlet web page is:
                   15915: 250-    http://www.figlet.org/
                   15916: 250-
                   15917: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   15918: 250-contribute a font or something else, you can email us.
1.68      rillig   15919: 250
1.1       grant    15920: 250 "/pub/figlet/program" is new cwd.
                   15921: 250 "/pub/figlet/program/unix" is new cwd.
                   15922: local: figlet221.tar.gz remote: figlet221.tar.gz
                   15923: 502 Unimplemented command.
                   15924: 227 Entering Passive Mode (195,40,6,41,246,104)
                   15925: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   15926: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   15927: 226 Transfer completed.
                   15928: 172219 bytes received in 00:02 (75.99 KB/s)
                   15929: 221 Goodbye.
                   15930: =&gt; Checksum OK for figlet221.tar.gz.
                   15931: ===&gt; Extracting for figlet-2.2.1nb2
                   15932: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   15933: ===&gt; Patching for figlet-2.2.1nb2
                   15934: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   15935: ===&gt; Overriding tools for figlet-2.2.1nb2
                   15936: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   15937: ===&gt; Configuring for figlet-2.2.1nb2
                   15938: ===&gt; Building for figlet-2.2.1nb2
                   15939: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   15940: chmod a+x figlet
                   15941: gcc -O2 -o chkfont chkfont.c
                   15942: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  15943: <code class="prompt">#</code>
                   15944: <code class="prompt">#</code> <strong class=
                   15945: "userinput"><code>make install</code></strong>
1.1       grant    15946: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15947: ===&gt; Installing for figlet-2.2.1nb2
                   15948: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   15949: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   15950: mkdir -p /usr/pkg/share/figlet
                   15951: cp figlet /usr/pkg/bin
                   15952: cp chkfont /usr/pkg/bin
                   15953: chmod 555 figlist showfigfonts
                   15954: cp figlist /usr/pkg/bin
                   15955: cp showfigfonts /usr/pkg/bin
                   15956: cp fonts/*.flf /usr/pkg/share/figlet
                   15957: cp fonts/*.flc /usr/pkg/share/figlet
                   15958: cp figlet.6 /usr/pkg/man/man6
                   15959: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  15960: <code class="prompt">#</code>
1.1       grant    15961: </pre>
                   15962:       </div>
                   15963: 
1.67      hubertf  15964:       <div class="sect1" lang="en">
1.1       grant    15965:         <div class="titlepage">
                   15966:           <div>
                   15967:             <div>
                   15968:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      15969:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
1.1       grant    15970:             </div>
                   15971:           </div>
                   15972:         </div>
                   15973:         <pre class="screen">
1.14      xtraeme  15974: <code class="prompt">#</code> <strong class=
                   15975: "userinput"><code>make package</code></strong>
1.1       grant    15976: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   15977: ===&gt; Packaging figlet-2.2.1nb2
                   15978: ===&gt; Building binary package for figlet-2.2.1nb2
                   15979: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   15980: Using SrcDir value of /usr/pkg
1.68      rillig   15981: Registering depends:.
1.14      xtraeme  15982: <code class="prompt">#</code>
1.1       grant    15983: </pre>
                   15984:       </div>
                   15985:     </div>
                   15986: 
1.67      hubertf  15987:     <div class="appendix" lang="en">
1.1       grant    15988:       <div class="titlepage">
                   15989:         <div>
                   15990:           <div>
1.67      hubertf  15991:             <h2 class="title"><a name=
1.46      gdt      15992:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
1.1       grant    15993:             FTP server's package archive</h2>
                   15994:           </div>
                   15995:         </div>
                   15996:       </div>
                   15997: 
                   15998:       <p>Layout for precompiled binary packages on
                   15999:       ftp.NetBSD.org:</p>
                   16000:       <pre class="programlisting">
1.51      rillig   16001:     /pub/NetBSD/packages/
                   16002:         distfiles/
1.1       grant    16003: 
1.51      rillig   16004:         # Unpacked pkgsrc trees
                   16005:         pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   16006:         pkgsrc-2003Q4 -&gt; N/A
                   16007:         pkgsrc-2004Q1/pkgsrc
                   16008: 
                   16009:         # pkgsrc archives
                   16010:         pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   16011:         pkgsrc-2003Q4.tar.gz -&gt; N/A
                   16012:         pkgsrc-2004Q1.tar.gz -&gt; N/A
                   16013: 
                   16014:         # Per pkgsrc-release/OS-release/arch package archives
                   16015:         pkgsrc-2003Q4/
                   16016:             NetBSD-1.6.2/
                   16017:                 i386/
                   16018:                     All/
                   16019:                     archivers/
                   16020:                         foo -&gt; ../All/foo
                   16021:                     ...
                   16022:         pkgsrc-2004Q1/
                   16023:             NetBSD-1.6.2/
                   16024:                 i386/
                   16025:                     All/
                   16026:                     ...
                   16027:             NetBSD-2.0/
                   16028:                 i386/
                   16029:                     All/
                   16030:                     ...
                   16031:             SunOS-5.9/
                   16032:                 sparc/
                   16033:                     All/
                   16034:                     ...
                   16035:                 x86/
                   16036:                     All/
                   16037:                     ...
                   16038: 
                   16039:         # Per os-release package archive convenience links
                   16040:         NetBSD-1.6.2 -&gt; 1.6.2
                   16041:         1.6.2/
                   16042:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   16043:             m68k/
                   16044:                 All/
                   16045:                 archivers/
                   16046:                     foo -&gt; ../All/foo
                   16047:                 ...
                   16048:             amiga -&gt; m68k
                   16049:             atari -&gt; m68k
                   16050:             ...
                   16051: 
                   16052:         2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   16053:         NetBSD-2.0/
                   16054:             i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   16055:         SunOS-5.9/
                   16056:             sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   16057:             x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
1.1       grant    16058: </pre>
                   16059: 
                   16060:       <p>To create:</p>
                   16061: 
                   16062:       <div class="orderedlist">
                   16063:         <ol type="1">
                   16064:           <li>
                   16065:             <p>Run bulk build, see <a href="#bulkbuild" title=
1.67      hubertf  16066:             "6.3.&nbsp;Doing a bulk build of all packages">Section&nbsp;6.3,
                   16067:             &#8220;Doing a bulk build of all
1.1       grant    16068:             packages&#8221;</a></p>
                   16069:           </li>
                   16070: 
                   16071:           <li>
                   16072:             <p>Upload /usr/pkgsrc/packages to</p>
                   16073:             <pre class="programlisting">
                   16074:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.51      rillig   16075:         pkgsrc-2004Q4/\             # pkgsrc-branch
                   16076:         `uname -s`-`uname -r`/\     # OS &amp; version
                   16077:         `uname -p`                  # architecture
1.1       grant    16078: </pre>
                   16079:           </li>
                   16080: 
                   16081:           <li>
1.14      xtraeme  16082:             <p>If necessary, create a symlink <span><strong class=
                   16083:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   16084:             (amiga -&gt; m68k, ...)</p>
1.1       grant    16085:           </li>
                   16086:         </ol>
                   16087:       </div>
                   16088:     </div>
1.2       hubertf  16089: 
1.67      hubertf  16090:     <div class="appendix" lang="en">
1.2       hubertf  16091:       <div class="titlepage">
                   16092:         <div>
                   16093:           <div>
1.67      hubertf  16094:             <h2 class="title"><a name=
1.46      gdt      16095:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
1.2       hubertf  16096:             for the pkgsrc guide</h2>
                   16097:           </div>
                   16098:         </div>
                   16099:       </div>
                   16100: 
                   16101:       <div class="toc">
                   16102:         <p><b>Table of Contents</b></p>
                   16103: 
                   16104:         <dl>
1.46      gdt      16105:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  16106:           Targets</a></span></dt>
                   16107: 
1.46      gdt      16108:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  16109:           Procedure</a></span></dt>
                   16110:         </dl>
                   16111:       </div>
                   16112: 
                   16113:       <p>This section contains information on editing the pkgsrc
                   16114:       guide itself.</p>
                   16115: 
1.67      hubertf  16116:       <div class="sect1" lang="en">
1.2       hubertf  16117:         <div class="titlepage">
                   16118:           <div>
                   16119:             <div>
                   16120:               <h2 class="title" style="clear: both"><a name=
1.67      hubertf  16121:               "targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  16122:             </div>
                   16123:           </div>
                   16124:         </div>
                   16125: 
1.45      wiz      16126:         <p>The pkgsrc guide's source code is stored in <code xmlns=
                   16127:         "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16128:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  16129:         are created from it:</p>
                   16130: 
                   16131:         <div class="itemizedlist">
                   16132:           <ul type="disc">
                   16133:             <li>
1.45      wiz      16134:               <p><code xmlns=
                   16135:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.23      wiz      16136:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  16137:             </li>
                   16138: 
                   16139:             <li>
1.45      wiz      16140:               <p><code xmlns=
                   16141:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16142:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  16143:             </li>
                   16144: 
                   16145:             <li>
1.45      wiz      16146:               <p><code xmlns=
                   16147:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16148:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  16149:               the documentation on the NetBSD website will be built
                   16150:               from pkgsrc and kept up to date on the web server
                   16151:               itself. This means you <span class=
                   16152:               "emphasis"><em>must</em></span> make sure that your
                   16153:               changes haven't broken the build!</p>
                   16154:             </li>
1.6       hubertf  16155: 
                   16156:             <li>
1.45      wiz      16157:               <p><code xmlns=
                   16158:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16159:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  16160:               PDF version of the pkgsrc guide.</p>
                   16161:             </li>
                   16162: 
                   16163:             <li>
1.45      wiz      16164:               <p><code xmlns=
                   16165:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16166:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  16167:               PostScript version of the pkgsrc guide.</p>
                   16168:             </li>
1.2       hubertf  16169:           </ul>
                   16170:         </div>
                   16171:       </div>
                   16172: 
1.67      hubertf  16173:       <div class="sect1" lang="en">
1.2       hubertf  16174:         <div class="titlepage">
                   16175:           <div>
                   16176:             <div>
                   16177:               <h2 class="title" style="clear: both"><a name=
1.46      gdt      16178:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  16179:             </div>
                   16180:           </div>
                   16181:         </div>
                   16182: 
                   16183:         <p>The procedure to edit the pkgsrc guide is:</p>
                   16184: 
                   16185:         <div class="itemizedlist">
                   16186:           <ul type="disc">
                   16187:             <li>
1.6       hubertf  16188:               <p>Make sure you have the packages needed to
                   16189:               re-generate the pkgsrc guide (and other XML-based
                   16190:               NetBSD documentation) installed. These are
1.11      ben      16191:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.47      reed     16192:               for creating the ASCII and HTML versions, and
1.6       hubertf  16193:               &#8220;<span class=
1.47      reed     16194:               "quote">netbsd-doc-print</span>&#8221; for the
                   16195:               PostScript and PDF versions. You will need both
1.6       hubertf  16196:               packages installed, to make sure documentation is
                   16197:               consistent across all formats. The packages can be
1.45      wiz      16198:               found in <code xmlns=
                   16199:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16200:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
1.45      wiz      16201:               <code xmlns=
                   16202:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16203:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  16204:             </li>
                   16205: 
                   16206:             <li>
1.45      wiz      16207:               <p>Edit the XML file(s) in <code xmlns=
                   16208:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16209:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  16210:             </li>
                   16211: 
                   16212:             <li>
1.14      xtraeme  16213:               <p>Run <span><strong class="command">make extract
                   16214:               &amp;&amp; make do-lint</strong></span> in
1.45      wiz      16215:               <code xmlns=
                   16216:               "http://www.w3.org/TR/xhtml1/transitional" class=
                   16217:               "filename">pkgsrc/doc/guide</code> to check the XML
                   16218:               syntax, and fix it if needed.</p>
1.4       hubertf  16219:             </li>
                   16220: 
                   16221:             <li>
1.14      xtraeme  16222:               <p>Run <span><strong class=
1.45      wiz      16223:               "command">make</strong></span> in <code xmlns=
                   16224:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16225:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   16226:               and ASCII version.</p>
1.2       hubertf  16227:             </li>
                   16228: 
                   16229:             <li>
1.14      xtraeme  16230:               <p>If all is well, run <span><strong class=
                   16231:               "command">make install-doc</strong></span> to put the
1.45      wiz      16232:               generated files into <code xmlns=
                   16233:               "http://www.w3.org/TR/xhtml1/transitional" class=
1.14      xtraeme  16234:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  16235:             </li>
                   16236: 
                   16237:             <li>
1.14      xtraeme  16238:               <p><span><strong class="command">cvs commit
                   16239:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  16240:             </li>
                   16241: 
                   16242:             <li>
1.14      xtraeme  16243:               <p><span><strong class="command">cvs commit -m
                   16244:               re-generate
                   16245:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  16246:             </li>
1.4       hubertf  16247: 
                   16248:             <li>
                   16249:               <p>Until the webserver on www.NetBSD.org is really
                   16250:               updated automatically to pick up changes to the
1.14      xtraeme  16251:               pkgsrc guide automatically, also run
1.18      xtraeme  16252:               <span><strong class="command">make install-htdocs
1.14      xtraeme  16253:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   16254:               similar, adjust <code class=
                   16255:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  16256:             </li>
                   16257: 
                   16258:             <li>
1.14      xtraeme  16259:               <p><span><strong class="command">cvs commit
                   16260:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  16261:             </li>
1.2       hubertf  16262:           </ul>
                   16263:         </div>
                   16264:       </div>
                   16265:     </div>
1.1       grant    16266:   </div>
                   16267: </body>
                   16268: </html>

CVSweb <webmaster@jp.NetBSD.org>