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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.20      ben         4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.30    ! wiz        22:           <h1 class="title"><a name="the-pkgsrc-guide" id=
        !            23:           "the-pkgsrc-guide"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
                     64:           <p class="copyright">Copyright &#169; 1994-2004 The
                     65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.30    ! wiz        69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.7
        !            70:           2005/05/24 12:39:00 wiz Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
                     91:         <dt><span class="chapter"><a href="#introduction">1.
                     92:         Introduction</a></span></dt>
                     93: 
                     94:         <dd>
                     95:           <dl>
1.30    ! wiz        96:             <dt><span class="sect1"><a href=
        !            97:             "#introduction-section">1.1.
1.1       grant      98:             Introduction</a></span></dt>
                     99: 
                    100:             <dt><span class="sect1"><a href="#overview">1.2.
                    101:             Overview</a></span></dt>
                    102: 
                    103:             <dt><span class="sect1"><a href="#terminology">1.3.
                    104:             Terminology</a></span></dt>
                    105: 
                    106:             <dt><span class="sect1"><a href="#typography">1.4.
                    107:             Typography</a></span></dt>
                    108:           </dl>
                    109:         </dd>
                    110: 
1.2       hubertf   111:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     112:         user's guide</a></span></dt>
                    113: 
                    114:         <dd>
                    115:           <dl>
                    116:             <dt><span class="chapter"><a href="#getting">2. Where
                    117:             to get pkgsrc</a></span></dt>
                    118: 
                    119:             <dd>
                    120:               <dl>
1.30    ! wiz       121:                 <dt><span class="sect1"><a href="#as-tar-file">2.1.
1.1       grant     122:                 As tar file</a></span></dt>
                    123: 
1.30    ! wiz       124:                 <dt><span class="sect1"><a href="#via-sup">2.2. Via
        !           125:                 SUP</a></span></dt>
1.1       grant     126: 
1.30    ! wiz       127:                 <dt><span class="sect1"><a href="#via-cvs">2.3. Via
        !           128:                 CVS</a></span></dt>
1.1       grant     129:               </dl>
                    130:             </dd>
                    131: 
                    132:             <dt><span class="chapter"><a href="#platforms">3. Using
                    133:             pkgsrc on systems other than NetBSD</a></span></dt>
                    134: 
                    135:             <dd>
                    136:               <dl>
1.30    ! wiz       137:                 <dt><span class="sect1"><a href=
        !           138:                 "#bootstrapping-pkgsrc">3.1. Bootstrapping
        !           139:                 pkgsrc</a></span></dt>
1.1       grant     140: 
1.30    ! wiz       141:                 <dt><span class="sect1"><a href=
        !           142:                 "#platform-specific-notes">3.2. Platform specific
        !           143:                 notes</a></span></dt>
1.1       grant     144: 
                    145:                 <dd>
                    146:                   <dl>
                    147:                     <dt><span class="sect2"><a href=
1.30    ! wiz       148:                     "#darwin">3.2.1. Darwin (Mac OS
1.1       grant     149:                     X)</a></span></dt>
                    150: 
                    151:                     <dt><span class="sect2"><a href=
1.30    ! wiz       152:                     "#freebsd">3.2.2. FreeBSD</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.30    ! wiz       155:                     "#interix">3.2.3. Interix</a></span></dt>
1.1       grant     156: 
1.30    ! wiz       157:                     <dt><span class="sect2"><a href="#irix">3.2.4.
        !           158:                     IRIX</a></span></dt>
1.1       grant     159: 
1.30    ! wiz       160:                     <dt><span class="sect2"><a href="#linux">3.2.5.
        !           161:                     Linux</a></span></dt>
1.1       grant     162: 
                    163:                     <dt><span class="sect2"><a href=
1.30    ! wiz       164:                     "#openbsd">3.2.6. OpenBSD</a></span></dt>
1.22      tv        165: 
                    166:                     <dt><span class="sect2"><a href=
1.30    ! wiz       167:                     "#solaris">3.2.7. Solaris</a></span></dt>
1.1       grant     168:                   </dl>
                    169:                 </dd>
                    170:               </dl>
                    171:             </dd>
                    172: 
                    173:             <dt><span class="chapter"><a href="#using">4. Using
                    174:             pkgsrc</a></span></dt>
                    175: 
                    176:             <dd>
                    177:               <dl>
                    178:                 <dt><span class="sect1"><a href=
                    179:                 "#getting-started">4.1. Working with binary
                    180:                 packages</a></span></dt>
                    181: 
                    182:                 <dd>
                    183:                   <dl>
                    184:                     <dt><span class="sect2"><a href=
1.30    ! wiz       185:                     "#where-to-get-binary-packages">4.1.1. Where to
        !           186:                     get binary packages</a></span></dt>
1.1       grant     187: 
                    188:                     <dt><span class="sect2"><a href=
1.30    ! wiz       189:                     "#how-to-use-binary-packages">4.1.2. How to use
        !           190:                     binary packages</a></span></dt>
1.1       grant     191: 
                    192:                     <dt><span class="sect2"><a href=
1.30    ! wiz       193:                     "#a-word-of-warning">4.1.3. A word of
1.1       grant     194:                     warning</a></span></dt>
                    195:                   </dl>
                    196:                 </dd>
                    197: 
1.30    ! wiz       198:                 <dt><span class="sect1"><a href=
        !           199:                 "#building-packages-from-source">4.2. Building
        !           200:                 packages from source</a></span></dt>
1.1       grant     201: 
                    202:                 <dd>
                    203:                   <dl>
                    204:                     <dt><span class="sect2"><a href=
1.30    ! wiz       205:                     "#requirements">4.2.1.
1.1       grant     206:                     Requirements</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.30    ! wiz       209:                     "#fetching-distfiles">4.2.2. Fetching
1.1       grant     210:                     distfiles</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.30    ! wiz       213:                     "#how-to-build-and-install">4.2.3. How to build
        !           214:                     and install</a></span></dt>
1.1       grant     215: 
                    216:                     <dt><span class="sect2"><a href=
1.30    ! wiz       217:                     "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant     218:                     compiler</a></span></dt>
                    219:                   </dl>
                    220:                 </dd>
                    221:               </dl>
                    222:             </dd>
                    223: 
                    224:             <dt><span class="chapter"><a href="#binary">5. Creating
                    225:             binary packages</a></span></dt>
                    226: 
                    227:             <dd>
                    228:               <dl>
1.30    ! wiz       229:                 <dt><span class="sect1"><a href=
        !           230:                 "#building-a-single-binary-package">5.1. Building a
        !           231:                 single binary package</a></span></dt>
1.1       grant     232: 
1.30    ! wiz       233:                 <dt><span class="sect1"><a href=
        !           234:                 "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant     235:                 Settings for creation of binary
                    236:                 packages</a></span></dt>
                    237: 
                    238:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    239:                 Doing a bulk build of all packages</a></span></dt>
                    240: 
                    241:                 <dd>
                    242:                   <dl>
                    243:                     <dt><span class="sect2"><a href=
                    244:                     "#binary.configuration">5.3.1.
                    245:                     Configuration</a></span></dt>
                    246: 
                    247:                     <dt><span class="sect2"><a href=
1.30    ! wiz       248:                     "#other-environmental-considerations">5.3.2.
        !           249:                     Other environmental
1.1       grant     250:                     considerations</a></span></dt>
                    251: 
                    252:                     <dt><span class="sect2"><a href=
1.30    ! wiz       253:                     "#operation">5.3.3. Operation</a></span></dt>
1.1       grant     254: 
                    255:                     <dt><span class="sect2"><a href=
1.30    ! wiz       256:                     "#what-it-does">5.3.4. What it
1.1       grant     257:                     does</a></span></dt>
                    258: 
                    259:                     <dt><span class="sect2"><a href=
1.30    ! wiz       260:                     "#disk-space-requirements">5.3.5. Disk space
1.1       grant     261:                     requirements</a></span></dt>
                    262: 
                    263:                     <dt><span class="sect2"><a href=
1.30    ! wiz       264:                     "#setting-up-a-sandbox">5.3.6. Setting up a
        !           265:                     sandbox for chroot'ed builds</a></span></dt>
1.1       grant     266: 
                    267:                     <dt><span class="sect2"><a href=
1.30    ! wiz       268:                     "#building-a-partial-set">5.3.7. Building a
        !           269:                     partial set of packages</a></span></dt>
1.13      hubertf   270: 
                    271:                     <dt><span class="sect2"><a href=
                    272:                     "#bulk-upload">5.3.8. Uploading results of a
                    273:                     bulk build</a></span></dt>
1.1       grant     274:                   </dl>
                    275:                 </dd>
                    276: 
1.30    ! wiz       277:                 <dt><span class="sect1"><a href=
        !           278:                 "#creating-cdroms">5.4. Creating a multiple CD-ROM
        !           279:                 packages collection</a></span></dt>
1.1       grant     280: 
                    281:                 <dd>
                    282:                   <dl>
                    283:                     <dt><span class="sect2"><a href=
1.30    ! wiz       284:                     "#cdpack-example">5.4.1. Example of
1.1       grant     285:                     cdpack</a></span></dt>
                    286:                   </dl>
                    287:                 </dd>
                    288:               </dl>
                    289:             </dd>
                    290: 
                    291:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    292:             Asked Questions</a></span></dt>
                    293: 
                    294:             <dd>
                    295:               <dl>
1.30    ! wiz       296:                 <dt><span class="sect1"><a href=
        !           297:                 "#mailing-list-pointers">6.1. Are there any mailing
        !           298:                 lists for pkg-related discussion?</a></span></dt>
1.1       grant     299: 
1.30    ! wiz       300:                 <dt><span class="sect1"><a href=
        !           301:                 "#pkgviews-docs">6.2. Where's the pkgviews
        !           302:                 documentation?</a></span></dt>
1.1       grant     303: 
1.5       hubertf   304:                 <dt><span class="sect1"><a href=
                    305:                 "#faq-pkgtools">6.3. Utilities for package
                    306:                 management (pkgtools)</a></span></dt>
1.1       grant     307: 
1.30    ! wiz       308:                 <dt><span class="sect1"><a href=
        !           309:                 "#non-root-pkgsrc">6.4. How to use pkgsrc as
        !           310:                 non-root</a></span></dt>
        !           311: 
        !           312:                 <dt><span class="sect1"><a href=
        !           313:                 "#resume-transfers">6.5. How to resume transfers
        !           314:                 when fetching distfiles?</a></span></dt>
        !           315: 
        !           316:                 <dt><span class="sect1"><a href=
        !           317:                 "#XFree86-from-pkgsrc">6.6. How can I install/use
        !           318:                 XFree86 from pkgsrc?</a></span></dt>
        !           319: 
        !           320:                 <dt><span class="sect1"><a href=
        !           321:                 "#x.org-from-pkgsrc">6.7. How can I install/use
        !           322:                 X.org from pkgsrc?</a></span></dt>
1.1       grant     323: 
1.30    ! wiz       324:                 <dt><span class="sect1"><a href=
        !           325:                 "#fetch-behind-firewall">6.8. How to fetch files
        !           326:                 from behind a firewall</a></span></dt>
1.1       grant     327: 
1.30    ! wiz       328:                 <dt><span class="sect1"><a href="#passive-ftp">6.9.
1.14      xtraeme   329:                 How do I tell <span><strong class="command">make
                    330:                 fetch</strong></span> to do passive
1.1       grant     331:                 FTP?</a></span></dt>
                    332: 
1.30    ! wiz       333:                 <dt><span class="sect1"><a href=
        !           334:                 "#fetching-all-distfiles">6.10. How to fetch all
        !           335:                 distfiles at once</a></span></dt>
1.1       grant     336: 
1.30    ! wiz       337:                 <dt><span class="sect1"><a href=
        !           338:                 "#tmac.andoc-missing">6.11. What does
        !           339:                 &#8220;<span class="quote">Don't know how to make
        !           340:                 /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme   341:                 mean?</a></span></dt>
1.13      hubertf   342: 
1.30    ! wiz       343:                 <dt><span class="sect1"><a href=
        !           344:                 "#bsd.own.mk-missing">6.12. What does
        !           345:                 &#8220;<span class="quote">Could not find
1.14      xtraeme   346:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     347: 
1.30    ! wiz       348:                 <dt><span class="sect1"><a href=
        !           349:                 "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
        !           350:                 pkgsrc</a></span></dt>
1.1       grant     351: 
1.14      xtraeme   352:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant     353:                 Configuration files handling and
                    354:                 placement</a></span></dt>
                    355: 
                    356:                 <dt><span class="sect1"><a href=
1.14      xtraeme   357:                 "#audit-packages">6.15. Automated security
1.1       grant     358:                 checks</a></span></dt>
                    359:               </dl>
                    360:             </dd>
                    361:           </dl>
                    362:         </dd>
                    363: 
1.2       hubertf   364:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     365:         pkgsrc developer's guide</a></span></dt>
                    366: 
                    367:         <dd>
                    368:           <dl>
1.27      rillig    369:             <dt><span class="chapter"><a href="#components">7.
                    370:             Package components - files, directories and
                    371:             contents</a></span></dt>
                    372: 
                    373:             <dd>
                    374:               <dl>
                    375:                 <dt><span class="sect1"><a href=
                    376:                 "#components.Makefile">7.1. <code class=
                    377:                 "filename">Makefile</code></a></span></dt>
                    378: 
                    379:                 <dt><span class="sect1"><a href=
                    380:                 "#components.distinfo">7.2. <code class=
                    381:                 "filename">distinfo</code></a></span></dt>
                    382: 
                    383:                 <dt><span class="sect1"><a href=
                    384:                 "#components.patches">7.3.
                    385:                 patches/*</a></span></dt>
                    386: 
1.30    ! wiz       387:                 <dt><span class="sect1"><a href=
        !           388:                 "#other-mandatory-files">7.4. Other mandatory
        !           389:                 files</a></span></dt>
1.27      rillig    390: 
                    391:                 <dt><span class="sect1"><a href=
                    392:                 "#components.optional">7.5. Optional
                    393:                 files</a></span></dt>
                    394: 
1.30    ! wiz       395:                 <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig    396:                 <code class="filename">work*</code></a></span></dt>
                    397: 
1.30    ! wiz       398:                 <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig    399:                 <code class=
                    400:                 "filename">files/*</code></a></span></dt>
                    401:               </dl>
                    402:             </dd>
                    403: 
                    404:             <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig    405:             Programming in <code class=
                    406:             "filename">Makefile</code>s</a></span></dt>
                    407: 
                    408:             <dd>
                    409:               <dl>
                    410:                 <dt><span class="sect1"><a href=
1.27      rillig    411:                 "#makefile.variables">8.1. <code class=
1.25      rillig    412:                 "filename">Makefile</code>
                    413:                 variables</a></span></dt>
                    414: 
1.27      rillig    415:                 <dd>
                    416:                   <dl>
                    417:                     <dt><span class="sect2"><a href=
                    418:                     "#makefile.variables.names">8.1.1. Naming
                    419:                     conventions</a></span></dt>
                    420:                   </dl>
                    421:                 </dd>
                    422: 
1.25      rillig    423:                 <dt><span class="sect1"><a href=
1.27      rillig    424:                 "#makefile.code">8.2. Code snippets</a></span></dt>
1.25      rillig    425: 
                    426:                 <dd>
                    427:                   <dl>
                    428:                     <dt><span class="sect2"><a href=
1.30    ! wiz       429:                     "#adding-to-list">8.2.1. Adding things to a
1.25      rillig    430:                     list</a></span></dt>
                    431: 
                    432:                     <dt><span class="sect2"><a href=
1.30    ! wiz       433:                     "#converting-internal-to-external">8.2.2.
        !           434:                     Converting an internal list into an external
        !           435:                     list</a></span></dt>
1.25      rillig    436: 
                    437:                     <dt><span class="sect2"><a href=
1.30    ! wiz       438:                     "#passing-variable-to-shell">8.2.3. Passing
        !           439:                     variables to a shell command</a></span></dt>
1.27      rillig    440: 
                    441:                     <dt><span class="sect2"><a href=
1.30    ! wiz       442:                     "#quoting-guideline">8.2.4. Quoting
1.27      rillig    443:                     guideline</a></span></dt>
                    444: 
                    445:                     <dt><span class="sect2"><a href=
1.30    ! wiz       446:                     "#bsd-make-bug-workaround">8.2.5. Workaround
        !           447:                     for a bug in BSD Make</a></span></dt>
1.25      rillig    448:                   </dl>
                    449:                 </dd>
                    450:               </dl>
                    451:             </dd>
                    452: 
                    453:             <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant     454:             issues</a></span></dt>
                    455: 
                    456:             <dd>
                    457:               <dl>
1.30    ! wiz       458:                 <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
        !           459:                 ID</a></span></dt>
1.1       grant     460: 
1.30    ! wiz       461:                 <dt><span class="sect1"><a href=
        !           462:                 "#automatic-plist-generation">9.2. Semi-automatic
        !           463:                 <code class="filename">PLIST</code>
1.14      xtraeme   464:                 generation</a></span></dt>
1.1       grant     465: 
1.25      rillig    466:                 <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme   467:                 Tweaking output of <span><strong class=
                    468:                 "command">make
                    469:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     470: 
1.25      rillig    471:                 <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant     472:                 Variable substitution in PLIST</a></span></dt>
                    473: 
1.30    ! wiz       474:                 <dt><span class="sect1"><a href=
        !           475:                 "#manpage-compression">9.5.
1.1       grant     476:                 Manpage-compression</a></span></dt>
                    477: 
1.30    ! wiz       478:                 <dt><span class="sect1"><a href=
        !           479:                 "#using-PLIST_SRC">9.6. Changing PLIST source with
        !           480:                 <code class=
1.14      xtraeme   481:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     482: 
1.30    ! wiz       483:                 <dt><span class="sect1"><a href=
        !           484:                 "#platform-specific-plist">9.7. Platform specific
        !           485:                 and differing PLISTs</a></span></dt>
1.1       grant     486: 
                    487:                 <dt><span class="sect1"><a href=
1.25      rillig    488:                 "#faq.common-dirs">9.8. Sharing directories between
1.1       grant     489:                 packages</a></span></dt>
                    490:               </dl>
                    491:             </dd>
                    492: 
1.25      rillig    493:             <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant     494:             Buildlink methodology</a></span></dt>
                    495: 
                    496:             <dd>
                    497:               <dl>
1.30    ! wiz       498:                 <dt><span class="sect1"><a href=
        !           499:                 "#converting-to-buildlink3">10.1. Converting
        !           500:                 packages to use buildlink3</a></span></dt>
1.1       grant     501: 
1.30    ! wiz       502:                 <dt><span class="sect1"><a href=
        !           503:                 "#creating-buildlink3.mk">10.2. Writing
        !           504:                 <code class="filename">buildlink3.mk</code>
1.14      xtraeme   505:                 files</a></span></dt>
1.1       grant     506: 
                    507:                 <dd>
                    508:                   <dl>
                    509:                     <dt><span class="sect2"><a href=
1.30    ! wiz       510:                     "#anatomy-of-bl3">10.2.1. Anatomy of a
        !           511:                     buildlink3.mk file</a></span></dt>
1.1       grant     512: 
                    513:                     <dt><span class="sect2"><a href=
1.30    ! wiz       514:                     "#updating-buildlink-depends">10.2.2. Updating
        !           515:                     <code class=
1.14      xtraeme   516:                     "varname">BUILDLINK_DEPENDS.<em class=
                    517:                     "replaceable"><code>pkg</code></em></code> in
                    518:                     <code class="filename">buildlink3.mk</code>
1.1       grant     519:                     files</a></span></dt>
                    520:                   </dl>
                    521:                 </dd>
                    522: 
1.30    ! wiz       523:                 <dt><span class="sect1"><a href=
        !           524:                 "#writing-builtin.mk">10.3. Writing <code class=
        !           525:                 "filename">builtin.mk</code> files</a></span></dt>
1.1       grant     526: 
                    527:                 <dd>
                    528:                   <dl>
                    529:                     <dt><span class="sect2"><a href=
1.30    ! wiz       530:                     "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
        !           531:                     <code class="filename">builtin.mk</code>
1.1       grant     532:                     file</a></span></dt>
                    533: 
                    534:                     <dt><span class="sect2"><a href=
1.30    ! wiz       535:                     "#native-or-pkgsrc-preference">10.3.2. Global
        !           536:                     preferences for native or pkgsrc
        !           537:                     software</a></span></dt>
1.1       grant     538:                   </dl>
                    539:                 </dd>
                    540:               </dl>
                    541:             </dd>
                    542: 
1.25      rillig    543:             <dt><span class="chapter"><a href="#options">11.
1.1       grant     544:             Options handling</a></span></dt>
                    545: 
                    546:             <dd>
                    547:               <dl>
1.30    ! wiz       548:                 <dt><span class="sect1"><a href=
        !           549:                 "#global-default-options">11.1. Global default
        !           550:                 options</a></span></dt>
1.1       grant     551: 
1.30    ! wiz       552:                 <dt><span class="sect1"><a href=
        !           553:                 "#converting-to-options">11.2. Converting packages
        !           554:                 to use <code class=
1.14      xtraeme   555:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     556:               </dl>
                    557:             </dd>
                    558: 
1.25      rillig    559:             <dt><span class="chapter"><a href="#build">12. The
1.1       grant     560:             build process</a></span></dt>
                    561: 
                    562:             <dd>
                    563:               <dl>
                    564:                 <dt><span class="sect1"><a href=
1.25      rillig    565:                 "#build.prefix">12.1. Program
1.1       grant     566:                 location</a></span></dt>
                    567: 
1.30    ! wiz       568:                 <dt><span class="sect1"><a href=
        !           569:                 "#main-targets">12.2. Main targets</a></span></dt>
1.1       grant     570: 
                    571:                 <dt><span class="sect1"><a href=
1.25      rillig    572:                 "#build.helpful-targets">12.3. Other helpful
1.1       grant     573:                 targets</a></span></dt>
                    574:               </dl>
                    575:             </dd>
                    576: 
1.25      rillig    577:             <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1       grant     578:             fixes for packages</a></span></dt>
                    579: 
                    580:             <dd>
                    581:               <dl>
1.30    ! wiz       582:                 <dt><span class="sect1"><a href=
        !           583:                 "#general-operation">13.1. General
        !           584:                 operation</a></span></dt>
1.1       grant     585: 
                    586:                 <dd>
                    587:                   <dl>
                    588:                     <dt><span class="sect2"><a href=
1.30    ! wiz       589:                     "#pulling-vars-from-etc-mk.conf">13.1.1. How to
        !           590:                     pull in variables from
        !           591:                     /etc/mk.conf</a></span></dt>
1.1       grant     592: 
                    593:                     <dt><span class="sect2"><a href=
1.30    ! wiz       594:                     "#restricted-packages">13.1.2. Restricted
1.1       grant     595:                     packages</a></span></dt>
                    596: 
                    597:                     <dt><span class="sect2"><a href=
1.25      rillig    598:                     "#dependencies">13.1.3. Handling
1.1       grant     599:                     dependencies</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.30    ! wiz       602:                     "#conflicts">13.1.4. Handling conflicts with
1.1       grant     603:                     other packages</a></span></dt>
                    604: 
                    605:                     <dt><span class="sect2"><a href=
1.30    ! wiz       606:                     "#not-building-packages">13.1.5. Packages that
        !           607:                     cannot or should not be built</a></span></dt>
1.1       grant     608: 
                    609:                     <dt><span class="sect2"><a href=
1.30    ! wiz       610:                     "#undeletable-packages">13.1.6. Packages which
        !           611:                     should not be deleted, once
        !           612:                     installed</a></span></dt>
1.1       grant     613: 
                    614:                     <dt><span class="sect2"><a href=
1.25      rillig    615:                     "#security-handling">13.1.7. Handling packages
1.1       grant     616:                     with security problems</a></span></dt>
                    617: 
                    618:                     <dt><span class="sect2"><a href=
1.30    ! wiz       619:                     "#compiler-bugs">13.1.8. How to handle compiler
1.1       grant     620:                     bugs</a></span></dt>
                    621: 
                    622:                     <dt><span class="sect2"><a href=
1.30    ! wiz       623:                     "#bumping-pkgrevision">13.1.9. How to handle
        !           624:                     incrementing versions when fixing an existing
1.1       grant     625:                     package</a></span></dt>
                    626: 
                    627:                     <dt><span class="sect2"><a href=
1.30    ! wiz       628:                     "#portability-of-packages">13.1.10. Portability
        !           629:                     of packages</a></span></dt>
1.1       grant     630:                   </dl>
                    631:                 </dd>
                    632: 
1.30    ! wiz       633:                 <dt><span class="sect1"><a href=
        !           634:                 "#downloading-issues">13.2. Possible downloading
        !           635:                 issues</a></span></dt>
1.1       grant     636: 
                    637:                 <dd>
                    638:                   <dl>
                    639:                     <dt><span class="sect2"><a href=
1.30    ! wiz       640:                     "#no-plain-download">13.2.1. Packages whose
        !           641:                     distfiles aren't available for plain
1.1       grant     642:                     downloading</a></span></dt>
                    643: 
                    644:                     <dt><span class="sect2"><a href=
1.30    ! wiz       645:                     "#modified-distfiles-same-name">13.2.2. How to
        !           646:                     handle modified distfiles with the 'old'
        !           647:                     name</a></span></dt>
1.1       grant     648:                   </dl>
                    649:                 </dd>
                    650: 
1.30    ! wiz       651:                 <dt><span class="sect1"><a href=
        !           652:                 "#configuration-gotchas">13.3. Configuration
        !           653:                 gotchas</a></span></dt>
1.1       grant     654: 
                    655:                 <dd>
                    656:                   <dl>
                    657:                     <dt><span class="sect2"><a href=
1.25      rillig    658:                     "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant     659:                     libtool</a></span></dt>
                    660: 
                    661:                     <dt><span class="sect2"><a href=
1.30    ! wiz       662:                     "#using-libtool">13.3.2. Using libtool on GNU
1.1       grant     663:                     packages that already support
                    664:                     libtool</a></span></dt>
                    665: 
                    666:                     <dt><span class="sect2"><a href=
1.30    ! wiz       667:                     "#autoconf-automake">13.3.3. GNU
1.1       grant     668:                     Autoconf/Automake</a></span></dt>
                    669:                   </dl>
                    670:                 </dd>
                    671: 
1.30    ! wiz       672:                 <dt><span class="sect1"><a href=
        !           673:                 "#building-considerations">13.4. Building
        !           674:                 considerations</a></span></dt>
1.1       grant     675: 
                    676:                 <dd>
                    677:                   <dl>
                    678:                     <dt><span class="sect2"><a href=
1.30    ! wiz       679:                     "#cpp-defines">13.4.1. CPP
1.1       grant     680:                     defines</a></span></dt>
                    681:                   </dl>
                    682:                 </dd>
                    683: 
1.30    ! wiz       684:                 <dt><span class="sect1"><a href=
        !           685:                 "#package-specific-actions">13.5. Package specific
        !           686:                 actions</a></span></dt>
1.1       grant     687: 
                    688:                 <dd>
                    689:                   <dl>
                    690:                     <dt><span class="sect2"><a href=
1.30    ! wiz       691:                     "#package-configuration-files">13.5.1. Package
        !           692:                     configuration files</a></span></dt>
1.1       grant     693: 
                    694:                     <dt><span class="sect2"><a href=
1.30    ! wiz       695:                     "#user-interaction">13.5.2. User
1.2       hubertf   696:                     interaction</a></span></dt>
1.1       grant     697: 
                    698:                     <dt><span class="sect2"><a href=
1.30    ! wiz       699:                     "#handling-licenses">13.5.3. Handling
1.1       grant     700:                     licenses</a></span></dt>
                    701: 
                    702:                     <dt><span class="sect2"><a href=
1.30    ! wiz       703:                     "#creating-accounts">13.5.4. Creating an
        !           704:                     account from a package</a></span></dt>
1.1       grant     705: 
                    706:                     <dt><span class="sect2"><a href=
1.30    ! wiz       707:                     "#installing-score-files">13.5.5. Installing
        !           708:                     score files</a></span></dt>
1.1       grant     709: 
                    710:                     <dt><span class="sect2"><a href=
1.30    ! wiz       711:                     "#login-shells">13.5.6. Packages providing
        !           712:                     login shells</a></span></dt>
1.1       grant     713: 
                    714:                     <dt><span class="sect2"><a href=
1.30    ! wiz       715:                     "#perl-scripts">13.5.7. Packages containing
        !           716:                     perl scripts</a></span></dt>
1.1       grant     717: 
                    718:                     <dt><span class="sect2"><a href=
1.30    ! wiz       719:                     "#hardcoded-paths">13.5.8. Packages with
        !           720:                     hardcoded paths to other
        !           721:                     interpreters</a></span></dt>
1.1       grant     722: 
                    723:                     <dt><span class="sect2"><a href=
1.30    ! wiz       724:                     "#perl-modules">13.5.9. Packages installing
        !           725:                     perl modules</a></span></dt>
1.1       grant     726: 
                    727:                     <dt><span class="sect2"><a href=
1.25      rillig    728:                     "#faq.info-files">13.5.10. Packages installing
1.1       grant     729:                     info files</a></span></dt>
                    730: 
                    731:                     <dt><span class="sect2"><a href=
1.30    ! wiz       732:                     "#gconf2-data-files">13.5.11. Packages
        !           733:                     installing GConf2 data files</a></span></dt>
1.1       grant     734: 
                    735:                     <dt><span class="sect2"><a href=
1.30    ! wiz       736:                     "#scrollkeeper-data-files">13.5.12. Packages
        !           737:                     installing scrollkeeper data
        !           738:                     files</a></span></dt>
1.1       grant     739: 
                    740:                     <dt><span class="sect2"><a href=
1.30    ! wiz       741:                     "#x11-fonts">13.5.13. Packages installing X11
1.1       grant     742:                     fonts</a></span></dt>
                    743: 
                    744:                     <dt><span class="sect2"><a href=
1.30    ! wiz       745:                     "#gtk2-modules">13.5.14. Packages installing
        !           746:                     GTK2 modules</a></span></dt>
1.1       grant     747: 
                    748:                     <dt><span class="sect2"><a href=
1.30    ! wiz       749:                     "#sgml-xml-data">13.5.15. Packages installing
        !           750:                     SGML or XML data</a></span></dt>
1.1       grant     751: 
                    752:                     <dt><span class="sect2"><a href=
1.30    ! wiz       753:                     "#mime-database">13.5.16. Packages installing
1.1       grant     754:                     extensions to the MIME database</a></span></dt>
                    755: 
                    756:                     <dt><span class="sect2"><a href=
1.30    ! wiz       757:                     "#intltool">13.5.17. Packages using
1.1       grant     758:                     intltool</a></span></dt>
1.18      xtraeme   759: 
                    760:                     <dt><span class="sect2"><a href=
1.30    ! wiz       761:                     "#startup-scripts">13.5.18. Packages installing
1.18      xtraeme   762:                     startup scripts</a></span></dt>
1.1       grant     763:                   </dl>
                    764:                 </dd>
                    765: 
1.30    ! wiz       766:                 <dt><span class="sect1"><a href=
        !           767:                 "#feedback-to-author">13.6. Feedback to the
        !           768:                 author</a></span></dt>
1.1       grant     769:               </dl>
                    770:             </dd>
                    771: 
1.25      rillig    772:             <dt><span class="chapter"><a href="#debug">14.
1.1       grant     773:             Debugging</a></span></dt>
                    774: 
1.25      rillig    775:             <dt><span class="chapter"><a href="#submit">15.
1.1       grant     776:             Submitting and Committing</a></span></dt>
                    777: 
                    778:             <dd>
                    779:               <dl>
1.30    ! wiz       780:                 <dt><span class="sect1"><a href=
        !           781:                 "#submitting-your-package">15.1. Submitting your
        !           782:                 packages</a></span></dt>
1.1       grant     783: 
1.30    ! wiz       784:                 <dt><span class="sect1"><a href=
        !           785:                 "#committing-importing">15.2. Committing: Importing
        !           786:                 a package into CVS</a></span></dt>
1.1       grant     787: 
1.30    ! wiz       788:                 <dt><span class="sect1"><a href=
        !           789:                 "#updating-package">15.3. Updating a package to a
        !           790:                 newer version</a></span></dt>
1.1       grant     791: 
1.30    ! wiz       792:                 <dt><span class="sect1"><a href=
        !           793:                 "#moving-package">15.4. Moving a package in
        !           794:                 pkgsrc</a></span></dt>
1.1       grant     795:               </dl>
                    796:             </dd>
                    797:           </dl>
                    798:         </dd>
                    799: 
                    800:         <dt><span class="appendix"><a href="#examples">A. A simple
                    801:         example package: bison</a></span></dt>
                    802: 
                    803:         <dd>
                    804:           <dl>
1.30    ! wiz       805:             <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant     806:             files</a></span></dt>
                    807: 
                    808:             <dd>
                    809:               <dl>
1.30    ! wiz       810:                 <dt><span class="sect2"><a href=
        !           811:                 "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant     812: 
1.30    ! wiz       813:                 <dt><span class="sect2"><a href=
        !           814:                 "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant     815: 
1.30    ! wiz       816:                 <dt><span class="sect2"><a href=
        !           817:                 "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant     818: 
1.30    ! wiz       819:                 <dt><span class="sect2"><a href=
        !           820:                 "#checking-package-with-pkglint">A.1.4. Checking a
        !           821:                 package with <span><strong class=
1.14      xtraeme   822:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     823:               </dl>
                    824:             </dd>
                    825: 
1.30    ! wiz       826:             <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
        !           827:             Steps for building, installing,
        !           828:             packaging</a></span></dt>
1.1       grant     829:           </dl>
                    830:         </dd>
                    831: 
                    832:         <dt><span class="appendix"><a href="#logs">B. Build
                    833:         logs</a></span></dt>
                    834: 
                    835:         <dd>
                    836:           <dl>
                    837:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    838:             Building figlet</a></span></dt>
                    839: 
                    840:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    841:             Packaging figlet</a></span></dt>
                    842:           </dl>
                    843:         </dd>
                    844: 
                    845:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    846:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   847: 
                    848:         <dt><span class="appendix"><a href="#editing">D. Editing
                    849:         guidelines for the pkgsrc guide</a></span></dt>
                    850: 
                    851:         <dd>
                    852:           <dl>
1.30    ! wiz       853:             <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf   854:             Targets</a></span></dt>
                    855: 
1.30    ! wiz       856:             <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf   857:             Procedure</a></span></dt>
                    858:           </dl>
                    859:         </dd>
1.1       grant     860:       </dl>
                    861:     </div>
                    862: 
                    863:     <div class="chapter" lang="en" xml:lang="en">
                    864:       <div class="titlepage">
                    865:         <div>
                    866:           <div>
                    867:             <h2 class="title"><a name="introduction" id=
                    868:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    869:           </div>
                    870:         </div>
                    871:       </div>
                    872: 
                    873:       <div class="toc">
                    874:         <p><b>Table of Contents</b></p>
                    875: 
                    876:         <dl>
1.30    ! wiz       877:           <dt><span class="sect1"><a href=
        !           878:           "#introduction-section">1.1. Introduction</a></span></dt>
1.1       grant     879: 
                    880:           <dt><span class="sect1"><a href="#overview">1.2.
                    881:           Overview</a></span></dt>
                    882: 
                    883:           <dt><span class="sect1"><a href="#terminology">1.3.
                    884:           Terminology</a></span></dt>
                    885: 
                    886:           <dt><span class="sect1"><a href="#typography">1.4.
                    887:           Typography</a></span></dt>
                    888:         </dl>
                    889:       </div>
                    890: 
                    891:       <div class="sect1" lang="en" xml:lang="en">
                    892:         <div class="titlepage">
                    893:           <div>
                    894:             <div>
                    895:               <h2 class="title" style="clear: both"><a name=
1.30    ! wiz       896:               "introduction-section" id=
        !           897:               "introduction-section"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     898:             </div>
                    899:           </div>
                    900:         </div>
                    901: 
                    902:         <p>There is a lot of software freely available for Unix
                    903:         based systems, which usually runs on NetBSD and other
                    904:         Unix-flavoured systems, too, sometimes with some
                    905:         modifications. The NetBSD Packages Collection (pkgsrc)
                    906:         incorporates any such changes necessary to make that
                    907:         software run, and makes the installation (and
                    908:         de-installation) of the software package easy by means of a
                    909:         single command.</p>
                    910: 
                    911:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   912:         the <span><strong class="command">pkg_*</strong></span>
                    913:         tools so that installation and de-installation, printing of
                    914:         an inventory of all installed packages and retrieval of
                    915:         one-line comments or more verbose descriptions are all
                    916:         simple.</p>
1.1       grant     917: 
                    918:         <p>pkgsrc currently contains several thousand packages,
                    919:         including:</p>
                    920: 
                    921:         <div class="itemizedlist">
                    922:           <ul type="disc">
                    923:             <li>
                    924:               <p><a xmlns=
                    925:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    926:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20      ben       927:               class="pkgname">www/apache</a> - The Apache web
                    928:               server</p>
1.1       grant     929:             </li>
                    930: 
                    931:             <li>
                    932:               <p><a xmlns=
                    933:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    934:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben       935:               class="pkgname">www/mozilla</a> - The Mozilla web
                    936:               browser</p>
1.1       grant     937:             </li>
                    938: 
                    939:             <li>
                    940:               <p><a xmlns=
                    941:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    942:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20      ben       943:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    944:               Desktop Environment</p>
1.1       grant     945:             </li>
                    946: 
                    947:             <li>
                    948:               <p><a xmlns=
                    949:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    950:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20      ben       951:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    952:               Environment</p>
1.1       grant     953:             </li>
                    954:           </ul>
                    955:         </div>
                    956: 
                    957:         <p>...just to name a few.</p>
                    958: 
                    959:         <p>pkgsrc has built-in support for handling varying
                    960:         dependencies, such as pthreads and X11, and extended
                    961:         features such as IPv6 support on a range of platforms.</p>
                    962: 
                    963:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    964:         initially developed for NetBSD only. Since then, pkgsrc has
                    965:         grown a lot, and now supports the following platforms:</p>
                    966: 
                    967:         <div class="itemizedlist">
                    968:           <ul type="disc">
                    969:             <li>
                    970:               <p><a href="http://developer.apple.com/darwin/"
                    971:               target="_top">Darwin</a> (<a href=
                    972:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    973:               X</a>)</p>
                    974:             </li>
                    975: 
                    976:             <li>
1.3       hubertf   977:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    978:               "_top">DragonFlyBSD</a></p>
                    979:             </li>
                    980: 
                    981:             <li>
1.1       grant     982:               <p><a href="http://www.FreeBSD.org/" target=
                    983:               "_top">FreeBSD</a></p>
                    984:             </li>
                    985: 
                    986:             <li>
1.3       hubertf   987:               <p>Microsoft Windows, via <a href=
                    988:               "http://www.microsoft.com/windows/sfu/" target=
                    989:               "_top">Interix</a></p>
1.1       grant     990:             </li>
                    991: 
                    992:             <li>
                    993:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    994:               target="_top">IRIX</a></p>
                    995:             </li>
                    996: 
                    997:             <li>
                    998:               <p><a href="http://www.linux.org/" target=
                    999:               "_top">Linux</a></p>
                   1000:             </li>
                   1001: 
                   1002:             <li>
                   1003:               <p><a href="http://www.NetBSD.org/" target=
                   1004:               "_top">NetBSD</a> (of course)</p>
                   1005:             </li>
                   1006: 
                   1007:             <li>
1.17      sketch   1008:               <p><a href="http://h30097.www3.hp.com/" target=
                   1009:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                   1010:             </li>
                   1011: 
                   1012:             <li>
1.1       grant    1013:               <p><a href="http://www.openbsd.org/" target=
                   1014:               "_top">OpenBSD</a></p>
                   1015:             </li>
                   1016: 
                   1017:             <li>
                   1018:               <p><a href="http://www.sun.com/solaris/" target=
                   1019:               "_top">Solaris</a></p>
                   1020:             </li>
                   1021:           </ul>
                   1022:         </div>
                   1023:       </div>
                   1024: 
                   1025:       <div class="sect1" lang="en" xml:lang="en">
                   1026:         <div class="titlepage">
                   1027:           <div>
                   1028:             <div>
                   1029:               <h2 class="title" style="clear: both"><a name=
                   1030:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                   1031:             </div>
                   1032:           </div>
                   1033:         </div>
                   1034: 
                   1035:         <p>This document is divided into two parts. The first,
                   1036:         <a href="#users-guide" title=
1.2       hubertf  1037:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                   1038:         user's guide</a>, describes how one can use one of the
                   1039:         packages in the Package Collection, either by installing a
                   1040:         precompiled binary package, or by building one's own copy
                   1041:         using the NetBSD package system. The second part, <a href=
1.1       grant    1042:         "#developers-guide" title=
1.2       hubertf  1043:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1044:         pkgsrc developer's guide</a>, explains how to prepare a
                   1045:         package so it can be easily built by other NetBSD users
                   1046:         without knowing about the package's building details.</p>
1.1       grant    1047: 
                   1048:         <p>This document is available in various formats:</p>
                   1049: 
                   1050:         <div class="itemizedlist">
                   1051:           <ul type="disc">
                   1052:             <li>
                   1053:               <p><a href="index.html" target="_top">HTML</a></p>
                   1054:             </li>
                   1055: 
                   1056:             <li>
                   1057:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1058:             </li>
                   1059: 
                   1060:             <li>
                   1061:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1062:             </li>
                   1063: 
                   1064:             <li>
                   1065:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1066:             </li>
                   1067:           </ul>
                   1068:         </div>
                   1069:       </div>
                   1070: 
                   1071:       <div class="sect1" lang="en" xml:lang="en">
                   1072:         <div class="titlepage">
                   1073:           <div>
                   1074:             <div>
                   1075:               <h2 class="title" style="clear: both"><a name=
                   1076:               "terminology" id=
                   1077:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1078:             </div>
                   1079:           </div>
                   1080:         </div>
                   1081: 
                   1082:         <p>There has been a lot of talk about &#8220;<span class=
                   1083:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1084:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1085:         description of all the terminology used within this
                   1086:         document.</p>
                   1087: 
                   1088:         <div class="variablelist">
                   1089:           <dl>
                   1090:             <dt><span class="term">Package</span></dt>
                   1091: 
                   1092:             <dd>
                   1093:               <p>A set of files and building instructions that
                   1094:               describe what's necessary to build a certain piece of
                   1095:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1096:               stored under <code class=
                   1097:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1098:             </dd>
                   1099: 
                   1100:             <dt><span class="term">The NetBSD package
                   1101:             system</span></dt>
                   1102: 
                   1103:             <dd>
                   1104:               <p>This is the former name of &#8220;<span class=
                   1105:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27      rillig   1106:               NetBSD operating system and can be bootstrapped to
                   1107:               run on non-NetBSD operating systems as well. It
                   1108:               handles building (compiling), installing, and
                   1109:               removing of packages.</p>
1.1       grant    1110:             </dd>
                   1111: 
                   1112:             <dt><span class="term">Distfile</span></dt>
                   1113: 
                   1114:             <dd>
                   1115:               <p>This term describes the file or files that are
                   1116:               provided by the author of the piece of software to
                   1117:               distribute his work. All the changes necessary to
                   1118:               build on NetBSD are reflected in the corresponding
                   1119:               package. Usually the distfile is in the form of a
                   1120:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1121:               too. Distfiles are usually stored below <code class=
                   1122:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1123:             </dd>
                   1124: 
                   1125:             <dt><span class="term">Port</span></dt>
                   1126: 
                   1127:             <dd>
                   1128:               <p>This is the term used by FreeBSD and OpenBSD
                   1129:               people for what we call a package. In NetBSD
                   1130:               terminology, &#8220;<span class=
                   1131:               "quote">port</span>&#8221; refers to a different
                   1132:               architecture.</p>
                   1133:             </dd>
                   1134: 
                   1135:             <dt><span class="term">Precompiled/binary
                   1136:             package</span></dt>
                   1137: 
                   1138:             <dd>
                   1139:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1140:               distfile and stuffed together in a single
                   1141:               <code class="filename">.tgz</code> file so it can be
                   1142:               installed on machines of the same machine
                   1143:               architecture without the need to recompile. Packages
                   1144:               are usually generated in <code class=
                   1145:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1146:               an archive on <a href=
1.1       grant    1147:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1148:               "_top">ftp.NetBSD.org</a>.</p>
                   1149: 
                   1150:               <p>Sometimes, this is referred to by the term
                   1151:               &#8220;<span class="quote">package</span>&#8221; too,
                   1152:               especially in the context of precompiled
                   1153:               packages.</p>
                   1154:             </dd>
                   1155: 
                   1156:             <dt><span class="term">Program</span></dt>
                   1157: 
                   1158:             <dd>
                   1159:               <p>The piece of software to be installed which will
                   1160:               be constructed from all the files in the Distfile by
                   1161:               the actions defined in the corresponding package.</p>
                   1162:             </dd>
                   1163:           </dl>
                   1164:         </div>
                   1165:       </div>
                   1166: 
                   1167:       <div class="sect1" lang="en" xml:lang="en">
                   1168:         <div class="titlepage">
                   1169:           <div>
                   1170:             <div>
                   1171:               <h2 class="title" style="clear: both"><a name=
                   1172:               "typography" id=
                   1173:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1174:             </div>
                   1175:           </div>
                   1176:         </div>
                   1177: 
                   1178:         <p>When giving examples for commands, shell prompts are
                   1179:         used to show if the command should/can be issued as root,
                   1180:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1181:         privileges are sufficient. We use a <code class=
                   1182:         "prompt">#</code> for root's shell prompt, and a
1.27      rillig   1183:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1184:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1185:       </div>
                   1186:     </div>
                   1187: 
                   1188:     <div class="part" lang="en" xml:lang="en">
                   1189:       <div class="titlepage">
                   1190:         <div>
                   1191:           <div>
                   1192:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1193:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1194:           </div>
                   1195:         </div>
                   1196:       </div>
                   1197: 
                   1198:       <div class="toc">
                   1199:         <p><b>Table of Contents</b></p>
                   1200: 
                   1201:         <dl>
                   1202:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1203:           get pkgsrc</a></span></dt>
                   1204: 
                   1205:           <dd>
                   1206:             <dl>
1.30    ! wiz      1207:               <dt><span class="sect1"><a href="#as-tar-file">2.1.
        !          1208:               As tar file</a></span></dt>
1.1       grant    1209: 
1.30    ! wiz      1210:               <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1211:               SUP</a></span></dt>
                   1212: 
1.30    ! wiz      1213:               <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1214:               CVS</a></span></dt>
                   1215:             </dl>
                   1216:           </dd>
                   1217: 
                   1218:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1219:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1220: 
                   1221:           <dd>
                   1222:             <dl>
1.30    ! wiz      1223:               <dt><span class="sect1"><a href=
        !          1224:               "#bootstrapping-pkgsrc">3.1. Bootstrapping
        !          1225:               pkgsrc</a></span></dt>
1.1       grant    1226: 
1.30    ! wiz      1227:               <dt><span class="sect1"><a href=
        !          1228:               "#platform-specific-notes">3.2. Platform specific
        !          1229:               notes</a></span></dt>
1.1       grant    1230: 
                   1231:               <dd>
                   1232:                 <dl>
1.30    ! wiz      1233:                   <dt><span class="sect2"><a href="#darwin">3.2.1.
        !          1234:                   Darwin (Mac OS X)</a></span></dt>
1.1       grant    1235: 
1.30    ! wiz      1236:                   <dt><span class="sect2"><a href="#freebsd">3.2.2.
        !          1237:                   FreeBSD</a></span></dt>
1.22      tv       1238: 
1.30    ! wiz      1239:                   <dt><span class="sect2"><a href="#interix">3.2.3.
        !          1240:                   Interix</a></span></dt>
1.1       grant    1241: 
1.30    ! wiz      1242:                   <dt><span class="sect2"><a href="#irix">3.2.4.
        !          1243:                   IRIX</a></span></dt>
1.1       grant    1244: 
1.30    ! wiz      1245:                   <dt><span class="sect2"><a href="#linux">3.2.5.
        !          1246:                   Linux</a></span></dt>
1.1       grant    1247: 
1.30    ! wiz      1248:                   <dt><span class="sect2"><a href="#openbsd">3.2.6.
        !          1249:                   OpenBSD</a></span></dt>
1.1       grant    1250: 
1.30    ! wiz      1251:                   <dt><span class="sect2"><a href="#solaris">3.2.7.
        !          1252:                   Solaris</a></span></dt>
1.1       grant    1253:                 </dl>
                   1254:               </dd>
                   1255:             </dl>
                   1256:           </dd>
                   1257: 
                   1258:           <dt><span class="chapter"><a href="#using">4. Using
                   1259:           pkgsrc</a></span></dt>
                   1260: 
                   1261:           <dd>
                   1262:             <dl>
                   1263:               <dt><span class="sect1"><a href=
                   1264:               "#getting-started">4.1. Working with binary
                   1265:               packages</a></span></dt>
                   1266: 
                   1267:               <dd>
                   1268:                 <dl>
                   1269:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1270:                   "#where-to-get-binary-packages">4.1.1. Where to
        !          1271:                   get binary packages</a></span></dt>
1.1       grant    1272: 
                   1273:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1274:                   "#how-to-use-binary-packages">4.1.2. How to use
        !          1275:                   binary packages</a></span></dt>
1.1       grant    1276: 
                   1277:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1278:                   "#a-word-of-warning">4.1.3. A word of
1.1       grant    1279:                   warning</a></span></dt>
                   1280:                 </dl>
                   1281:               </dd>
                   1282: 
1.30    ! wiz      1283:               <dt><span class="sect1"><a href=
        !          1284:               "#building-packages-from-source">4.2. Building
        !          1285:               packages from source</a></span></dt>
1.1       grant    1286: 
                   1287:               <dd>
                   1288:                 <dl>
                   1289:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1290:                   "#requirements">4.2.1.
        !          1291:                   Requirements</a></span></dt>
1.1       grant    1292: 
                   1293:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1294:                   "#fetching-distfiles">4.2.2. Fetching
1.1       grant    1295:                   distfiles</a></span></dt>
                   1296: 
                   1297:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1298:                   "#how-to-build-and-install">4.2.3. How to build
        !          1299:                   and install</a></span></dt>
1.1       grant    1300: 
                   1301:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1302:                   "#selecting-the-compiler">4.2.4. Selecting the
1.1       grant    1303:                   compiler</a></span></dt>
                   1304:                 </dl>
                   1305:               </dd>
                   1306:             </dl>
                   1307:           </dd>
                   1308: 
                   1309:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1310:           binary packages</a></span></dt>
                   1311: 
                   1312:           <dd>
                   1313:             <dl>
1.30    ! wiz      1314:               <dt><span class="sect1"><a href=
        !          1315:               "#building-a-single-binary-package">5.1. Building a
        !          1316:               single binary package</a></span></dt>
1.1       grant    1317: 
1.30    ! wiz      1318:               <dt><span class="sect1"><a href=
        !          1319:               "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant    1320:               Settings for creation of binary
                   1321:               packages</a></span></dt>
                   1322: 
                   1323:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1324:               Doing a bulk build of all packages</a></span></dt>
                   1325: 
                   1326:               <dd>
                   1327:                 <dl>
                   1328:                   <dt><span class="sect2"><a href=
                   1329:                   "#binary.configuration">5.3.1.
                   1330:                   Configuration</a></span></dt>
                   1331: 
                   1332:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1333:                   "#other-environmental-considerations">5.3.2.
        !          1334:                   Other environmental
1.1       grant    1335:                   considerations</a></span></dt>
                   1336: 
                   1337:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1338:                   "#operation">5.3.3. Operation</a></span></dt>
1.1       grant    1339: 
                   1340:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1341:                   "#what-it-does">5.3.4. What it
        !          1342:                   does</a></span></dt>
1.1       grant    1343: 
                   1344:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1345:                   "#disk-space-requirements">5.3.5. Disk space
1.1       grant    1346:                   requirements</a></span></dt>
                   1347: 
                   1348:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1349:                   "#setting-up-a-sandbox">5.3.6. Setting up a
        !          1350:                   sandbox for chroot'ed builds</a></span></dt>
1.1       grant    1351: 
                   1352:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1353:                   "#building-a-partial-set">5.3.7. Building a
        !          1354:                   partial set of packages</a></span></dt>
1.13      hubertf  1355: 
                   1356:                   <dt><span class="sect2"><a href=
                   1357:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1358:                   build</a></span></dt>
1.1       grant    1359:                 </dl>
                   1360:               </dd>
                   1361: 
1.30    ! wiz      1362:               <dt><span class="sect1"><a href=
        !          1363:               "#creating-cdroms">5.4. Creating a multiple CD-ROM
        !          1364:               packages collection</a></span></dt>
1.1       grant    1365: 
                   1366:               <dd>
                   1367:                 <dl>
                   1368:                   <dt><span class="sect2"><a href=
1.30    ! wiz      1369:                   "#cdpack-example">5.4.1. Example of
1.1       grant    1370:                   cdpack</a></span></dt>
                   1371:                 </dl>
                   1372:               </dd>
                   1373:             </dl>
                   1374:           </dd>
                   1375: 
                   1376:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1377:           Asked Questions</a></span></dt>
                   1378: 
                   1379:           <dd>
                   1380:             <dl>
1.30    ! wiz      1381:               <dt><span class="sect1"><a href=
        !          1382:               "#mailing-list-pointers">6.1. Are there any mailing
        !          1383:               lists for pkg-related discussion?</a></span></dt>
1.1       grant    1384: 
1.30    ! wiz      1385:               <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1       grant    1386:               Where's the pkgviews documentation?</a></span></dt>
                   1387: 
1.5       hubertf  1388:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1389:               Utilities for package management
                   1390:               (pkgtools)</a></span></dt>
                   1391: 
1.30    ! wiz      1392:               <dt><span class="sect1"><a href=
        !          1393:               "#non-root-pkgsrc">6.4. How to use pkgsrc as
        !          1394:               non-root</a></span></dt>
1.1       grant    1395: 
1.30    ! wiz      1396:               <dt><span class="sect1"><a href=
        !          1397:               "#resume-transfers">6.5. How to resume transfers when
        !          1398:               fetching distfiles?</a></span></dt>
1.14      xtraeme  1399: 
1.30    ! wiz      1400:               <dt><span class="sect1"><a href=
        !          1401:               "#XFree86-from-pkgsrc">6.6. How can I install/use
        !          1402:               XFree86 from pkgsrc?</a></span></dt>
1.1       grant    1403: 
1.30    ! wiz      1404:               <dt><span class="sect1"><a href=
        !          1405:               "#x.org-from-pkgsrc">6.7. How can I install/use X.org
        !          1406:               from pkgsrc?</a></span></dt>
1.1       grant    1407: 
1.30    ! wiz      1408:               <dt><span class="sect1"><a href=
        !          1409:               "#fetch-behind-firewall">6.8. How to fetch files from
        !          1410:               behind a firewall</a></span></dt>
1.1       grant    1411: 
1.30    ! wiz      1412:               <dt><span class="sect1"><a href="#passive-ftp">6.9.
        !          1413:               How do I tell <span><strong class="command">make
1.14      xtraeme  1414:               fetch</strong></span> to do passive
1.1       grant    1415:               FTP?</a></span></dt>
                   1416: 
1.30    ! wiz      1417:               <dt><span class="sect1"><a href=
        !          1418:               "#fetching-all-distfiles">6.10. How to fetch all
        !          1419:               distfiles at once</a></span></dt>
1.1       grant    1420: 
1.30    ! wiz      1421:               <dt><span class="sect1"><a href=
        !          1422:               "#tmac.andoc-missing">6.11. What does
        !          1423:               &#8220;<span class="quote">Don't know how to make
        !          1424:               /usr/share/tmac/tmac.andoc</span>&#8221;
1.14      xtraeme  1425:               mean?</a></span></dt>
1.13      hubertf  1426: 
1.30    ! wiz      1427:               <dt><span class="sect1"><a href=
        !          1428:               "#bsd.own.mk-missing">6.12. What does
        !          1429:               &#8220;<span class="quote">Could not find
1.14      xtraeme  1430:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1431: 
1.30    ! wiz      1432:               <dt><span class="sect1"><a href=
        !          1433:               "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
        !          1434:               pkgsrc</a></span></dt>
1.1       grant    1435: 
1.14      xtraeme  1436:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1437:               Configuration files handling and
                   1438:               placement</a></span></dt>
                   1439: 
                   1440:               <dt><span class="sect1"><a href=
1.14      xtraeme  1441:               "#audit-packages">6.15. Automated security
1.1       grant    1442:               checks</a></span></dt>
                   1443:             </dl>
                   1444:           </dd>
                   1445:         </dl>
                   1446:       </div>
                   1447: 
                   1448:       <div class="chapter" lang="en" xml:lang="en">
                   1449:         <div class="titlepage">
                   1450:           <div>
                   1451:             <div>
                   1452:               <h2 class="title"><a name="getting" id=
                   1453:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1454:               pkgsrc</h2>
                   1455:             </div>
                   1456:           </div>
                   1457:         </div>
                   1458: 
                   1459:         <div class="toc">
                   1460:           <p><b>Table of Contents</b></p>
                   1461: 
                   1462:           <dl>
1.30    ! wiz      1463:             <dt><span class="sect1"><a href="#as-tar-file">2.1. As
1.1       grant    1464:             tar file</a></span></dt>
                   1465: 
1.30    ! wiz      1466:             <dt><span class="sect1"><a href="#via-sup">2.2. Via
1.1       grant    1467:             SUP</a></span></dt>
                   1468: 
1.30    ! wiz      1469:             <dt><span class="sect1"><a href="#via-cvs">2.3. Via
1.1       grant    1470:             CVS</a></span></dt>
                   1471:           </dl>
                   1472:         </div>
                   1473: 
                   1474:         <p>There are three ways to get pkgsrc. Either as a tar
                   1475:         file, via SUP, or via CVS. All three ways are described
                   1476:         here.</p>
                   1477: 
                   1478:         <div class="sect1" lang="en" xml:lang="en">
                   1479:           <div class="titlepage">
                   1480:             <div>
                   1481:               <div>
                   1482:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      1483:                 "as-tar-file" id="as-tar-file"></a>2.1.&nbsp;As tar
1.1       grant    1484:                 file</h2>
                   1485:               </div>
                   1486:             </div>
                   1487:           </div>
                   1488: 
                   1489:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1490:           file from <a href=
1.11      ben      1491:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1492:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1493:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1494:         </div>
                   1495: 
                   1496:         <div class="sect1" lang="en" xml:lang="en">
                   1497:           <div class="titlepage">
                   1498:             <div>
                   1499:               <div>
                   1500:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      1501:                 "via-sup" id="via-sup"></a>2.2.&nbsp;Via SUP</h2>
1.1       grant    1502:               </div>
                   1503:             </div>
                   1504:           </div>
                   1505: 
                   1506:           <p>As an alternative to the tar file, you can get pkgsrc
                   1507:           via the Software Update Protocol, SUP. To do so, make
                   1508:           sure your supfile has a line</p>
                   1509:           <pre class="programlisting">
                   1510: release=pkgsrc
                   1511: </pre>
                   1512: 
1.14      xtraeme  1513:           <p>in it, see the examples in <code class=
                   1514:           "filename">/usr/share/examples/supfiles</code>, and that
                   1515:           the <code class="filename">/usr/pkgsrc</code> directory
                   1516:           exists. Then, simply run <span><strong class=
                   1517:           "command">sup -v <em class=
                   1518:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1519:         </div>
                   1520: 
                   1521:         <div class="sect1" lang="en" xml:lang="en">
                   1522:           <div class="titlepage">
                   1523:             <div>
                   1524:               <div>
                   1525:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      1526:                 "via-cvs" id="via-cvs"></a>2.3.&nbsp;Via CVS</h2>
1.1       grant    1527:               </div>
                   1528:             </div>
                   1529:           </div>
                   1530: 
                   1531:           <p>To get pkgsrc via CVS, make sure you have
                   1532:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27      rillig   1533:           To do an initial (full) checkout of pkgsrc, do the
                   1534:           following steps:</p>
1.1       grant    1535:           <pre class="screen">
1.14      xtraeme  1536: <code class="prompt">%</code> <strong class=
                   1537: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1538: <code class="prompt">%</code> <strong class=
                   1539: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1540: <code class="prompt">%</code> <strong class=
                   1541: "userinput"><code>cd /usr</code></strong>
                   1542: <code class="prompt">%</code> <strong class=
                   1543: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1544: </pre>
                   1545: 
                   1546:           <p>This will create the <code class=
                   1547:           "filename">pkgsrc</code> directory in your <code class=
                   1548:           "filename">/usr</code>, and all the package source will
                   1549:           be stored under <code class=
                   1550:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1551:           initial checkout, make sure you have <code class=
                   1552:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1553:           <pre class="screen">
1.14      xtraeme  1554: <code class="prompt">%</code> <strong class=
                   1555: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1556: <code class="prompt">%</code> <strong class=
                   1557: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1558: </pre>
                   1559: 
                   1560:           <p>Please also note that it is possible to have multiple
                   1561:           copies of the pkgsrc hierarchy in use at any one time -
                   1562:           all work is done relatively within the pkgsrc tree.</p>
                   1563:         </div>
                   1564:       </div>
                   1565: 
                   1566:       <div class="chapter" lang="en" xml:lang="en">
                   1567:         <div class="titlepage">
                   1568:           <div>
                   1569:             <div>
                   1570:               <h2 class="title"><a name="platforms" id=
                   1571:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1572:               systems other than NetBSD</h2>
                   1573:             </div>
                   1574:           </div>
                   1575:         </div>
                   1576: 
                   1577:         <div class="toc">
                   1578:           <p><b>Table of Contents</b></p>
                   1579: 
                   1580:           <dl>
1.30    ! wiz      1581:             <dt><span class="sect1"><a href=
        !          1582:             "#bootstrapping-pkgsrc">3.1. Bootstrapping
        !          1583:             pkgsrc</a></span></dt>
1.1       grant    1584: 
1.30    ! wiz      1585:             <dt><span class="sect1"><a href=
        !          1586:             "#platform-specific-notes">3.2. Platform specific
        !          1587:             notes</a></span></dt>
1.1       grant    1588: 
                   1589:             <dd>
                   1590:               <dl>
1.30    ! wiz      1591:                 <dt><span class="sect2"><a href="#darwin">3.2.1.
1.1       grant    1592:                 Darwin (Mac OS X)</a></span></dt>
                   1593: 
1.30    ! wiz      1594:                 <dt><span class="sect2"><a href="#freebsd">3.2.2.
1.1       grant    1595:                 FreeBSD</a></span></dt>
                   1596: 
1.30    ! wiz      1597:                 <dt><span class="sect2"><a href="#interix">3.2.3.
1.1       grant    1598:                 Interix</a></span></dt>
                   1599: 
1.30    ! wiz      1600:                 <dt><span class="sect2"><a href="#irix">3.2.4.
1.1       grant    1601:                 IRIX</a></span></dt>
                   1602: 
1.30    ! wiz      1603:                 <dt><span class="sect2"><a href="#linux">3.2.5.
1.22      tv       1604:                 Linux</a></span></dt>
                   1605: 
1.30    ! wiz      1606:                 <dt><span class="sect2"><a href="#openbsd">3.2.6.
1.1       grant    1607:                 OpenBSD</a></span></dt>
                   1608: 
1.30    ! wiz      1609:                 <dt><span class="sect2"><a href="#solaris">3.2.7.
1.1       grant    1610:                 Solaris</a></span></dt>
                   1611:               </dl>
                   1612:             </dd>
                   1613:           </dl>
                   1614:         </div>
                   1615: 
                   1616:         <div class="sect1" lang="en" xml:lang="en">
                   1617:           <div class="titlepage">
                   1618:             <div>
                   1619:               <div>
                   1620:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      1621:                 "bootstrapping-pkgsrc" id=
        !          1622:                 "bootstrapping-pkgsrc"></a>3.1.&nbsp;Bootstrapping
        !          1623:                 pkgsrc</h2>
1.1       grant    1624:               </div>
                   1625:             </div>
                   1626:           </div>
                   1627: 
1.27      rillig   1628:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1629:           bootstrap kit to build the required tools to use pkgsrc
                   1630:           on your platform. Besides support for native NetBSD,
                   1631:           pkgsrc and the bootstrap kit have support for the
                   1632:           following operating systems:</p>
                   1633: 
                   1634:           <div class="itemizedlist">
                   1635:             <ul type="disc">
                   1636:               <li>
                   1637:                 <p>Darwin (Mac OS X)</p>
                   1638:               </li>
                   1639: 
                   1640:               <li>
1.16      grant    1641:                 <p>DragonFlyBSD</p>
                   1642:               </li>
                   1643: 
                   1644:               <li>
1.1       grant    1645:                 <p>FreeBSD</p>
                   1646:               </li>
                   1647: 
                   1648:               <li>
                   1649:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1650:               </li>
                   1651: 
                   1652:               <li>
                   1653:                 <p>IRIX</p>
                   1654:               </li>
                   1655: 
                   1656:               <li>
                   1657:                 <p>Linux</p>
                   1658:               </li>
                   1659: 
                   1660:               <li>
                   1661:                 <p>OpenBSD</p>
                   1662:               </li>
                   1663: 
                   1664:               <li>
                   1665:                 <p>Solaris</p>
                   1666:               </li>
1.16      grant    1667: 
                   1668:               <li>
                   1669:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1670:               </li>
1.1       grant    1671:             </ul>
                   1672:           </div>
                   1673: 
                   1674:           <p>Support for other platforms is under development.</p>
                   1675: 
                   1676:           <p>Installing the bootstrap kit should be as simple
                   1677:           as:</p>
                   1678:           <pre class="screen">
1.14      xtraeme  1679: <code class="prompt">#</code> <strong class=
                   1680: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1681: <code class="prompt">#</code> <strong class=
                   1682: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1683: <code class="prompt">#</code> <strong class=
                   1684: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1685: </pre>
                   1686: 
                   1687:           <p>See <a href="#getting" title=
                   1688:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1689:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1690:           pkgsrc before bootstrapping. The given
                   1691:           <span><strong class="command">bootstrap</strong></span>
                   1692:           command will use the defaults of <code class=
                   1693:           "filename">/usr/pkg</code> for the <span class=
                   1694:           "emphasis"><em>prefix</em></span> where programs will be
                   1695:           installed in, and <code class=
                   1696:           "filename">/var/db/pkg</code> for the package database
1.27      rillig   1697:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1698:           However, these can also be set using command-line
1.27      rillig   1699:           arguments.</p>
1.1       grant    1700: 
                   1701:           <p>Binary packages for the pkgsrc tools and an initial
                   1702:           set of packages is available for supported platforms. An
                   1703:           up-to-date list of these can be found on <a href=
                   1704:           "http://www.pkgsrc.org/" target=
                   1705:           "_top">www.pkgsrc.org</a>.</p>
                   1706:         </div>
                   1707: 
                   1708:         <div class="sect1" lang="en" xml:lang="en">
                   1709:           <div class="titlepage">
                   1710:             <div>
                   1711:               <div>
                   1712:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      1713:                 "platform-specific-notes" id=
        !          1714:                 "platform-specific-notes"></a>3.2.&nbsp;Platform
1.1       grant    1715:                 specific notes</h2>
                   1716:               </div>
                   1717:             </div>
                   1718:           </div>
                   1719: 
                   1720:           <p>Here are some platform-specific notes you should be
                   1721:           aware of.</p>
                   1722: 
                   1723:           <div class="sect2" lang="en" xml:lang="en">
                   1724:             <div class="titlepage">
                   1725:               <div>
                   1726:                 <div>
1.30    ! wiz      1727:                   <h3 class="title"><a name="darwin" id=
        !          1728:                   "darwin"></a>3.2.1.&nbsp;Darwin (Mac OS X)</h3>
1.1       grant    1729:                 </div>
                   1730:               </div>
                   1731:             </div>
                   1732: 
                   1733:             <p>Darwin 5.x and 6.x are supported. There are two
                   1734:             methods of using pkgsrc on Mac OS X, by using a
                   1735:             <a href="#platform.osx-image" title=
                   1736:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1737:             <a href="#platform.osx-ufs" title=
                   1738:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1739:             partition</a>.</p>
                   1740: 
                   1741:             <p>Before you start, you will need to download and
                   1742:             install the Mac OS X Developer Tools from Apple's
                   1743:             Developer Connection. See <a href=
                   1744:             "http://developer.apple.com/macosx/" target=
                   1745:             "_top">http://developer.apple.com/macosx/</a> for
                   1746:             details. Also, make sure you install X11 for Mac OS X
                   1747:             and the X11 SDK from <a href=
                   1748:             "http://www.apple.com/macosx/x11/download/" target=
                   1749:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1750:             you intend to build packages that use the X11 Window
                   1751:             System.</p>
                   1752: 
                   1753:             <p>If you already have a UFS partition, or have a spare
                   1754:             partition that you can format as UFS, it is recommended
                   1755:             to use that instead of the disk image. It'll be
                   1756:             somewhat faster and will mount automatically at boot
                   1757:             time, where you must manually mount a disk image.</p>
                   1758: 
                   1759:             <div class="note" style=
                   1760:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1761:               <h3 class="title">Note</h3>
                   1762: 
                   1763:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1764:               because pkgsrc currently requires the filesystem to
                   1765:               be case-sensitive, and HFS+ is not.</p>
                   1766:             </div>
                   1767: 
                   1768:             <div class="sect3" lang="en" xml:lang="en">
                   1769:               <div class="titlepage">
                   1770:                 <div>
                   1771:                   <div>
                   1772:                     <h4 class="title"><a name="platform.osx-image"
                   1773:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1774:                     a disk image</h4>
                   1775:                   </div>
                   1776:                 </div>
                   1777:               </div>
                   1778: 
                   1779:               <p>Create the disk image:</p>
                   1780:               <pre class="screen">
1.14      xtraeme  1781: <code class="prompt">#</code> <strong class=
                   1782: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1783: <code class="prompt">#</code> <strong class=
                   1784: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1785: <code class="prompt">#</code> <strong class=
                   1786: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1787: <code class="prompt">#</code> <strong class=
                   1788: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1789: </pre>
                   1790: 
                   1791:               <p>That's it!</p>
                   1792:             </div>
                   1793: 
                   1794:             <div class="sect3" lang="en" xml:lang="en">
                   1795:               <div class="titlepage">
                   1796:                 <div>
                   1797:                   <div>
                   1798:                     <h4 class="title"><a name="platform.osx-ufs"
                   1799:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1800:                     UFS partition</h4>
                   1801:                   </div>
                   1802:                 </div>
                   1803:               </div>
                   1804: 
1.14      xtraeme  1805:               <p>By default, <code class="filename">/usr</code>
                   1806:               will be on your root file system, normally HFS+. It
                   1807:               is possible to use the default <span class=
                   1808:               "emphasis"><em>prefix</em></span> of <code class=
                   1809:               "filename">/usr/pkg</code> by symlinking <code class=
                   1810:               "filename">/usr/pkg</code> to a directory on a UFS
                   1811:               file system. Obviously, another symlink is required
                   1812:               if you want to place the package database directory
                   1813:               outside the <span class=
                   1814:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1815:               <pre class="screen">
1.14      xtraeme  1816: <code class="prompt">#</code> <strong class=
1.22      tv       1817: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1818: </pre>
                   1819: 
                   1820:               <p>If you created your partitions at the time of
                   1821:               installing Mac OS X and formatted the target
                   1822:               partition as UFS, it should automatically mount on
1.14      xtraeme  1823:               <code class="filename">/Volumes/&lt;volume
                   1824:               name&gt;</code> when the machine boots. If you are
1.1       grant    1825:               (re)formatting a partition as UFS, you need to ensure
                   1826:               that the partition map correctly reflects
                   1827:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1828:               and not &#8220;<span class=
                   1829:               "quote">Apple_HFS</span>&#8221;.</p>
                   1830: 
                   1831:               <p>The problem is that none of the disk tools will
                   1832:               let you touch a disk that is booted from. You can
                   1833:               unmount the partition, but even if you newfs it, the
                   1834:               partition type will be incorrect and the automounter
                   1835:               won't mount it. It can be mounted manually, but it
                   1836:               won't appear in Finder.</p>
                   1837: 
                   1838:               <p>You'll need to boot off of the OS X Installation
                   1839:               (User) CD. When the Installation program starts, go
                   1840:               up to the menu and select Disk Utility. Now, you will
                   1841:               be able to select the partition you want to be UFS,
                   1842:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1843:               the installer which will reboot your machine. The new
                   1844:               UFS file system will appear in Finder.</p>
                   1845: 
                   1846:               <p>Be aware that the permissions on the new file
                   1847:               system will be writable by root only.</p>
                   1848: 
                   1849:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1850:               earlier versions. Hopefully Apple will fix Disk
                   1851:               Utility in 10.3 (Panther).</p>
                   1852:             </div>
                   1853:           </div>
                   1854: 
                   1855:           <div class="sect2" lang="en" xml:lang="en">
                   1856:             <div class="titlepage">
                   1857:               <div>
                   1858:                 <div>
1.30    ! wiz      1859:                   <h3 class="title"><a name="freebsd" id=
        !          1860:                   "freebsd"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1861:                 </div>
                   1862:               </div>
                   1863:             </div>
                   1864: 
                   1865:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1866:             supported, other versions may work.</p>
                   1867: 
                   1868:             <p>Care should be taken so that the tools that this kit
                   1869:             installs do not conflict with the FreeBSD userland
                   1870:             tools. There are several steps:</p>
                   1871: 
                   1872:             <div class="orderedlist">
                   1873:               <ol type="1">
                   1874:                 <li>
                   1875:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1876:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1877:                   therefore recommended that you choose a different
1.14      xtraeme  1878:                   location (e.g. <code class=
                   1879:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1880:                   --pkgdbdir option to the bootstrap script.</p>
                   1881:                 </li>
                   1882: 
                   1883:                 <li>
                   1884:                   <p>If you do not intend to use the FreeBSD ports
                   1885:                   tools, it's probably a good idea to move them out
                   1886:                   of the way to avoid confusion, e.g.</p>
                   1887:                   <pre class="screen">
1.14      xtraeme  1888: <code class="prompt">#</code> <strong class=
                   1889: "userinput"><code>cd /usr/sbin</code></strong>
                   1890: <code class="prompt">#</code> <strong class=
                   1891: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1892: <code class="prompt">#</code> <strong class=
                   1893: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1894: <code class="prompt">#</code> <strong class=
                   1895: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1896: <code class="prompt">#</code> <strong class=
                   1897: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1898: </pre>
                   1899:                 </li>
                   1900: 
                   1901:                 <li>
1.14      xtraeme  1902:                   <p>An example <code class=
                   1903:                   "filename">/etc/mk.conf</code> file will be
                   1904:                   placed in <code class=
                   1905:                   "filename">/etc/mk.conf.example</code> file when
                   1906:                   you use the bootstrap script.</p>
1.1       grant    1907:                 </li>
                   1908:               </ol>
                   1909:             </div>
                   1910:           </div>
                   1911: 
                   1912:           <div class="sect2" lang="en" xml:lang="en">
                   1913:             <div class="titlepage">
                   1914:               <div>
                   1915:                 <div>
1.30    ! wiz      1916:                   <h3 class="title"><a name="interix" id=
        !          1917:                   "interix"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1918:                 </div>
                   1919:               </div>
                   1920:             </div>
                   1921: 
                   1922:             <p>Interix is a POSIX compatible subsystem for the
                   1923:             Windows NT kernel, providing a Unix-like environment
                   1924:             with a tighter kernel integration than available with
                   1925:             Cygwin. It is part of the Windows Services for Unix
                   1926:             package, available for free for any licensed copy of
1.22      tv       1927:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   1928:             can be downloaded from <a href=
                   1929:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    1930:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1931: 
                   1932:             <p>Services for Unix 3.5, current as of this writing,
                   1933:             has been tested. 3.0 or 3.1 may work, but are not
                   1934:             officially supported. (The main difference in 3.0/3.1
                   1935:             is lack of pthreads.)</p>
                   1936: 
                   1937:             <div class="sect3" lang="en" xml:lang="en">
                   1938:               <div class="titlepage">
                   1939:                 <div>
                   1940:                   <div>
                   1941:                     <h4 class="title"><a name=
                   1942:                     "platform.interix-sfu-install" id=
                   1943:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1944:                     installing Interix/SFU</h4>
1.1       grant    1945:                   </div>
                   1946:                 </div>
                   1947:               </div>
                   1948: 
                   1949:               <p>At an absolute minimum, the following packages
                   1950:               must be installed from the Windows Services for Unix
                   1951:               3.5 distribution in order to use pkgsrc:</p>
                   1952: 
                   1953:               <div class="itemizedlist">
                   1954:                 <ul type="disc">
                   1955:                   <li>
                   1956:                     <p>Utilities -&gt; Base Utilities</p>
                   1957:                   </li>
                   1958: 
                   1959:                   <li>
                   1960:                     <p>Interix GNU Components -&gt; (all)</p>
                   1961:                   </li>
                   1962: 
                   1963:                   <li>
                   1964:                     <p>Remote Connectivity</p>
                   1965:                   </li>
                   1966: 
                   1967:                   <li>
                   1968:                     <p>Interix SDK</p>
                   1969:                   </li>
                   1970:                 </ul>
                   1971:               </div>
                   1972: 
                   1973:               <p>When using pkgsrc on Interix, DO NOT install the
                   1974:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1975:               without shared module support, installed to
                   1976:               /usr/local, and will only cause confusion. Instead,
                   1977:               install Perl 5.8 from pkgsrc (or from a binary
                   1978:               package).</p>
                   1979: 
                   1980:               <p>The Remote Connectivity subcomponent "Windows
                   1981:               Remote Shell Service" does not need to be installed,
                   1982:               but Remote Connectivity itself should be installed in
                   1983:               order to have a working inetd.</p>
                   1984: 
                   1985:               <p>Finally, during installation you may be asked
                   1986:               whether to enable setuid behavior for Interix
                   1987:               programs, and whether to make pathnames default to
                   1988:               case-sensitive. Setuid should be enabled, and
                   1989:               case-sensitivity MUST be enabled. (Without
                   1990:               case-sensitivity, a large number of packages
                   1991:               including perl will not build.)</p>
                   1992:             </div>
                   1993: 
                   1994:             <div class="sect3" lang="en" xml:lang="en">
                   1995:               <div class="titlepage">
                   1996:                 <div>
                   1997:                   <div>
                   1998:                     <h4 class="title"><a name=
                   1999:                     "platform.interix-sfu-postinstall" id=
                   2000:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   2001:                     to do if Interix/SFU is already installed</h4>
                   2002:                   </div>
                   2003:                 </div>
                   2004:               </div>
                   2005: 
                   2006:               <p>If SFU is already installed and you wish to alter
                   2007:               these settings to work with pkgsrc, note the
                   2008:               following things.</p>
                   2009: 
                   2010:               <div class="itemizedlist">
                   2011:                 <ul type="disc">
                   2012:                   <li>
                   2013:                     <p>To uninstall UNIX Perl, use Add/Remove
                   2014:                     Programs, select Microsoft Windows Services for
                   2015:                     UNIX, then click Change. In the installer,
                   2016:                     choose Add or Remove, then uncheck
                   2017:                     Utilities-&gt;UNIX Perl.</p>
                   2018:                   </li>
                   2019: 
                   2020:                   <li>
                   2021:                     <p>To enable case-sensitivity for the
                   2022:                     filesystem, run REGEDIT.EXE, and change the
                   2023:                     following registry key:</p>
                   2024: 
                   2025:                     <p>
                   2026:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   2027:                     Manager\kernel</p>
                   2028: 
                   2029:                     <p>Set the DWORD value "obcaseinsensitive" to
                   2030:                     0; then reboot.</p>
                   2031:                   </li>
                   2032: 
                   2033:                   <li>
                   2034:                     <p>To enable setuid binaries (optional), run
                   2035:                     REGEDIT.EXE, and change the following registry
                   2036:                     key:</p>
                   2037: 
                   2038:                     <p>
                   2039:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   2040:                     for UNIX</p>
                   2041: 
                   2042:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   2043:                     to 1; then reboot.</p>
                   2044:                   </li>
                   2045:                 </ul>
                   2046:               </div>
                   2047:             </div>
                   2048: 
                   2049:             <div class="sect3" lang="en" xml:lang="en">
                   2050:               <div class="titlepage">
                   2051:                 <div>
                   2052:                   <div>
                   2053:                     <h4 class="title"><a name=
                   2054:                     "platform.interix-notes" id=
                   2055:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2056:                     notes for using pkgsrc</h4>
                   2057:                   </div>
                   2058:                 </div>
                   2059:               </div>
                   2060: 
                   2061:               <p>The package imanager (either the pkgsrc "su" user,
                   2062:               or the user running "pkg_add") must be a member of
                   2063:               the local Administrators group. Such a user must also
                   2064:               be used to run the bootstrap. This is slightly
                   2065:               relaxed from the normal pkgsrc requirement of
                   2066:               "root".</p>
                   2067: 
                   2068:               <p>The package manager should use a umask of 002.
                   2069:               "make install" will automatically complain if this is
                   2070:               not the case. This ensures that directories written
                   2071:               in /var/db/pkg are Administrators-group
                   2072:               writeable.</p>
                   2073: 
                   2074:               <p>The popular Interix binary packages from
                   2075:               http://www.interopsystems.com/ use an older version
                   2076:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2077:               used in conjunction with pkgsrc. If you choose to use
                   2078:               them at the same time as the pkgsrc packages, ensure
                   2079:               that you use the proper pkg_* tools for each type of
                   2080:               binary package.</p>
1.22      tv       2081: 
                   2082:               <p>The TERM setting used for DOS-type console windows
                   2083:               (including those invoked by the csh and ksh startup
                   2084:               shortcuts) is "interix". Most systems don't have a
                   2085:               termcap/terminfo entry for it, but the following
                   2086:               .termcap entry provides adequate emulation in most
                   2087:               cases:</p>
                   2088:               <pre class="programlisting">
                   2089: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   2090: </pre>
1.1       grant    2091:             </div>
                   2092:           </div>
                   2093: 
                   2094:           <div class="sect2" lang="en" xml:lang="en">
                   2095:             <div class="titlepage">
                   2096:               <div>
                   2097:                 <div>
1.30    ! wiz      2098:                   <h3 class="title"><a name="irix" id=
        !          2099:                   "irix"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2100:                 </div>
                   2101:               </div>
                   2102:             </div>
                   2103: 
                   2104:             <p>You will need a working C compiler, either gcc or
                   2105:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2106:             the <code class="varname">CC</code> environment
                   2107:             variable according to your preference. If you do not
                   2108:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2109:             download a gcc tardist file from <a href=
                   2110:             "http://freeware.sgi.com/" target=
                   2111:             "_top">http://freeware.sgi.com/</a>.</p>
                   2112: 
                   2113:             <p>Please note that you will need IRIX 6.5.17 or
                   2114:             higher, as this is the earliest version of IRIX
1.24      wiz      2115:             providing support for <a href=
                   2116:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2117:             <span class="citerefentry"><span class=
                   2118:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2119:             <a href=
                   2120:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2121:             <span class="citerefentry"><span class=
                   2122:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2123:             etc.</p>
1.1       grant    2124: 
1.27      rillig   2125:             <p>At this point in time, pkgsrc only supports one ABI
                   2126:             at a time. That is, you can not switch between the old
                   2127:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
                   2128:             you start out using "abi=n32", that's what all your
                   2129:             packages will be built with.</p>
1.1       grant    2130: 
                   2131:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2132:             conflicting <code class="varname">CFLAGS</code> in your
                   2133:             environment or the <code class=
                   2134:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2135:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2136:             or vice versa. Check your <code class=
                   2137:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2138: 
                   2139:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2140:             from a different host, please make sure to set
1.14      xtraeme  2141:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2142:             directory, as it appears that IRIX linker occasionally
                   2143:             runs into issues when trying to link over a network
                   2144:             mounted filesystem.</p>
                   2145: 
                   2146:             <p>The bootstrapping process should set all the right
                   2147:             options for programs such as imake(1), but you may want
                   2148:             to set some options depending on your local setup.
1.14      xtraeme  2149:             Please see <code class=
                   2150:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27      rillig   2151:             course, your compiler's man pages for details.</p>
1.22      tv       2152: 
                   2153:             <p>If you are using SGI's MIPSPro compiler, please
                   2154:             set</p>
                   2155:             <pre class="programlisting">
                   2156: PKGSRC_COMPILER=mipspro
                   2157: </pre>
                   2158: 
                   2159:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2160:             Otherwise, pkgsrc will assume you are using gcc and may
                   2161:             end up passing invalid flags to the compiler. Note that
                   2162:             bootstrap should create an appropriate <code class=
                   2163:             "filename">mk.conf.example</code> by default.</p>
                   2164: 
                   2165:             <p>If you have both the MIPSPro compiler chain
                   2166:             installed as well as gcc, but want to make sure that
                   2167:             MIPRPro is used, please set your <code class=
                   2168:             "varname">PATH</code> to <span class=
                   2169:             "emphasis"><em>not</em></span> include the location of
                   2170:             gcc (often <code class=
                   2171:             "filename">/usr/freeware/bin</code>), and (important)
                   2172:             pass the '--preserve-path' flag.</p>
1.1       grant    2173:           </div>
                   2174: 
                   2175:           <div class="sect2" lang="en" xml:lang="en">
                   2176:             <div class="titlepage">
                   2177:               <div>
                   2178:                 <div>
1.30    ! wiz      2179:                   <h3 class="title"><a name="linux" id=
        !          2180:                   "linux"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2181:                 </div>
                   2182:               </div>
                   2183:             </div>
                   2184: 
                   2185:             <p>Some versions of Linux (for example Debian
                   2186:             GNU/Linux) need either libtermcap or libcurses
                   2187:             (libncurses). Installing the distributions
                   2188:             libncurses-dev package (or equivalent) should fix the
                   2189:             problem.</p>
                   2190: 
                   2191:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2192:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2193:             8.0 and 8.1 on i386 have been tested.</p>
                   2194: 
                   2195:             <p>To bootstrap using icc, assuming the default icc
                   2196:             installation directory:</p>
                   2197:             <pre class="programlisting">
                   2198: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2199:                 ac_cv___attribute__=yes ./bootstrap
                   2200: </pre>
                   2201: 
                   2202:             <div class="note" style=
                   2203:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2204:               <h3 class="title">Note</h3>
                   2205: 
                   2206:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2207:               -static-libcxa.</p>
                   2208:             </div>
                   2209: 
                   2210:             <p>icc supports __attribute__, but the GNU configure
                   2211:             test uses a nested function, which icc does not
                   2212:             support. #undef'ing __attribute__ has the unfortunate
                   2213:             side-effect of breaking many of the Linux header files,
                   2214:             which cannot be compiled properly without
                   2215:             __attribute__. The test must be overridden so that
                   2216:             __attribute__ is assumed supported by the compiler.</p>
                   2217: 
                   2218:             <p>After bootstrapping, you should set <code class=
                   2219:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2220:             "filename">/etc/mk.conf</code>:</p>
                   2221:             <pre class="programlisting">
                   2222: PKGSRC_COMPILER=icc
                   2223: </pre>
                   2224: 
                   2225:             <p>The default installation directory for icc is
                   2226:             <code class="filename">/opt/intel_cc_80</code>, which
                   2227:             is also the pkgsrc default. If you have installed it
                   2228:             into a different directory, set <code class=
                   2229:             "varname">ICCBASE</code> in <code class=
                   2230:             "filename">/etc/mk.conf</code>:</p>
                   2231:             <pre class="programlisting">
                   2232: ICCBASE=/opt/icc
                   2233: </pre>
                   2234: 
                   2235:             <p>pkgsrc uses the static linking method of the runtime
                   2236:             libraries provided by icc, so binaries can be run on
                   2237:             other systems which do not have the shared libraries
                   2238:             installed.</p>
                   2239: 
                   2240:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2241:             the <a href=
                   2242:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2243:             <span class="citerefentry"><span class=
                   2244:             "refentrytitle">ld</span>(1)</span></a> command run
                   2245:             when linking a C++ shared library and records it,
                   2246:             throwing away the -Bstatic and -Bdynamic options
                   2247:             interspersed between the libraries. This means that
                   2248:             libtool-linked C++ shared libraries will have a runtime
                   2249:             dependency on the icc libraries until this is fixed in
                   2250:             libtool.</p>
1.22      tv       2251:           </div>
                   2252: 
                   2253:           <div class="sect2" lang="en" xml:lang="en">
                   2254:             <div class="titlepage">
                   2255:               <div>
                   2256:                 <div>
1.30    ! wiz      2257:                   <h3 class="title"><a name="openbsd" id=
        !          2258:                   "openbsd"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2259:                 </div>
                   2260:               </div>
                   2261:             </div>
                   2262: 
                   2263:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2264: 
                   2265:             <p>Care should be taken so that the tools that this kit
                   2266:             installs do not conflict with the OpenBSD userland
                   2267:             tools. There are several steps:</p>
                   2268: 
                   2269:             <div class="orderedlist">
                   2270:               <ol type="1">
                   2271:                 <li>
                   2272:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2273:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2274:                   therefore recommended that you choose a different
1.14      xtraeme  2275:                   location (e.g. <code class=
                   2276:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2277:                   --pkgdbdir option to the bootstrap script.</p>
                   2278:                 </li>
                   2279: 
                   2280:                 <li>
                   2281:                   <p>If you do not intend to use the OpenBSD ports
                   2282:                   tools, it's probably a good idea to move them out
                   2283:                   of the way to avoid confusion, e.g.</p>
                   2284:                   <pre class="screen">
1.14      xtraeme  2285: <code class="prompt">#</code> <strong class=
                   2286: "userinput"><code>cd /usr/sbin</code></strong>
                   2287: <code class="prompt">#</code> <strong class=
                   2288: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2289: <code class="prompt">#</code> <strong class=
                   2290: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2291: <code class="prompt">#</code> <strong class=
                   2292: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2293: <code class="prompt">#</code> <strong class=
                   2294: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2295: </pre>
                   2296:                 </li>
                   2297: 
                   2298:                 <li>
1.14      xtraeme  2299:                   <p>An example <code class=
                   2300:                   "filename">/etc/mk.conf</code> file will be
                   2301:                   placed in <code class=
                   2302:                   "filename">/etc/mk.conf.example</code> file when
                   2303:                   you use the bootstrap script. OpenBSD's make
                   2304:                   program uses <code class=
                   2305:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2306:                   work around this by enclosing all the pkgsrc
                   2307:                   specific parts of the file with:</p>
                   2308:                   <pre class="programlisting">
                   2309: .ifdef BSD_PKG_MK
1.11      ben      2310: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2311: .else
                   2312: # OpenBSD stuff
                   2313: .endif
                   2314: </pre>
                   2315:                 </li>
                   2316:               </ol>
                   2317:             </div>
                   2318:           </div>
                   2319: 
                   2320:           <div class="sect2" lang="en" xml:lang="en">
                   2321:             <div class="titlepage">
                   2322:               <div>
                   2323:                 <div>
1.30    ! wiz      2324:                   <h3 class="title"><a name="solaris" id=
        !          2325:                   "solaris"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2326:                 </div>
                   2327:               </div>
                   2328:             </div>
                   2329: 
                   2330:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2331:             sparc. You will need a working C compiler. Both gcc
                   2332:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2333: 
                   2334:             <p>The following packages are required on Solaris 8 for
                   2335:             the bootstrap process and to build packages.</p>
                   2336: 
                   2337:             <div class="itemizedlist">
                   2338:               <ul type="disc">
                   2339:                 <li>
                   2340:                   <p>SUNWsprot</p>
                   2341:                 </li>
                   2342: 
                   2343:                 <li>
                   2344:                   <p>SUNWarc</p>
                   2345:                 </li>
                   2346: 
                   2347:                 <li>
                   2348:                   <p>SUNWbtool</p>
                   2349:                 </li>
                   2350: 
                   2351:                 <li>
                   2352:                   <p>SUNWtoo</p>
                   2353:                 </li>
                   2354: 
                   2355:                 <li>
                   2356:                   <p>SUNWlibm</p>
                   2357:                 </li>
                   2358:               </ul>
                   2359:             </div>
                   2360: 
                   2361:             <p>Please note the use of GNU binutils on Solaris is
                   2362:             <span class="emphasis"><em>not</em></span>
                   2363:             supported.</p>
                   2364: 
                   2365:             <div class="sect3" lang="en" xml:lang="en">
                   2366:               <div class="titlepage">
                   2367:                 <div>
                   2368:                   <div>
1.30    ! wiz      2369:                     <h4 class="title"><a name="solaris-gcc-note"
        !          2370:                     id="solaris-gcc-note"></a>3.2.7.1.&nbsp;If you
        !          2371:                     are using gcc</h4>
1.1       grant    2372:                   </div>
                   2373:                 </div>
                   2374:               </div>
                   2375: 
                   2376:               <p>It makes life much simpler if you only use the
                   2377:               same gcc consistently for building all packages.</p>
                   2378: 
                   2379:               <p>It is recommended that an external gcc be used
                   2380:               only for bootstrapping, then either build gcc from
                   2381:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2382:               href=
                   2383:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2384:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2385:               package, then remove gcc used during
                   2386:               bootstrapping.</p>
1.1       grant    2387: 
                   2388:               <p>Binary packages of gcc can be found through
                   2389:               <a href=
                   2390:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2391:               target=
                   2392:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2393:             </div>
                   2394: 
                   2395:             <div class="sect3" lang="en" xml:lang="en">
                   2396:               <div class="titlepage">
                   2397:                 <div>
                   2398:                   <div>
1.30    ! wiz      2399:                     <h4 class="title"><a name=
        !          2400:                     "solaris-sun-workshop-note" id=
        !          2401:                     "solaris-sun-workshop-note"></a>3.2.7.2.&nbsp;If
        !          2402:                     you are using Sun WorkShop</h4>
1.1       grant    2403:                   </div>
                   2404:                 </div>
                   2405:               </div>
                   2406: 
                   2407:               <p>You will need at least the following packages
                   2408:               installed (from WorkShop 5.0)</p>
                   2409: 
                   2410:               <div class="itemizedlist">
                   2411:                 <ul type="disc">
                   2412:                   <li>
                   2413:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2414:                   </li>
                   2415: 
                   2416:                   <li>
                   2417:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2418:                   </li>
                   2419: 
                   2420:                   <li>
                   2421:                     <p>SPROild - Sun WorkShop Incremental
                   2422:                     Linker</p>
                   2423:                   </li>
                   2424: 
                   2425:                   <li>
                   2426:                     <p>SPROlang - Sun WorkShop Compilers common
                   2427:                     components</p>
                   2428:                   </li>
                   2429:                 </ul>
                   2430:               </div>
                   2431: 
1.14      xtraeme  2432:               <p>You should set <code class="varname">CC</code>,
                   2433:               <code class="varname">CXX</code> and optionally,
                   2434:               <code class="varname">CPP</code> in <code class=
                   2435:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2436:               <pre class="programlisting">
1.27      rillig   2437: CC=     cc
1.1       grant    2438: CXX=    CC
                   2439: CPP=    /usr/ccs/lib/cpp
                   2440: </pre>
                   2441: 
                   2442:               <p>You may also want to build 64-bit binaries,
                   2443:               eg.</p>
                   2444:               <pre class="programlisting">
                   2445: CFLAGS= -xtarget=ultra -xarch=v9
                   2446: </pre>
                   2447: 
                   2448:               <p>Whichever compiler you use, please ensure the
                   2449:               compiler tools and your $prefix are in your
1.14      xtraeme  2450:               <code class="varname">PATH</code>. This includes
                   2451:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2452:               eg. <code class=
                   2453:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2454:             </div>
                   2455:           </div>
                   2456:         </div>
                   2457:       </div>
                   2458: 
                   2459:       <div class="chapter" lang="en" xml:lang="en">
                   2460:         <div class="titlepage">
                   2461:           <div>
                   2462:             <div>
                   2463:               <h2 class="title"><a name="using" id=
                   2464:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2465:             </div>
                   2466:           </div>
                   2467:         </div>
                   2468: 
                   2469:         <div class="toc">
                   2470:           <p><b>Table of Contents</b></p>
                   2471: 
                   2472:           <dl>
                   2473:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2474:             Working with binary packages</a></span></dt>
                   2475: 
                   2476:             <dd>
                   2477:               <dl>
1.30    ! wiz      2478:                 <dt><span class="sect2"><a href=
        !          2479:                 "#where-to-get-binary-packages">4.1.1. Where to get
        !          2480:                 binary packages</a></span></dt>
1.1       grant    2481: 
1.30    ! wiz      2482:                 <dt><span class="sect2"><a href=
        !          2483:                 "#how-to-use-binary-packages">4.1.2. How to use
        !          2484:                 binary packages</a></span></dt>
1.1       grant    2485: 
1.30    ! wiz      2486:                 <dt><span class="sect2"><a href=
        !          2487:                 "#a-word-of-warning">4.1.3. A word of
        !          2488:                 warning</a></span></dt>
1.1       grant    2489:               </dl>
                   2490:             </dd>
                   2491: 
1.30    ! wiz      2492:             <dt><span class="sect1"><a href=
        !          2493:             "#building-packages-from-source">4.2. Building packages
        !          2494:             from source</a></span></dt>
1.1       grant    2495: 
                   2496:             <dd>
                   2497:               <dl>
1.30    ! wiz      2498:                 <dt><span class="sect2"><a href=
        !          2499:                 "#requirements">4.2.1. Requirements</a></span></dt>
1.1       grant    2500: 
1.30    ! wiz      2501:                 <dt><span class="sect2"><a href=
        !          2502:                 "#fetching-distfiles">4.2.2. Fetching
        !          2503:                 distfiles</a></span></dt>
1.1       grant    2504: 
1.30    ! wiz      2505:                 <dt><span class="sect2"><a href=
        !          2506:                 "#how-to-build-and-install">4.2.3. How to build and
        !          2507:                 install</a></span></dt>
1.1       grant    2508: 
1.30    ! wiz      2509:                 <dt><span class="sect2"><a href=
        !          2510:                 "#selecting-the-compiler">4.2.4. Selecting the
        !          2511:                 compiler</a></span></dt>
1.1       grant    2512:               </dl>
                   2513:             </dd>
                   2514:           </dl>
                   2515:         </div>
                   2516: 
                   2517:         <div class="sect1" lang="en" xml:lang="en">
                   2518:           <div class="titlepage">
                   2519:             <div>
                   2520:               <div>
                   2521:                 <h2 class="title" style="clear: both"><a name=
                   2522:                 "getting-started" id=
                   2523:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2524:                 packages</h2>
                   2525:               </div>
                   2526:             </div>
                   2527:           </div>
                   2528: 
                   2529:           <p>This section describes how to find, retrieve and
                   2530:           install a precompiled binary package that someone else
                   2531:           already prepared for your type of machine.</p>
                   2532: 
                   2533:           <div class="sect2" lang="en" xml:lang="en">
                   2534:             <div class="titlepage">
                   2535:               <div>
                   2536:                 <div>
1.30    ! wiz      2537:                   <h3 class="title"><a name=
        !          2538:                   "where-to-get-binary-packages" id=
        !          2539:                   "where-to-get-binary-packages"></a>4.1.1.&nbsp;Where
        !          2540:                   to get binary packages</h3>
1.1       grant    2541:                 </div>
                   2542:               </div>
                   2543:             </div>
                   2544: 
                   2545:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2546:             and its mirrors in the directory <code class=
1.27      rillig   2547:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
                   2548:             for anonymous FTP access. <code class=
                   2549:             "varname">OSVERSION</code> is the NetBSD version
                   2550:             (<span><strong class="command">uname
                   2551:             -r</strong></span>), <code class="varname">ARCH</code>
                   2552:             is the architecture (<span><strong class=
                   2553:             "command">uname -p</strong></span>). In that directory,
                   2554:             there is a subdirectory for each category plus a
                   2555:             subdirectory <code class="filename">All</code> which
                   2556:             includes the actual binaries in <code class=
                   2557:             "filename">.tgz</code> files. The category
                   2558:             subdirectories use symbolic links to those files (this
                   2559:             is the same directory layout as in <code class=
1.14      xtraeme  2560:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2561: 
                   2562:             <p>This same directory layout applies for CDROM
                   2563:             distributions, only that the directory may be rooted
1.14      xtraeme  2564:             somewhere else, probably somewhere below <code class=
                   2565:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2566:             documentation for the exact location.</p>
                   2567:           </div>
                   2568: 
                   2569:           <div class="sect2" lang="en" xml:lang="en">
                   2570:             <div class="titlepage">
                   2571:               <div>
                   2572:                 <div>
1.30    ! wiz      2573:                   <h3 class="title"><a name=
        !          2574:                   "how-to-use-binary-packages" id=
        !          2575:                   "how-to-use-binary-packages"></a>4.1.2.&nbsp;How
        !          2576:                   to use binary packages</h3>
1.1       grant    2577:                 </div>
                   2578:               </div>
                   2579:             </div>
                   2580: 
                   2581:             <p>If you have the files on a CDROM or downloaded them
1.23      wiz      2582:             to your hard disk, you can install them with the
1.27      rillig   2583:             following command (be sure to <span><strong class=
1.14      xtraeme  2584:             "command">su</strong></span> to root first):</p>
1.1       grant    2585:             <pre class="screen">
1.14      xtraeme  2586: <code class="prompt">#</code> <strong class=
                   2587: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2588: </pre>
                   2589: 
                   2590:             <p>If you have FTP access and you don't want to
                   2591:             download the packages via FTP prior to installation,
1.14      xtraeme  2592:             you can do this automatically by giving
                   2593:             <span><strong class="command">pkg_add</strong></span>
                   2594:             an FTP URL:</p>
1.1       grant    2595:             <pre class="screen">
1.14      xtraeme  2596: <code class="prompt">#</code> <strong class=
1.27      rillig   2597: "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    2598: </pre>
                   2599: 
1.27      rillig   2600:             <p>Note that any prerequisite packages needed to run
                   2601:             the package in question will be installed, too,
1.1       grant    2602:             assuming they are present where you install from.</p>
                   2603: 
1.23      wiz      2604:             <p>To save some typing, you can set the <code class=
                   2605:             "varname">PKG_PATH</code> environment variable to a
                   2606:             semicolon separated list of paths (including remote
                   2607:             URLs); trailing slashes are not allowed.</p>
                   2608: 
                   2609:             <p>Additionally to the <code class=
                   2610:             "filename">All</code> directory there exists a
                   2611:             <code class="filename">vulnerable</code> directory to
                   2612:             which binary packages with known vulnerabilities are
                   2613:             moved, since removing them could cause missing
                   2614:             dependencies. To use these packages, add the
                   2615:             <code class="filename">vulnerable</code> directory to
                   2616:             your <code class="varname">PKG_PATH</code>. However,
                   2617:             you should run <a xmlns=
                   2618:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2619:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   2620:             class="pkgname">security/audit-packages</a> regularly,
                   2621:             and especially after installing new packages, and
                   2622:             verify that the vulnerabilities are acceptable for your
                   2623:             configuration. An example <code class=
                   2624:             "varname">PKG_PATH</code> would be: <code class=
1.27      rillig   2625:             "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      2626:             Please note that semicolon (';') is a shell
                   2627:             meta-character, so you'll probably have to quote
                   2628:             it.</p>
                   2629: 
1.1       grant    2630:             <p>After you've installed packages, be sure to have
1.27      rillig   2631:             <code class="filename">/usr/pkg/bin</code> and
                   2632:             <code class="filename">/usr/pkg/sbin</code> in your
1.14      xtraeme  2633:             <code class="varname">PATH</code> so you can actually
                   2634:             start the just installed program.</p>
1.1       grant    2635:           </div>
                   2636: 
                   2637:           <div class="sect2" lang="en" xml:lang="en">
                   2638:             <div class="titlepage">
                   2639:               <div>
                   2640:                 <div>
1.30    ! wiz      2641:                   <h3 class="title"><a name="a-word-of-warning" id=
        !          2642:                   "a-word-of-warning"></a>4.1.3.&nbsp;A word of
1.1       grant    2643:                   warning</h3>
                   2644:                 </div>
                   2645:               </div>
                   2646:             </div>
                   2647: 
                   2648:             <p>Please pay very careful attention to the warnings
                   2649:             expressed in the <a href=
                   2650:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2651:             <span class="citerefentry"><span class=
                   2652:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2653:             page about the inherent dangers of installing binary
                   2654:             packages which you did not create yourself, and the
                   2655:             security holes that can be introduced onto your system
                   2656:             by indiscriminate adding of such files.</p>
                   2657:           </div>
                   2658:         </div>
                   2659: 
                   2660:         <div class="sect1" lang="en" xml:lang="en">
                   2661:           <div class="titlepage">
                   2662:             <div>
                   2663:               <div>
                   2664:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      2665:                 "building-packages-from-source" id=
        !          2666:                 "building-packages-from-source"></a>4.2.&nbsp;Building
1.1       grant    2667:                 packages from source</h2>
                   2668:               </div>
                   2669:             </div>
                   2670:           </div>
                   2671: 
                   2672:           <p>This assumes that the package is already in pkgsrc. If
                   2673:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2674:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27      rillig   2675:           &#8220;The pkgsrc developer's guide&#8221;</a> for
                   2676:           instructions how to create your own packages.</p>
1.1       grant    2677: 
                   2678:           <div class="sect2" lang="en" xml:lang="en">
                   2679:             <div class="titlepage">
                   2680:               <div>
                   2681:                 <div>
1.30    ! wiz      2682:                   <h3 class="title"><a name="requirements" id=
        !          2683:                   "requirements"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2684:                 </div>
                   2685:               </div>
                   2686:             </div>
                   2687: 
                   2688:             <p>To build packages from source on a NetBSD system the
                   2689:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2690:             &#8220;<span class="quote">text</span>&#8221;
                   2691:             distribution sets must be installed. If you want to
                   2692:             build X11 related packages the &#8220;<span class=
                   2693:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2694:             "quote">xcomp</span>&#8221; distribution sets are
                   2695:             required, too.</p>
                   2696:           </div>
                   2697: 
                   2698:           <div class="sect2" lang="en" xml:lang="en">
                   2699:             <div class="titlepage">
                   2700:               <div>
                   2701:                 <div>
1.30    ! wiz      2702:                   <h3 class="title"><a name="fetching-distfiles"
        !          2703:                   id="fetching-distfiles"></a>4.2.2.&nbsp;Fetching
1.1       grant    2704:                   distfiles</h3>
                   2705:                 </div>
                   2706:               </div>
                   2707:             </div>
                   2708: 
1.27      rillig   2709:             <p>The first step for building a package is downloading
                   2710:             the distfiles (i.e. the unmodified source). If they
                   2711:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    2712:             automatically.</p>
                   2713: 
                   2714:             <p>You can overwrite some of the major distribution
                   2715:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2716:             a look at <code class=
                   2717:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27      rillig   2718:             some examples &#8212; in particular, look for the
1.14      xtraeme  2719:             <code class="varname">MASTER_SORT</code>, <code class=
                   2720:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2721:             "varname">INET_COUNTRY</code> definitions. This may
                   2722:             save some of your bandwidth and time.</p>
1.1       grant    2723: 
                   2724:             <p>You can change these settings either in your shell's
                   2725:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2726:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2727:             file, and adding the definitions there.</p>
                   2728: 
                   2729:             <p>If you don't have a permanent Internet connection
                   2730:             and you want to know which files to download,
1.14      xtraeme  2731:             <span><strong class="command">make
                   2732:             fetch-list</strong></span> will tell you what you'll
                   2733:             need. Put these distfiles into <code class=
                   2734:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2735:           </div>
                   2736: 
                   2737:           <div class="sect2" lang="en" xml:lang="en">
                   2738:             <div class="titlepage">
                   2739:               <div>
                   2740:                 <div>
1.30    ! wiz      2741:                   <h3 class="title"><a name=
        !          2742:                   "how-to-build-and-install" id=
        !          2743:                   "how-to-build-and-install"></a>4.2.3.&nbsp;How to
        !          2744:                   build and install</h3>
1.1       grant    2745:                 </div>
                   2746:               </div>
                   2747:             </div>
                   2748: 
                   2749:             <p>Assuming that the distfile has been fetched (see
                   2750:             previous section), become root and change into the
1.14      xtraeme  2751:             relevant directory and running <span><strong class=
                   2752:             "command">make</strong></span>. For example, type</p>
1.1       grant    2753:             <pre class="screen">
1.14      xtraeme  2754: <code class="prompt">%</code> <strong class=
                   2755: "userinput"><code>cd misc/figlet</code></strong>
                   2756: <code class="prompt">%</code> <strong class=
                   2757: "userinput"><code>make</code></strong>
1.1       grant    2758: </pre>
                   2759: 
                   2760:             <p>at the shell prompt to build the various components
                   2761:             of the package, and</p>
                   2762:             <pre class="screen">
1.14      xtraeme  2763: <code class="prompt">#</code> <strong class=
                   2764: "userinput"><code>make install</code></strong>
1.1       grant    2765: </pre>
                   2766: 
                   2767:             <p>to install the various components into the correct
                   2768:             places on your system. Installing the package on your
                   2769:             system requires you to be root. However, pkgsrc has a
                   2770:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2771:             feature, which allows you to only become root for the
                   2772:             actual installation step</p>
                   2773: 
                   2774:             <p>Taking the figlet utility as an example, we can
                   2775:             install it on our system by building as shown in
                   2776:             <a href="#logs" title=
                   2777:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2778:             logs</i></a>.</p>
                   2779: 
                   2780:             <p>The program is installed under the default root of
1.14      xtraeme  2781:             the packages tree - <code class=
                   2782:             "filename">/usr/pkg</code>. Should this not conform to
                   2783:             your tastes, set the <code class=
                   2784:             "varname">LOCALBASE</code> variable in your
1.1       grant    2785:             environment, and it will use that value as the root of
1.14      xtraeme  2786:             your packages tree. So, to use <code class=
                   2787:             "filename">/usr/local</code>, set <code class=
                   2788:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2789:             environment. Please note that you should use a
                   2790:             directory which is dedicated to packages and not shared
1.14      xtraeme  2791:             with other programs (ie, do not try and use
                   2792:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2793:             should not try to add any of your own files or
                   2794:             directories (such as <code class=
                   2795:             "filename">src/</code>, <code class=
                   2796:             "filename">obj/</code>, or <code class=
                   2797:             "filename">pkgsrc/</code>) below the <code class=
                   2798:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2799:             possible conflicts between programs and other files
                   2800:             installed by the package system and whatever else may
                   2801:             have been installed there.</p>
                   2802: 
1.14      xtraeme  2803:             <p>Some packages look in <code class=
                   2804:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2805:             configuration options at build time. Have a look at
1.14      xtraeme  2806:             <code class=
                   2807:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2808:             overview of what will be set there by default.
                   2809:             Environment variables such as <code class=
                   2810:             "varname">LOCALBASE</code> can be set in <code class=
                   2811:             "filename">/etc/mk.conf</code> to save having to
                   2812:             remember to set them each time you want to use
                   2813:             pkgsrc.</p>
1.1       grant    2814: 
                   2815:             <p>Occasionally, people want to &#8220;<span class=
                   2816:             "quote">look under the covers</span>&#8221; to see what
                   2817:             is going on when a package is building or being
                   2818:             installed. This may be for debugging purposes, or out
                   2819:             of simple curiosity. A number of utility values have
                   2820:             been added to help with this.</p>
                   2821: 
                   2822:             <div class="orderedlist">
                   2823:               <ol type="1">
                   2824:                 <li>
                   2825:                   <p>If you invoke the <a href=
                   2826:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2827:                   <span class="citerefentry"><span class=
                   2828:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2829:                   with <code class=
                   2830:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2831:                   amount of information will be displayed. For
                   2832:                   example,</p>
1.1       grant    2833:                   <pre class="screen">
1.14      xtraeme  2834: <strong class=
                   2835: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2836: </pre>
                   2837: 
                   2838:                   <p>will show all the commands that are invoked,
                   2839:                   up to and including the &#8220;<span class=
                   2840:                   "quote">patch</span>&#8221; stage.</p>
                   2841:                 </li>
                   2842: 
                   2843:                 <li>
                   2844:                   <p>If you want to know the value of a certain
1.22      tv       2845:                   <a href=
                   2846:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2847:                   <span class="citerefentry"><span class=
                   2848:                   "refentrytitle">make</span>(1)</span></a>
                   2849:                   definition, then the <code class=
1.14      xtraeme  2850:                   "varname">VARNAME</code> definition should be
                   2851:                   used, in conjunction with the show-var target.
                   2852:                   e.g. to show the expansion of the <a href=
1.1       grant    2853:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2854:                   <span class="citerefentry"><span class=
                   2855:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2856:                   variable <code class=
1.22      tv       2857:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2858:                   <pre class="screen">
1.14      xtraeme  2859: <code class="prompt">%</code> <strong class=
                   2860: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2861: /usr/pkg
1.14      xtraeme  2862: <code class="prompt">%</code>
1.1       grant    2863:           
                   2864: </pre>
                   2865:                 </li>
                   2866:               </ol>
                   2867:             </div>
                   2868: 
                   2869:             <p>If you want to install a binary package that you've
                   2870:             either created yourself (see next section), that you
                   2871:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2872:             a remote FTP server, you can use the "bin-install"
1.1       grant    2873:             target. This target will install a binary package - if
                   2874:             available - via <a href=
                   2875:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2876:             <span class="citerefentry"><span class=
                   2877:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2878:             <span><strong class="command">make
                   2879:             package</strong></span>. The list of remote FTP sites
                   2880:             searched is kept in the variable <code class=
                   2881:             "varname">BINPKG_SITES</code>, which defaults to
                   2882:             ftp.NetBSD.org. Any flags that should be added to
                   2883:             <a href=
1.1       grant    2884:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2885:             <span class="citerefentry"><span class=
                   2886:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2887:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2888:             See <code class=
                   2889:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2890:             details.</p>
1.1       grant    2891: 
                   2892:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2893:             has a non-standard setting for <code class=
                   2894:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2895:             any packages are installed, as you can not use several
                   2896:             directories for the same purpose. Doing so will result
                   2897:             in pkgsrc not being able to properly detect your
                   2898:             installed packages, and fail miserably. Note also that
                   2899:             precompiled binary packages are usually built with the
1.14      xtraeme  2900:             default <code class="varname">LOCALBASE</code> of
                   2901:             <code class="filename">/usr/pkg</code>, and that you
                   2902:             should <span class="emphasis"><em>not</em></span>
                   2903:             install any if you use a non-standard <code class=
                   2904:             "varname">LOCALBASE</code>.</p>
1.1       grant    2905:           </div>
                   2906: 
                   2907:           <div class="sect2" lang="en" xml:lang="en">
                   2908:             <div class="titlepage">
                   2909:               <div>
                   2910:                 <div>
1.30    ! wiz      2911:                   <h3 class="title"><a name=
        !          2912:                   "selecting-the-compiler" id=
        !          2913:                   "selecting-the-compiler"></a>4.2.4.&nbsp;Selecting
        !          2914:                   the compiler</h3>
1.1       grant    2915:                 </div>
                   2916:               </div>
                   2917:             </div>
                   2918: 
                   2919:             <p>By default, pkgsrc will use GCC to build packages.
                   2920:             This may be overridden by setting the following
                   2921:             variables in /etc/mk.conf:</p>
                   2922: 
                   2923:             <div class="variablelist">
                   2924:               <dl>
1.14      xtraeme  2925:                 <dt><span class="term"><code class=
                   2926:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2927: 
                   2928:                 <dd>
                   2929:                   <p>This is a list of values specifying the chain
                   2930:                   of compilers to invoke when building packages.
                   2931:                   Valid values are:</p>
                   2932: 
                   2933:                   <div class="itemizedlist">
                   2934:                     <ul type="disc">
                   2935:                       <li>
1.14      xtraeme  2936:                         <p><code class="varname">distcc</code>:
1.1       grant    2937:                         distributed C/C++ (chainable)</p>
                   2938:                       </li>
                   2939: 
                   2940:                       <li>
1.14      xtraeme  2941:                         <p><code class="varname">ccache</code>:
1.1       grant    2942:                         compiler cache (chainable)</p>
                   2943:                       </li>
                   2944: 
                   2945:                       <li>
1.14      xtraeme  2946:                         <p><code class="varname">gcc</code>: GNU
                   2947:                         C/C++ Compiler</p>
1.1       grant    2948:                       </li>
                   2949: 
                   2950:                       <li>
1.14      xtraeme  2951:                         <p><code class="varname">mipspro</code>:
1.1       grant    2952:                         Silicon Graphics, Inc. MIPSpro
                   2953:                         (n32/n64)</p>
                   2954:                       </li>
                   2955: 
                   2956:                       <li>
1.14      xtraeme  2957:                         <p><code class="varname">mipspro</code>:
1.1       grant    2958:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2959:                       </li>
                   2960: 
                   2961:                       <li>
1.14      xtraeme  2962:                         <p><code class="varname">sunpro</code>:
1.1       grant    2963:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2964:                         Studio</p>
                   2965:                       </li>
                   2966:                     </ul>
                   2967:                   </div>
                   2968: 
                   2969:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2970:                   "quote"><code class=
                   2971:                   "varname">gcc</code></span>&#8221;. You can use
                   2972:                   <code class="varname">ccache</code> and/or
                   2973:                   <code class="varname">distcc</code> with an
                   2974:                   appropriate <code class=
                   2975:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2976:                   &#8220;<span class="quote"><code class=
                   2977:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2978:                   variable should always be terminated with a value
                   2979:                   for a real compiler.</p>
                   2980:                 </dd>
                   2981: 
1.14      xtraeme  2982:                 <dt><span class="term"><code class=
                   2983:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2984: 
                   2985:                 <dd>
                   2986:                   <p>This specifies the minimum version of GCC to
                   2987:                   use when building packages. If the system GCC
                   2988:                   doesn't satisfy this requirement, then pkgsrc
                   2989:                   will build and install one of the GCC packages to
                   2990:                   use instead.</p>
                   2991:                 </dd>
                   2992:               </dl>
                   2993:             </div>
                   2994:           </div>
                   2995:         </div>
                   2996:       </div>
                   2997: 
                   2998:       <div class="chapter" lang="en" xml:lang="en">
                   2999:         <div class="titlepage">
                   3000:           <div>
                   3001:             <div>
                   3002:               <h2 class="title"><a name="binary" id=
                   3003:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   3004:               packages</h2>
                   3005:             </div>
                   3006:           </div>
                   3007:         </div>
                   3008: 
                   3009:         <div class="toc">
                   3010:           <p><b>Table of Contents</b></p>
                   3011: 
                   3012:           <dl>
1.30    ! wiz      3013:             <dt><span class="sect1"><a href=
        !          3014:             "#building-a-single-binary-package">5.1. Building a
        !          3015:             single binary package</a></span></dt>
1.1       grant    3016: 
1.30    ! wiz      3017:             <dt><span class="sect1"><a href=
        !          3018:             "#settings-for-creationg-of-binary-packages">5.2.
1.1       grant    3019:             Settings for creation of binary
                   3020:             packages</a></span></dt>
                   3021: 
                   3022:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   3023:             a bulk build of all packages</a></span></dt>
                   3024: 
                   3025:             <dd>
                   3026:               <dl>
                   3027:                 <dt><span class="sect2"><a href=
                   3028:                 "#binary.configuration">5.3.1.
                   3029:                 Configuration</a></span></dt>
                   3030: 
1.30    ! wiz      3031:                 <dt><span class="sect2"><a href=
        !          3032:                 "#other-environmental-considerations">5.3.2. Other
        !          3033:                 environmental considerations</a></span></dt>
1.1       grant    3034: 
1.30    ! wiz      3035:                 <dt><span class="sect2"><a href="#operation">5.3.3.
1.1       grant    3036:                 Operation</a></span></dt>
                   3037: 
1.30    ! wiz      3038:                 <dt><span class="sect2"><a href=
        !          3039:                 "#what-it-does">5.3.4. What it does</a></span></dt>
1.1       grant    3040: 
1.30    ! wiz      3041:                 <dt><span class="sect2"><a href=
        !          3042:                 "#disk-space-requirements">5.3.5. Disk space
        !          3043:                 requirements</a></span></dt>
1.1       grant    3044: 
1.30    ! wiz      3045:                 <dt><span class="sect2"><a href=
        !          3046:                 "#setting-up-a-sandbox">5.3.6. Setting up a sandbox
        !          3047:                 for chroot'ed builds</a></span></dt>
1.1       grant    3048: 
1.30    ! wiz      3049:                 <dt><span class="sect2"><a href=
        !          3050:                 "#building-a-partial-set">5.3.7. Building a partial
        !          3051:                 set of packages</a></span></dt>
1.13      hubertf  3052: 
                   3053:                 <dt><span class="sect2"><a href=
                   3054:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   3055:                 build</a></span></dt>
1.1       grant    3056:               </dl>
                   3057:             </dd>
                   3058: 
1.30    ! wiz      3059:             <dt><span class="sect1"><a href="#creating-cdroms">5.4.
1.1       grant    3060:             Creating a multiple CD-ROM packages
                   3061:             collection</a></span></dt>
                   3062: 
                   3063:             <dd>
                   3064:               <dl>
1.30    ! wiz      3065:                 <dt><span class="sect2"><a href=
        !          3066:                 "#cdpack-example">5.4.1. Example of
        !          3067:                 cdpack</a></span></dt>
1.1       grant    3068:               </dl>
                   3069:             </dd>
                   3070:           </dl>
                   3071:         </div>
                   3072: 
                   3073:         <div class="sect1" lang="en" xml:lang="en">
                   3074:           <div class="titlepage">
                   3075:             <div>
                   3076:               <div>
                   3077:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      3078:                 "building-a-single-binary-package" id=
        !          3079:                 "building-a-single-binary-package"></a>5.1.&nbsp;Building
        !          3080:                 a single binary package</h2>
1.1       grant    3081:               </div>
                   3082:             </div>
                   3083:           </div>
                   3084: 
                   3085:           <p>Once you have built and installed a package, you can
                   3086:           create a <span class="emphasis"><em>binary
                   3087:           package</em></span> which can be installed on another
                   3088:           system with <a href=
                   3089:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3090:           <span class="citerefentry"><span class=
                   3091:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   3092:           having to build the same package on a group of hosts and
                   3093:           wasting CPU time. It also provides a simple means for
                   3094:           others to install your package, should you distribute
                   3095:           it.</p>
                   3096: 
                   3097:           <p>To create a binary package, change into the
1.14      xtraeme  3098:           appropriate directory in pkgsrc, and run
                   3099:           <span><strong class="command">make
                   3100:           package</strong></span>:</p>
1.1       grant    3101:           <pre class="screen">
1.14      xtraeme  3102: <code class="prompt">#</code> <strong class=
                   3103: "userinput"><code>cd misc/figlet</code></strong>
                   3104: <code class="prompt">#</code> <strong class=
                   3105: "userinput"><code>make package</code></strong>
1.1       grant    3106: </pre>
                   3107: 
                   3108:           <p>This will build and install your package (if not
                   3109:           already done), and then build a binary package from what
1.14      xtraeme  3110:           was installed. You can then use the <span><strong class=
                   3111:           "command">pkg_*</strong></span> tools to manipulate it.
                   3112:           Binary packages are created by default in <code class=
                   3113:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3114:           gzipped tar file. See <a href="#logs.package" title=
                   3115:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   3116:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3117:           the above <a xmlns=
                   3118:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3119:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      3120:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    3121: 
                   3122:           <p>See <a href="#submit" title=
1.25      rillig   3123:           "Chapter&nbsp;15.&nbsp;Submitting and Committing">Chapter
                   3124:           15, <i>Submitting and Committing</i></a> for information
1.1       grant    3125:           on how to submit such a binary package.</p>
                   3126:         </div>
                   3127: 
                   3128:         <div class="sect1" lang="en" xml:lang="en">
                   3129:           <div class="titlepage">
                   3130:             <div>
                   3131:               <div>
                   3132:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      3133:                 "settings-for-creationg-of-binary-packages" id=
        !          3134:                 "settings-for-creationg-of-binary-packages"></a>5.2.&nbsp;Settings
1.1       grant    3135:                 for creation of binary packages</h2>
                   3136:               </div>
                   3137:             </div>
                   3138:           </div>
                   3139: 
                   3140:           <p>See <a href="#build.helpful-targets" title=
1.25      rillig   3141:           "12.3.&nbsp;Other helpful targets">Section&nbsp;12.3,
1.1       grant    3142:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3143:         </div>
                   3144: 
                   3145:         <div class="sect1" lang="en" xml:lang="en">
                   3146:           <div class="titlepage">
                   3147:             <div>
                   3148:               <div>
                   3149:                 <h2 class="title" style="clear: both"><a name=
                   3150:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   3151:                 bulk build of all packages</h2>
                   3152:               </div>
                   3153:             </div>
                   3154:           </div>
                   3155: 
                   3156:           <p>If you want to get a full set of precompiled binary
                   3157:           packages, this section describes how to get them. Beware
                   3158:           that the bulk build will remove all currently installed
1.23      wiz      3159:           packages from your system! Having an FTP server
                   3160:           configured either on the machine doing the bulk builds or
                   3161:           on a nearby NFS server can help to make the packages
                   3162:           available to everyone. See <a href=
1.1       grant    3163:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3164:           <span class="citerefentry"><span class=
                   3165:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3166:           information. If you use a remote NFS server's storage, be
                   3167:           sure to not actually compile on NFS storage, as this
                   3168:           slows things down a lot.</p>
                   3169: 
                   3170:           <div class="sect2" lang="en" xml:lang="en">
                   3171:             <div class="titlepage">
                   3172:               <div>
                   3173:                 <div>
                   3174:                   <h3 class="title"><a name="binary.configuration"
                   3175:                   id=
                   3176:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   3177:                 </div>
                   3178:               </div>
                   3179:             </div>
                   3180: 
                   3181:             <div class="sect3" lang="en" xml:lang="en">
                   3182:               <div class="titlepage">
                   3183:                 <div>
                   3184:                   <div>
                   3185:                     <h4 class="title"><a name="binary.mk.conf" id=
                   3186:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   3187:                   </div>
                   3188:                 </div>
                   3189:               </div>
                   3190: 
1.23      wiz      3191:               <p>You may want to set variables in <code class=
1.14      xtraeme  3192:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3193:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3194:               details of the default settings. You will want to
1.14      xtraeme  3195:               ensure that <code class=
                   3196:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3197:               policy. As used in this example, <code class=
                   3198:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3199:               "emphasis"><em>all</em></span> licenses.</p>
                   3200:               <pre class="programlisting">
                   3201: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3202: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3203: BSDSRCDIR=      /usr/src
                   3204: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3205: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3206: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3207: PKG_DEVELOPER?= yes
                   3208: _ACCEPTABLE=    yes
                   3209: </pre>
                   3210:             </div>
                   3211: 
                   3212:             <div class="sect3" lang="en" xml:lang="en">
                   3213:               <div class="titlepage">
                   3214:                 <div>
                   3215:                   <div>
1.30    ! wiz      3216:                     <h4 class="title"><a name="build.conf" id=
        !          3217:                     "build.conf"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  3218:                     "filename">build.conf</code></h4>
1.1       grant    3219:                   </div>
                   3220:                 </div>
                   3221:               </div>
                   3222: 
1.14      xtraeme  3223:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3224:               copy <code class="filename">build.conf-example</code>
                   3225:               to <code class="filename">build.conf</code> and edit
                   3226:               it, following the comments in that file. This is the
1.1       grant    3227:               config file that determines where log files are
                   3228:               generated after the build, where to mail the build
1.23      wiz      3229:               report to, where your pkgsrc tree is located and the
                   3230:               user to which user to <a href=
1.1       grant    3231:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3232:               <span class="citerefentry"><span class=
1.23      wiz      3233:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3234:               <span><strong class="command">cvs
                   3235:               update</strong></span>.</p>
1.1       grant    3236:             </div>
                   3237: 
                   3238:             <div class="sect3" lang="en" xml:lang="en">
                   3239:               <div class="titlepage">
                   3240:                 <div>
                   3241:                   <div>
1.30    ! wiz      3242:                     <h4 class="title"><a name="pre-build.local" id=
        !          3243:                     "pre-build.local"></a>5.3.1.3.&nbsp;<code class="filename">
        !          3244:                     pre-build.local</code></h4>
1.1       grant    3245:                   </div>
                   3246:                 </div>
                   3247:               </div>
                   3248: 
                   3249:               <p>It is possible to configure the bulk build to
                   3250:               perform certain site specific tasks at the end of the
1.14      xtraeme  3251:               pre-build stage. If the file <code class=
                   3252:               "filename">pre-build.local</code> exists in
1.23      wiz      3253:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24      wiz      3254:               will be executed (as a <a href=
                   3255:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   3256:               <span class="citerefentry"><span class=
                   3257:               "refentrytitle">sh</span>(1)</span></a> script) at
                   3258:               the end of the usual pre-build stage. An example use
                   3259:               of <code class="filename">pre-build.local</code> is
                   3260:               to have the line:</p>
1.1       grant    3261:               <pre class="screen">
1.14      xtraeme  3262: <code class="prompt">#</code> <strong class=
                   3263: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3264:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3265: </pre>
                   3266: 
                   3267:               <p>to prevent the system from trying to build a
                   3268:               particular package which requires nearly 3 GB of disk
                   3269:               space.</p>
                   3270:             </div>
                   3271:           </div>
                   3272: 
                   3273:           <div class="sect2" lang="en" xml:lang="en">
                   3274:             <div class="titlepage">
                   3275:               <div>
                   3276:                 <div>
1.30    ! wiz      3277:                   <h3 class="title"><a name=
        !          3278:                   "other-environmental-considerations" id=
        !          3279:                   "other-environmental-considerations"></a>5.3.2.&nbsp;Other
        !          3280:                   environmental considerations</h3>
1.1       grant    3281:                 </div>
                   3282:               </div>
                   3283:             </div>
                   3284: 
1.14      xtraeme  3285:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3286:             completely deleted at the start of bulk builds, make
                   3287:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3288:             drop it into <code class=
                   3289:             "filename">/usr/local/bin</code> (and adjust your login
                   3290:             shell in the passwd file), or (re-)install it via
                   3291:             <a href=
1.1       grant    3292:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3293:             <span class="citerefentry"><span class=
                   3294:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3295:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3296:             login after a reboot (remember that your current
                   3297:             process won't die if the package is removed, you just
                   3298:             can't start any new instances of the shell any more).
                   3299:             Also, if you use NetBSD earlier than 1.5, or you still
                   3300:             want to use the pkgsrc version of ssh for some reason,
                   3301:             be sure to install ssh before starting it from
1.14      xtraeme  3302:             <code class="filename">rc.local</code>:</p>
1.1       grant    3303:             <pre class="programlisting">
                   3304: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3305: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3306:     /usr/pkg/etc/rc.d/sshd
                   3307: fi
                   3308: </pre>
                   3309: 
                   3310:             <p>Not doing so will result in you being not able to
                   3311:             log in via ssh after the bulk build is finished or if
                   3312:             the machine gets rebooted or crashes. You have been
                   3313:             warned! :)</p>
                   3314:           </div>
                   3315: 
                   3316:           <div class="sect2" lang="en" xml:lang="en">
                   3317:             <div class="titlepage">
                   3318:               <div>
                   3319:                 <div>
1.30    ! wiz      3320:                   <h3 class="title"><a name="operation" id=
        !          3321:                   "operation"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3322:                 </div>
                   3323:               </div>
                   3324:             </div>
                   3325: 
                   3326:             <p>Make sure you don't need any of the packages still
                   3327:             installed.</p>
                   3328: 
                   3329:             <div class="warning" style=
                   3330:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3331:               <h3 class="title">Warning</h3>
                   3332: 
                   3333:               <p>During the bulk build, <span class=
                   3334:               "emphasis"><em>all packages will be
                   3335:               removed!</em></span></p>
                   3336:             </div>
                   3337: 
                   3338:             <p>Be sure to remove all other things that might
                   3339:             interfere with builds, like some libs installed in
1.14      xtraeme  3340:             <code class="filename">/usr/local</code>, etc. then
                   3341:             become root and type:</p>
1.1       grant    3342:             <pre class="screen">
1.14      xtraeme  3343: <code class="prompt">#</code> <strong class=
                   3344: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3345: <code class="prompt">#</code> <strong class=
                   3346: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3347: </pre>
                   3348: 
                   3349:             <p>If for some reason your last build didn't complete
                   3350:             (power failure, system panic, ...), you can continue it
                   3351:             by running:</p>
                   3352:             <pre class="screen">
1.14      xtraeme  3353: <code class="prompt">#</code> <strong class=
                   3354: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3355: </pre>
                   3356: 
                   3357:             <p>At the end of the bulk build, you will get a summary
                   3358:             via mail, and find build logs in the directory
1.14      xtraeme  3359:             specified by <code class="varname">FTP</code> in the
                   3360:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3361:           </div>
                   3362: 
                   3363:           <div class="sect2" lang="en" xml:lang="en">
                   3364:             <div class="titlepage">
                   3365:               <div>
                   3366:                 <div>
1.30    ! wiz      3367:                   <h3 class="title"><a name="what-it-does" id=
        !          3368:                   "what-it-does"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3369:                 </div>
                   3370:               </div>
                   3371:             </div>
                   3372: 
                   3373:             <p>The bulk builds consist of three steps:</p>
                   3374: 
                   3375:             <div class="variablelist">
                   3376:               <dl>
                   3377:                 <dt><span class="term">1. pre-build</span></dt>
                   3378: 
                   3379:                 <dd>
                   3380:                   <p>The script updates your pkgsrc tree via
                   3381:                   (anon)cvs, then cleans out any broken distfiles,
                   3382:                   and removes all packages installed.</p>
                   3383:                 </dd>
                   3384: 
                   3385:                 <dt><span class="term">2. the bulk
                   3386:                 build</span></dt>
                   3387: 
                   3388:                 <dd>
                   3389:                   <p>This is basically &#8220;<span class=
                   3390:                   "quote">make bulk-package</span>&#8221; with an
                   3391:                   optimised order in which packages will be built.
                   3392:                   Packages that don't require other packages will
                   3393:                   be built first, and packages with many
                   3394:                   dependencies will be built later.</p>
                   3395:                 </dd>
                   3396: 
                   3397:                 <dt><span class="term">3. post-build</span></dt>
                   3398: 
                   3399:                 <dd>
                   3400:                   <p>Generates a report that's placed in the
1.14      xtraeme  3401:                   directory specified in the <code class=
                   3402:                   "filename">build.conf</code> file named
                   3403:                   <code class="filename">broken.html</code>, a
                   3404:                   short version of that report will also be mailed
                   3405:                   to the build's admin.</p>
1.1       grant    3406:                 </dd>
                   3407:               </dl>
                   3408:             </div>
                   3409: 
                   3410:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3411:             compiled in <code class=
                   3412:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3413:             "filename">.../.broken.${MACHINE}</code> if
                   3414:             <code class="varname">OBJMACHINE</code> is set),
                   3415:             individual build logs of broken builds can be found in
                   3416:             the package's directory. These files are used by the
                   3417:             bulk-targets to mark broken builds to not waste time
                   3418:             trying to rebuild them, and they can be used to debug
                   3419:             these broken package builds later.</p>
1.1       grant    3420:           </div>
                   3421: 
                   3422:           <div class="sect2" lang="en" xml:lang="en">
                   3423:             <div class="titlepage">
                   3424:               <div>
                   3425:                 <div>
1.30    ! wiz      3426:                   <h3 class="title"><a name=
        !          3427:                   "disk-space-requirements" id=
        !          3428:                   "disk-space-requirements"></a>5.3.5.&nbsp;Disk
        !          3429:                   space requirements</h3>
1.1       grant    3430:                 </div>
                   3431:               </div>
                   3432:             </div>
                   3433: 
                   3434:             <p>Currently, roughly the following requirements are
                   3435:             valid for NetBSD 2.0/i386:</p>
                   3436: 
                   3437:             <div class="itemizedlist">
                   3438:               <ul type="disc">
                   3439:                 <li>
                   3440:                   <p>10 GB - distfiles (NFS ok)</p>
                   3441:                 </li>
                   3442: 
                   3443:                 <li>
                   3444:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3445:                 </li>
                   3446: 
                   3447:                 <li>
                   3448:                   <p>5 GB - temp space for compiling (local disk
                   3449:                   recommended)</p>
                   3450:                 </li>
                   3451:               </ul>
                   3452:             </div>
                   3453: 
                   3454:             <p>Note that all pkgs will be de-installed as soon as
                   3455:             they are turned into a binary package, and that sources
                   3456:             are removed, so there is no excessively huge demand to
                   3457:             disk space. Afterwards, if the package is needed again,
                   3458:             it will be installed via <a href=
                   3459:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3460:             <span class="citerefentry"><span class=
                   3461:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3462:             building again, so there are no cycles wasted by
                   3463:             recompiling.</p>
                   3464:           </div>
                   3465: 
                   3466:           <div class="sect2" lang="en" xml:lang="en">
                   3467:             <div class="titlepage">
                   3468:               <div>
                   3469:                 <div>
1.30    ! wiz      3470:                   <h3 class="title"><a name="setting-up-a-sandbox"
        !          3471:                   id="setting-up-a-sandbox"></a>5.3.6.&nbsp;Setting
        !          3472:                   up a sandbox for chroot'ed builds</h3>
1.1       grant    3473:                 </div>
                   3474:               </div>
                   3475:             </div>
                   3476: 
1.12      agc      3477:             <p>If you don't want all the packages nuked from a
                   3478:             machine (rendering it useless for anything but pkg
1.23      wiz      3479:             compiling), there is the possibility of doing the
                   3480:             package bulk build inside a chroot environment.</p>
1.12      agc      3481: 
                   3482:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3483:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3484:             done by using null mounts, or manually.</p>
                   3485: 
1.14      xtraeme  3486:             <p>There is a shell script called <code class=
                   3487:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3488:             set up the sandbox environment using null mounts. It
                   3489:             will also create a script called <code class=
                   3490:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3491:             environment, which will allow the null mounts to be
1.14      xtraeme  3492:             activated using the <span><strong class=
                   3493:             "command">sandbox mount</strong></span> command and
                   3494:             deactivated using the <span><strong class=
                   3495:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3496: 
                   3497:             <p>To set up a sandbox environment by hand, after
                   3498:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3499:             doing a <span><strong class="command">make distribution
                   3500:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3501:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3502:             items are present and properly configured:</p>
1.1       grant    3503: 
                   3504:             <div class="procedure">
                   3505:               <ol type="1">
                   3506:                 <li>
                   3507:                   <p>Kernel</p>
                   3508:                   <pre class="screen">
1.14      xtraeme  3509: <code class="prompt">#</code> <strong class=
                   3510: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3511: </pre>
                   3512:                 </li>
                   3513: 
                   3514:                 <li>
1.14      xtraeme  3515:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3516:                   <pre class="screen">
1.14      xtraeme  3517: <code class="prompt">#</code> <strong class=
                   3518: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3519: </pre>
                   3520:                 </li>
                   3521: 
                   3522:                 <li>
1.14      xtraeme  3523:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3524:                   (for <a xmlns=
                   3525:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3526:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3527:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3528:                   <pre class="screen">
1.14      xtraeme  3529: <code class="prompt">#</code> <strong class=
                   3530: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3531: </pre>
                   3532:                 </li>
                   3533: 
                   3534:                 <li>
                   3535:                   <p>Working(!) mail config (hostname,
                   3536:                   sendmail.cf):</p>
                   3537:                   <pre class="screen">
1.14      xtraeme  3538: <code class="prompt">#</code> <strong class=
                   3539: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3540: </pre>
                   3541:                 </li>
                   3542: 
                   3543:                 <li>
1.14      xtraeme  3544:                   <p><code class="filename">/etc/localtime</code>
                   3545:                   (for <a xmlns=
1.1       grant    3546:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3547:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3548:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3549:                   <pre class="screen">
1.14      xtraeme  3550: <code class="prompt">#</code> <strong class=
                   3551: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3552: </pre>
                   3553:                 </li>
                   3554: 
                   3555:                 <li>
1.14      xtraeme  3556:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3557:                   sources, for <a xmlns=
                   3558:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3559:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3560:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3561:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3562:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3563:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3564:                   <pre class="screen">
1.14      xtraeme  3565: <code class="prompt">#</code> <strong class=
                   3566: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3567: <code class="prompt">#</code> <strong class=
1.23      wiz      3568: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3569: </pre>
                   3570:                 </li>
                   3571: 
                   3572:                 <li>
1.14      xtraeme  3573:                   <p>Create <code class=
                   3574:                   "filename">/var/db/pkg</code> (not part of
                   3575:                   default install):</p>
1.1       grant    3576:                   <pre class="screen">
1.14      xtraeme  3577: <code class="prompt">#</code> <strong class=
                   3578: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3579: </pre>
                   3580:                 </li>
                   3581: 
                   3582:                 <li>
1.14      xtraeme  3583:                   <p>Create <code class="filename">/usr/pkg</code>
                   3584:                   (not part of default install):</p>
1.1       grant    3585:                   <pre class="screen">
1.14      xtraeme  3586: <code class="prompt">#</code> <strong class=
                   3587: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3588: </pre>
                   3589:                 </li>
                   3590: 
                   3591:                 <li>
1.14      xtraeme  3592:                   <p>Checkout pkgsrc via cvs into <code class=
                   3593:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3594:                   <pre class="screen">
1.14      xtraeme  3595: <code class="prompt">#</code> <strong class=
                   3596: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3597: <code class="prompt">#</code> <strong class=
                   3598: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3599: </pre>
                   3600: 
                   3601:                   <p>Do not mount/link this to the copy of your
                   3602:                   pkgsrc tree you do development in, as this will
                   3603:                   likely cause problems!</p>
                   3604:                 </li>
                   3605: 
                   3606:                 <li>
1.14      xtraeme  3607:                   <p>Make <code class=
                   3608:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3609:                   and <code class="filename">.../distfiles</code>
                   3610:                   point somewhere appropriate. NFS- and/or
                   3611:                   nullfs-mounts may come in handy!</p>
1.1       grant    3612:                 </li>
                   3613: 
                   3614:                 <li>
1.14      xtraeme  3615:                   <p>Edit <code class=
                   3616:                   "filename">/etc/mk.conf</code>, see <a href=
                   3617:                   "#binary.mk.conf" title=
1.1       grant    3618:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3619:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3620:                 </li>
                   3621: 
                   3622:                 <li>
1.14      xtraeme  3623:                   <p>Adjust <code class=
                   3624:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3625:                   needs.</p>
                   3626:                 </li>
                   3627: 
                   3628:                 <li>
1.14      xtraeme  3629:                   <p>If you have set <code class=
                   3630:                   "varname">CVS_USER</code> in <code class=
                   3631:                   "filename">build.conf</code>, make sure that
                   3632:                   account exists and can do a <span><strong class=
                   3633:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3634:                   properly!</p>
                   3635:                 </li>
                   3636:               </ol>
                   3637:             </div>
                   3638: 
                   3639:             <p>When the chroot sandbox is setup, you can start the
                   3640:             build with the following steps:</p>
                   3641:             <pre class="screen">
1.14      xtraeme  3642: <code class="prompt">#</code> <strong class=
                   3643: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3644: <code class="prompt">#</code> <strong class=
                   3645: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3646: </pre>
                   3647: 
                   3648:             <p>This will just jump inside the sandbox and start
                   3649:             building. At the end of the build, mail will be sent
                   3650:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3651:             be in <code class=
                   3652:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3653:             (wherever that points/mounts to/from).</p>
                   3654:           </div>
                   3655: 
                   3656:           <div class="sect2" lang="en" xml:lang="en">
                   3657:             <div class="titlepage">
                   3658:               <div>
                   3659:                 <div>
1.30    ! wiz      3660:                   <h3 class="title"><a name=
        !          3661:                   "building-a-partial-set" id=
        !          3662:                   "building-a-partial-set"></a>5.3.7.&nbsp;Building
        !          3663:                   a partial set of packages</h3>
1.1       grant    3664:                 </div>
                   3665:               </div>
                   3666:             </div>
                   3667: 
                   3668:             <p>In addition to building a complete set of all
1.14      xtraeme  3669:             packages in pkgsrc, the <code class=
                   3670:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3671:             used to build a subset of the packages contained in
                   3672:             pkgsrc. By setting defining <code class=
                   3673:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3674:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3675: 
                   3676:             <div class="itemizedlist">
                   3677:               <ul type="disc">
                   3678:                 <li>
                   3679:                   <p>SITE_SPECIFIC_PKGS</p>
                   3680:                 </li>
                   3681: 
                   3682:                 <li>
                   3683:                   <p>HOST_SPECIFIC_PKGS</p>
                   3684:                 </li>
                   3685: 
                   3686:                 <li>
                   3687:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3688:                 </li>
                   3689: 
                   3690:                 <li>
                   3691:                   <p>USER_SPECIFIC_PKGS</p>
                   3692:                 </li>
                   3693:               </ul>
                   3694:             </div>
                   3695: 
                   3696:             <p>will define the set of packages which should be
                   3697:             built. The bulk build code will also include any
                   3698:             packages which are needed as dependencies for the
                   3699:             explicitly listed packages.</p>
                   3700: 
                   3701:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3702:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3703:             sandbox periodically to have a complete set of the
                   3704:             binary packages needed for your site available without
                   3705:             the overhead of building extra packages that are not
                   3706:             needed.</p>
                   3707:           </div>
1.13      hubertf  3708: 
                   3709:           <div class="sect2" lang="en" xml:lang="en">
                   3710:             <div class="titlepage">
                   3711:               <div>
                   3712:                 <div>
                   3713:                   <h3 class="title"><a name="bulk-upload" id=
                   3714:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3715:                   of a bulk build</h3>
                   3716:                 </div>
                   3717:               </div>
                   3718:             </div>
                   3719: 
                   3720:             <p>This section describes how pkgsrc developers can
                   3721:             upload binary pkgs built by bulk builds to
                   3722:             ftp.NetBSD.org.</p>
                   3723: 
1.17      sketch   3724:             <p>If you would like to automatically create checksum
                   3725:             files for the binary packages you intend to upload,
                   3726:             remember to set <code class="varname">MKSUMS=yes</code>
                   3727:             in your <code class=
                   3728:             "filename">mk/bulk/build.conf</code>.</p>
                   3729: 
                   3730:             <p>If you would like to PGP sign the checksum files
                   3731:             (highly recommended!), remember to set <code class=
                   3732:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3733:             <code class="filename">mk/bulk/build.conf</code>. This
1.23      wiz      3734:             will prompt you for your GPG password to sign the files
1.17      sketch   3735:             before uploading everything.</p>
                   3736: 
                   3737:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3738:             "varname">RSYNC_DST</code> set properly in your
                   3739:             <code class="filename">mk/bulk/build.conf</code> file,
                   3740:             i.e. adjust it to something like one of the
                   3741:             following:</p>
1.13      hubertf  3742:             <pre class="screen">
                   3743: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3744: </pre>
                   3745: 
1.23      wiz      3746:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3747:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3748:             ftp.NetBSD.org is different from <code class=
                   3749:             "varname">CVS_USER</code>, write your login directly
                   3750:             into the variable, e.g. my local account is "feyrer",
                   3751:             but for my login "hubertf", I use:</p>
1.13      hubertf  3752:             <pre class="screen">
                   3753: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3754: </pre>
                   3755: 
1.14      xtraeme  3756:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3757:             directory is used here to allow "closing" the directory
                   3758:             during upload. To do so, run the following command on
                   3759:             ftp.NetBSD.org next:</p>
                   3760:             <pre class="screen">
1.14      xtraeme  3761: nbftp% <strong class=
                   3762: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3763: </pre>
                   3764: 
1.14      xtraeme  3765:             <p>Please note that <code class=
                   3766:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3767:             appropriate for packages for the NetBSD operating
                   3768:             system. Binary packages for other operating systems
1.14      xtraeme  3769:             should go into <code class=
                   3770:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3771: 
                   3772:             <p>Before uploading the binary pkgs, ssh authentication
1.23      wiz      3773:             needs to be set up. This example shows how to setup
1.13      hubertf  3774:             temporary keys for the root account <span class=
                   3775:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3776:             that no keys should be present there usually):</p>
                   3777:             <pre class="screen">
1.14      xtraeme  3778: <code class="prompt">#</code> <strong class=
                   3779: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3780: chroot-<code class="prompt">#</code> <strong class=
                   3781: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3782: chroot-<code class="prompt">#</code> <strong class=
                   3783: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3784: chroot-<code class="prompt">#</code> <strong class=
                   3785: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3786: </pre>
                   3787: 
1.14      xtraeme  3788:             <p>Now take the output of <code class=
                   3789:             "filename">id-dsa.pub</code> and append it to your
                   3790:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3791:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3792:             the upload is done!</p>
1.13      hubertf  3793: 
                   3794:             <p>Next, test if your ssh connection really works:</p>
                   3795:             <pre class="screen">
1.14      xtraeme  3796: chroot-<code class="prompt">#</code> <strong class=
                   3797: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3798: </pre>
                   3799: 
                   3800:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3801: 
                   3802:             <p>Now after all this works, you can exit the sandbox
                   3803:             and start the upload:</p>
                   3804:             <pre class="screen">
1.14      xtraeme  3805: chroot-<code class="prompt">#</code> <strong class=
                   3806: "userinput"><code>exit</code></strong>        
                   3807: <code class="prompt">#</code> <strong class=
                   3808: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3809: <code class="prompt">#</code> <strong class=
                   3810: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3811: </pre>
                   3812: 
                   3813:             <p>The upload process may take quite some time. Use
1.24      wiz      3814:             <a href=
                   3815:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   3816:             <span class="citerefentry"><span class=
                   3817:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   3818:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   3819:             <span class="citerefentry"><span class=
                   3820:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   3821:             server to monitor progress of the upload. The upload
                   3822:             script will take care of not uploading restricted
                   3823:             packages and putting vulnerable packages into the
                   3824:             <code class="filename">vulnerable</code>
                   3825:             subdirectory.</p>
1.13      hubertf  3826: 
                   3827:             <p>After the upload has ended, first thing is to revoke
                   3828:             ssh access:</p>
                   3829:             <pre class="screen">
1.14      xtraeme  3830: nbftp% <strong class=
                   3831: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3832: Gdd:x! 
                   3833: </pre>
                   3834: 
                   3835:             <p>Use whatever is needed to remove the key you've
                   3836:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3837:             the <code class="filename">upload</code> directory to
                   3838:             have them accessible to everyone:</p>
1.13      hubertf  3839:             <pre class="screen">
1.14      xtraeme  3840: nbftp% <strong class=
                   3841: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3842: nbftp% <strong class=
                   3843: "userinput"><code>mv upload/* .</code></strong>
                   3844: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3845: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3846: </pre>
                   3847:           </div>
1.1       grant    3848:         </div>
                   3849: 
                   3850:         <div class="sect1" lang="en" xml:lang="en">
                   3851:           <div class="titlepage">
                   3852:             <div>
                   3853:               <div>
                   3854:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      3855:                 "creating-cdroms" id=
        !          3856:                 "creating-cdroms"></a>5.4.&nbsp;Creating a multiple
        !          3857:                 CD-ROM packages collection</h2>
1.1       grant    3858:               </div>
                   3859:             </div>
                   3860:           </div>
                   3861: 
                   3862:           <p>After your pkgsrc bulk-build has completed, you may
                   3863:           wish to create a CD-ROM set of the resulting binary
                   3864:           packages to assist in installing packages on other
                   3865:           machines. The <a xmlns=
                   3866:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3867:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      3868:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3869:           simple tool for creating the ISO 9660 images.
                   3870:           <span><strong class="command">cdpack</strong></span>
                   3871:           arranges the packages on the CD-ROMs in a way that keeps
                   3872:           all the dependencies for given package on the same CD as
                   3873:           that package.</p>
1.1       grant    3874: 
                   3875:           <div class="sect2" lang="en" xml:lang="en">
                   3876:             <div class="titlepage">
                   3877:               <div>
                   3878:                 <div>
1.30    ! wiz      3879:                   <h3 class="title"><a name="cdpack-example" id=
        !          3880:                   "cdpack-example"></a>5.4.1.&nbsp;Example of
1.1       grant    3881:                   cdpack</h3>
                   3882:                 </div>
                   3883:               </div>
                   3884:             </div>
                   3885: 
                   3886:             <p>Complete documentation for cdpack is found in the
                   3887:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3888:             that the binary packages are left in <code class=
                   3889:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3890:             sufficient disk space exists in <code class=
                   3891:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3892:             <pre class="screen">
1.14      xtraeme  3893: <code class="prompt">#</code> <strong class=
                   3894: "userinput"><code>mkdir /u2/images</code></strong>
                   3895: <code class="prompt">#</code> <strong class=
                   3896: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3897: <code class="prompt">#</code> <strong class=
                   3898: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3899: </pre>
                   3900: 
                   3901:             <p>If you wish to include a common set of files
1.14      xtraeme  3902:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3903:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3904:             collection, then you need to create a directory which
                   3905:             contains these files. e.g.</p>
                   3906:             <pre class="screen">
1.14      xtraeme  3907: <code class="prompt">#</code> <strong class=
                   3908: "userinput"><code>mkdir /tmp/common</code></strong>
                   3909: <code class="prompt">#</code> <strong class=
                   3910: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3911: <code class="prompt">#</code> <strong class=
                   3912: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3913: <code class="prompt">#</code> <strong class=
                   3914: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3915: <code class="prompt">#</code> <strong class=
                   3916: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3917: <code class="prompt">#</code> <strong class=
                   3918: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3919: <code class="prompt">#</code> <strong class=
                   3920: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3921: </pre>
                   3922: 
                   3923:             <p>Now create the images:</p>
                   3924:             <pre class="screen">
1.14      xtraeme  3925: <code class="prompt">#</code> <strong class=
                   3926: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3927: </pre>
                   3928: 
1.14      xtraeme  3929:             <p>Each image will contain <code class=
                   3930:             "filename">README</code>, <code class=
                   3931:             "filename">COPYING</code>, and <code class=
                   3932:             "filename">bin/myscript</code> in their root
1.1       grant    3933:             directories.</p>
                   3934:           </div>
                   3935:         </div>
                   3936:       </div>
                   3937: 
                   3938:       <div class="chapter" lang="en" xml:lang="en">
                   3939:         <div class="titlepage">
                   3940:           <div>
                   3941:             <div>
                   3942:               <h2 class="title"><a name="faq" id=
                   3943:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3944:               Questions</h2>
                   3945:             </div>
                   3946:           </div>
                   3947:         </div>
                   3948: 
                   3949:         <div class="toc">
                   3950:           <p><b>Table of Contents</b></p>
                   3951: 
                   3952:           <dl>
1.30    ! wiz      3953:             <dt><span class="sect1"><a href=
        !          3954:             "#mailing-list-pointers">6.1. Are there any mailing
        !          3955:             lists for pkg-related discussion?</a></span></dt>
1.1       grant    3956: 
1.30    ! wiz      3957:             <dt><span class="sect1"><a href="#pkgviews-docs">6.2.
1.1       grant    3958:             Where's the pkgviews documentation?</a></span></dt>
                   3959: 
1.5       hubertf  3960:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3961:             Utilities for package management
                   3962:             (pkgtools)</a></span></dt>
                   3963: 
1.30    ! wiz      3964:             <dt><span class="sect1"><a href="#non-root-pkgsrc">6.4.
        !          3965:             How to use pkgsrc as non-root</a></span></dt>
1.1       grant    3966: 
1.30    ! wiz      3967:             <dt><span class="sect1"><a href=
        !          3968:             "#resume-transfers">6.5. How to resume transfers when
        !          3969:             fetching distfiles?</a></span></dt>
1.14      xtraeme  3970: 
1.30    ! wiz      3971:             <dt><span class="sect1"><a href=
        !          3972:             "#XFree86-from-pkgsrc">6.6. How can I install/use
        !          3973:             XFree86 from pkgsrc?</a></span></dt>
1.1       grant    3974: 
1.30    ! wiz      3975:             <dt><span class="sect1"><a href=
        !          3976:             "#x.org-from-pkgsrc">6.7. How can I install/use X.org
        !          3977:             from pkgsrc?</a></span></dt>
1.1       grant    3978: 
1.30    ! wiz      3979:             <dt><span class="sect1"><a href=
        !          3980:             "#fetch-behind-firewall">6.8. How to fetch files from
        !          3981:             behind a firewall</a></span></dt>
1.1       grant    3982: 
1.30    ! wiz      3983:             <dt><span class="sect1"><a href="#passive-ftp">6.9. How
1.14      xtraeme  3984:             do I tell <span><strong class="command">make
                   3985:             fetch</strong></span> to do passive
                   3986:             FTP?</a></span></dt>
1.1       grant    3987: 
1.30    ! wiz      3988:             <dt><span class="sect1"><a href=
        !          3989:             "#fetching-all-distfiles">6.10. How to fetch all
        !          3990:             distfiles at once</a></span></dt>
1.1       grant    3991: 
1.30    ! wiz      3992:             <dt><span class="sect1"><a href=
        !          3993:             "#tmac.andoc-missing">6.11. What does
        !          3994:             &#8220;<span class="quote">Don't know how to make
1.14      xtraeme  3995:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3996:             mean?</a></span></dt>
                   3997: 
1.30    ! wiz      3998:             <dt><span class="sect1"><a href=
        !          3999:             "#bsd.own.mk-missing">6.12. What does
        !          4000:             &#8220;<span class="quote">Could not find
1.14      xtraeme  4001:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    4002: 
1.30    ! wiz      4003:             <dt><span class="sect1"><a href=
        !          4004:             "#using-sudo-with-pkgsrc">6.13. Using 'sudo' with
        !          4005:             pkgsrc</a></span></dt>
1.1       grant    4006: 
1.14      xtraeme  4007:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    4008:             Configuration files handling and
                   4009:             placement</a></span></dt>
                   4010: 
1.14      xtraeme  4011:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    4012:             Automated security checks</a></span></dt>
                   4013:           </dl>
                   4014:         </div>
                   4015: 
                   4016:         <p>This section contains hints, tips &amp; tricks on
                   4017:         special things in pkgsrc that we didn't find a better place
                   4018:         for in the previous chapters, and it contains items for
                   4019:         both pkgsrc users and developers.</p>
                   4020: 
                   4021:         <div class="sect1" lang="en" xml:lang="en">
                   4022:           <div class="titlepage">
                   4023:             <div>
                   4024:               <div>
                   4025:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4026:                 "mailing-list-pointers" id=
        !          4027:                 "mailing-list-pointers"></a>6.1.&nbsp;Are there any
        !          4028:                 mailing lists for pkg-related discussion?</h2>
1.1       grant    4029:               </div>
                   4030:             </div>
                   4031:           </div>
                   4032: 
1.18      xtraeme  4033:           <p>The following mailing lists may be of interest to
                   4034:           pkgsrc users:</p>
                   4035: 
                   4036:           <div class="itemizedlist">
                   4037:             <ul type="disc">
                   4038:               <li>
                   4039:                 <p><a href=
                   4040:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20      ben      4041:                 target="_top">pkgsrc-bugs</a> -- a list where
                   4042:                 problem reports related to pkgsrc are sent and
                   4043:                 discussed</p>
1.18      xtraeme  4044:               </li>
                   4045: 
                   4046:               <li>
                   4047:                 <p><a href=
                   4048:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20      ben      4049:                 target="_top">pkgsrc-bulk</a> -- a list where the
                   4050:                 results of pkgsrc bulk builds are sent and
                   4051:                 discussed</p>
1.18      xtraeme  4052:               </li>
                   4053: 
                   4054:               <li>
                   4055:                 <p><a href=
                   4056:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20      ben      4057:                 target="_top">pkgsrc-changes</a> -- a list where
                   4058:                 all commit messages to pkgsrc are sent</p>
1.18      xtraeme  4059:               </li>
                   4060: 
                   4061:               <li>
                   4062:                 <p><a href=
                   4063:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20      ben      4064:                 target="_top">tech-pkg</a> -- a general discussion
                   4065:                 list for all things related to pkgsrc</p>
1.18      xtraeme  4066:               </li>
                   4067:             </ul>
                   4068:           </div>
                   4069: 
                   4070:           <p>To subscribe, do:</p>
1.1       grant    4071:           <pre class="programlisting">
1.18      xtraeme  4072: <code class="prompt">%</code> echo subscribe <em class=
                   4073: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    4074: </pre>
                   4075: 
1.18      xtraeme  4076:           <p>Archives for all these mailing lists are available
                   4077:           from <a href="http://mail-index.NetBSD.org/" target=
                   4078:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    4079:         </div>
                   4080: 
                   4081:         <div class="sect1" lang="en" xml:lang="en">
                   4082:           <div class="titlepage">
                   4083:             <div>
                   4084:               <div>
                   4085:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4086:                 "pkgviews-docs" id=
        !          4087:                 "pkgviews-docs"></a>6.2.&nbsp;Where's the pkgviews
        !          4088:                 documentation?</h2>
1.1       grant    4089:               </div>
                   4090:             </div>
                   4091:           </div>
                   4092: 
                   4093:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  4094:           find a pkgviews User's guide in <code class=
                   4095:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    4096:         </div>
                   4097: 
                   4098:         <div class="sect1" lang="en" xml:lang="en">
                   4099:           <div class="titlepage">
                   4100:             <div>
                   4101:               <div>
                   4102:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  4103:                 "faq-pkgtools" id=
                   4104:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   4105:                 management (pkgtools)</h2>
1.1       grant    4106:               </div>
                   4107:             </div>
                   4108:           </div>
                   4109: 
1.14      xtraeme  4110:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    4111:           directory pkgtools contains a number of useful utilities
                   4112:           for both users and developers of pkgsrc. This section
                   4113:           attempts only to make the reader aware of the utilities
                   4114:           and when they might be useful, and not to duplicate the
                   4115:           documentation that comes with each package.</p>
                   4116: 
                   4117:           <p>Utilities used by pkgsrc (automatically installed when
                   4118:           needed):</p>
                   4119: 
                   4120:           <div class="itemizedlist">
                   4121:             <ul type="disc">
                   4122:               <li>
                   4123:                 <p><a xmlns=
                   4124:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4125:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20      ben      4126:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   4127:                 for use by buildlink</p>
1.1       grant    4128:               </li>
                   4129:             </ul>
                   4130:           </div>
                   4131: 
                   4132:           <p>OS tool augmentation (automatically installed when
                   4133:           needed):</p>
                   4134: 
                   4135:           <div class="itemizedlist">
                   4136:             <ul type="disc">
                   4137:               <li>
                   4138:                 <p><a xmlns=
                   4139:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4140:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      4141:                 class="pkgname">pkgtools/digest</a>: calculates
1.27      rillig   4142:                 various kinds of checksums (including SHA1)</p>
1.1       grant    4143:               </li>
                   4144: 
                   4145:               <li>
                   4146:                 <p><a xmlns=
                   4147:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4148:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27      rillig   4149:                 class="pkgname">pkgtools/libnbcompat</a>:
                   4150:                 compatibility library for pkgsrc tools</p>
1.1       grant    4151:               </li>
                   4152: 
                   4153:               <li>
                   4154:                 <p><a xmlns=
                   4155:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4156:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20      ben      4157:                 class="pkgname">pkgtools/mtree</a>: installed on
                   4158:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    4159:               </li>
                   4160: 
                   4161:               <li>
                   4162:                 <p><a xmlns=
                   4163:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4164:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4165:                 class="pkgname">pkgtools/pkg_install</a>:
                   4166:                 up-to-date replacement for /usr/sbin/pkg_install,
                   4167:                 or for use on operating systems where pkg_install
                   4168:                 is not present</p>
1.1       grant    4169:               </li>
                   4170:             </ul>
                   4171:           </div>
                   4172: 
                   4173:           <p>Utilities used by pkgsrc (not automatically
                   4174:           installed):</p>
                   4175: 
                   4176:           <div class="itemizedlist">
                   4177:             <ul type="disc">
                   4178:               <li>
                   4179:                 <p><a xmlns=
                   4180:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4181:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20      ben      4182:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   4183:                 binary package from an already-installed package.
1.27      rillig   4184:                 used by <span><strong class="command">make
                   4185:                 replace</strong></span> to save the old package</p>
1.1       grant    4186:               </li>
                   4187: 
                   4188:               <li>
                   4189:                 <p><a xmlns=
                   4190:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4191:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20      ben      4192:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   4193:                 functionality to pkgsrc, allowing it to fetch
                   4194:                 distfiles from multiple locations. It currently
                   4195:                 supports the following methods: multiple CD-ROMs
                   4196:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4197:               </li>
                   4198: 
                   4199:               <li>
                   4200:                 <p><a xmlns=
                   4201:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4202:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      4203:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   4204:                 packages someplace else (enabled by default)</p>
1.1       grant    4205:               </li>
1.5       hubertf  4206: 
                   4207:               <li>
                   4208:                 <p><a xmlns=
                   4209:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4210:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      4211:                 class="pkgname">devel/cpuflags</a>: will determine
                   4212:                 the best compiler flags to optimise code for your
                   4213:                 current CPU and compiler.</p>
1.5       hubertf  4214:               </li>
1.1       grant    4215:             </ul>
                   4216:           </div>
                   4217: 
                   4218:           <p>Utilities for keeping track of installed packages,
                   4219:           being up to date, etc:</p>
                   4220: 
                   4221:           <div class="itemizedlist">
                   4222:             <ul type="disc">
                   4223:               <li>
                   4224:                 <p><a xmlns=
                   4225:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4226:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.27      rillig   4227:                 class="pkgname">pkgtools/pkg_chk</a>: reports on
                   4228:                 packages whose installed versions do not match the
                   4229:                 latest pkgsrc entries</p>
1.1       grant    4230:               </li>
                   4231: 
                   4232:               <li>
                   4233:                 <p><a xmlns=
                   4234:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4235:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20      ben      4236:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   4237:                 dependency graphs of packages, to aid in choosing a
                   4238:                 strategy for updating</p>
1.1       grant    4239:               </li>
                   4240: 
                   4241:               <li>
                   4242:                 <p><a xmlns=
                   4243:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4244:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.27      rillig   4245:                 class="pkgname">pkgtools/pkgdepgraph</a>: makes
                   4246:                 graphs from the output of <a xmlns=
                   4247:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4248:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
                   4249:                 class="pkgname">pkgtools/pkgdep</a> (uses
                   4250:                 graphviz)</p>
1.1       grant    4251:               </li>
                   4252: 
                   4253:               <li>
                   4254:                 <p><a xmlns=
                   4255:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4256:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.27      rillig   4257:                 class="pkgname">pkgtools/pkglint</a>: the
                   4258:                 pkglint(1) program checks a pkgsrc entry for
                   4259:                 errors, lintpkgsrc(1) does various checks on the
                   4260:                 complete pkgsrc system.</p>
1.1       grant    4261:               </li>
                   4262: 
                   4263:               <li>
                   4264:                 <p><a xmlns=
                   4265:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4266:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20      ben      4267:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   4268:                 packages you have installed</p>
1.1       grant    4269:               </li>
                   4270:             </ul>
                   4271:           </div>
                   4272: 
                   4273:           <p>Utilities for people maintaining or creating
                   4274:           individual packages:</p>
                   4275: 
                   4276:           <div class="itemizedlist">
                   4277:             <ul type="disc">
                   4278:               <li>
                   4279:                 <p><a xmlns=
                   4280:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4281:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      4282:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   4283:                 making and maintaining patches for a package
                   4284:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    4285:               </li>
                   4286: 
                   4287:               <li>
                   4288:                 <p><a xmlns=
                   4289:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4290:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4291:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4292:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4293:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   4294:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   4295:                 converting to pkgsrc</p>
1.1       grant    4296:               </li>
                   4297: 
                   4298:               <li>
                   4299:                 <p><a xmlns=
                   4300:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4301:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20      ben      4302:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   4303:                 pkgsrc to a Solaris package</p>
1.1       grant    4304:               </li>
                   4305:             </ul>
                   4306:           </div>
                   4307: 
                   4308:           <p>Utilities for people maintaining pkgsrc (or more
                   4309:           obscure pkg utilities)</p>
                   4310: 
                   4311:           <div class="itemizedlist">
                   4312:             <ul type="disc">
                   4313:               <li>
                   4314:                 <p><a xmlns=
                   4315:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4316:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20      ben      4317:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   4318:                 packages that conflict but aren't marked as
                   4319:                 such</p>
1.1       grant    4320:               </li>
                   4321: 
                   4322:               <li>
                   4323:                 <p><a xmlns=
                   4324:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4325:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20      ben      4326:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   4327:                 packages in a chrooted area</p>
1.1       grant    4328:               </li>
                   4329: 
                   4330:               <li>
                   4331:                 <p><a xmlns=
                   4332:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4333:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20      ben      4334:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   4335:                 version for chrooted cross builds</p>
1.1       grant    4336:               </li>
                   4337:             </ul>
                   4338:           </div>
                   4339:         </div>
                   4340: 
                   4341:         <div class="sect1" lang="en" xml:lang="en">
                   4342:           <div class="titlepage">
                   4343:             <div>
                   4344:               <div>
                   4345:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4346:                 "non-root-pkgsrc" id=
        !          4347:                 "non-root-pkgsrc"></a>6.4.&nbsp;How to use pkgsrc
        !          4348:                 as non-root</h2>
1.1       grant    4349:               </div>
                   4350:             </div>
                   4351:           </div>
                   4352: 
                   4353:           <p>If you want to use pkgsrc as non-root user, you can
                   4354:           set some variables to make pkgsrc work under these
                   4355:           conditions. Please see <a href=
                   4356:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20      ben      4357:           target="_top">this message</a> for more details.</p>
1.14      xtraeme  4358:         </div>
                   4359: 
                   4360:         <div class="sect1" lang="en" xml:lang="en">
                   4361:           <div class="titlepage">
                   4362:             <div>
                   4363:               <div>
                   4364:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4365:                 "resume-transfers" id=
        !          4366:                 "resume-transfers"></a>6.5.&nbsp;How to resume
        !          4367:                 transfers when fetching distfiles?</h2>
1.14      xtraeme  4368:               </div>
                   4369:             </div>
                   4370:           </div>
                   4371: 
1.15      xtraeme  4372:           <p>By default resuming transfers in pkgsrc is disabled,
                   4373:           but you can enable this feature by adding the option
                   4374:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4375:           into <code class="filename">/etc/mk.conf</code>. If,
                   4376:           during a fetch step, an incomplete distfile is found,
                   4377:           pkgsrc will try to resume it.</p>
                   4378: 
                   4379:           <p>You can also use a different program than the default
1.24      wiz      4380:           <a href=
                   4381:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4382:           <span class="citerefentry"><span class=
                   4383:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   4384:           <code class="varname">FETCH_CMD</code> variable. Don't
                   4385:           forget to set <code class=
                   4386:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   4387:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   4388:           default values.</p>
1.14      xtraeme  4389: 
                   4390:           <p>For example, if you want to use <code class=
                   4391:           "filename">wget</code> to resume downloads, you'll have
                   4392:           to use something like:</p>
                   4393:           <pre class="programlisting">
                   4394:         FETCH_CMD=wget
                   4395:         FETCH_BEFORE_ARGS=--passive-ftp
                   4396:         FETCH_RESUME_ARGS=-c
                   4397:         FETCH_OUTPUT_ARGS=-O
                   4398:     
                   4399: </pre>
1.1       grant    4400:         </div>
                   4401: 
                   4402:         <div class="sect1" lang="en" xml:lang="en">
                   4403:           <div class="titlepage">
                   4404:             <div>
                   4405:               <div>
                   4406:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4407:                 "XFree86-from-pkgsrc" id=
        !          4408:                 "XFree86-from-pkgsrc"></a>6.6.&nbsp;How can I
1.1       grant    4409:                 install/use XFree86 from pkgsrc?</h2>
                   4410:               </div>
                   4411:             </div>
                   4412:           </div>
                   4413: 
                   4414:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4415:           system's own X11 (<code class=
                   4416:           "filename">/usr/X11R6</code>, <code class=
                   4417:           "filename">/usr/openwin</code>, ...), you will have to
                   4418:           add the following line into <code class=
1.15      xtraeme  4419:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4420:           <pre class="programlisting">
                   4421:       X11_TYPE=XFree86
                   4422:     
                   4423: </pre>
                   4424:         </div>
                   4425: 
                   4426:         <div class="sect1" lang="en" xml:lang="en">
                   4427:           <div class="titlepage">
                   4428:             <div>
                   4429:               <div>
                   4430:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4431:                 "x.org-from-pkgsrc" id=
        !          4432:                 "x.org-from-pkgsrc"></a>6.7.&nbsp;How can I
1.1       grant    4433:                 install/use X.org from pkgsrc?</h2>
                   4434:               </div>
                   4435:             </div>
                   4436:           </div>
                   4437: 
                   4438:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4439:           system's own X11 (<code class=
                   4440:           "filename">/usr/X11R6</code>, <code class=
                   4441:           "filename">/usr/openwin</code>, ...) you will have to add
                   4442:           the following line into <code class=
1.15      xtraeme  4443:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4444:           <pre class="programlisting">
                   4445:       X11_TYPE=xorg
                   4446:     
                   4447: </pre>
                   4448:         </div>
                   4449: 
                   4450:         <div class="sect1" lang="en" xml:lang="en">
                   4451:           <div class="titlepage">
                   4452:             <div>
                   4453:               <div>
                   4454:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4455:                 "fetch-behind-firewall" id=
        !          4456:                 "fetch-behind-firewall"></a>6.8.&nbsp;How to fetch
        !          4457:                 files from behind a firewall</h2>
1.1       grant    4458:               </div>
                   4459:             </div>
                   4460:           </div>
                   4461: 
                   4462:           <p>If you are sitting behind a firewall which does not
                   4463:           allow direct connections to Internet hosts (i.e.
                   4464:           non-NAT), you may specify the relevant proxy hosts. This
                   4465:           is done using an environment variable in the form of a
                   4466:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4467:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4468:           firewalls, and it uses port 80 as the proxy port number.
                   4469:           So the proxy environment variables are:</p>
                   4470:           <pre class="programlisting">
                   4471:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4472: http_proxy=http://orpheus.amdahl.com:80/
                   4473: </pre>
                   4474:         </div>
                   4475: 
                   4476:         <div class="sect1" lang="en" xml:lang="en">
                   4477:           <div class="titlepage">
                   4478:             <div>
                   4479:               <div>
                   4480:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4481:                 "passive-ftp" id="passive-ftp"></a>6.9.&nbsp;How do
        !          4482:                 I tell <span><strong class="command">make
1.14      xtraeme  4483:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4484:               </div>
                   4485:             </div>
                   4486:           </div>
                   4487: 
                   4488:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4489:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4490:           <code class="varname">FETCH_CMD</code> is assigned the
                   4491:           first available command from the following list:</p>
1.1       grant    4492:           <pre class="programlisting">
                   4493: ${LOCALBASE}/bin/ftp
                   4494: /usr/bin/ftp
                   4495: </pre>
                   4496: 
                   4497:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4498:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4499:           automatically tries passive connections first, and falls
                   4500:           back to active connections if the server refuses to do
                   4501:           passive. For the other tools, add the following to your
1.14      xtraeme  4502:           <code class="filename">/etc/mk.conf</code> file:
                   4503:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4504: 
1.14      xtraeme  4505:           <p>Having that option present will prevent <code class=
                   4506:           "filename">/usr/bin/ftp</code> from falling back to
                   4507:           active transfers.</p>
1.1       grant    4508:         </div>
                   4509: 
                   4510:         <div class="sect1" lang="en" xml:lang="en">
                   4511:           <div class="titlepage">
                   4512:             <div>
                   4513:               <div>
                   4514:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4515:                 "fetching-all-distfiles" id=
        !          4516:                 "fetching-all-distfiles"></a>6.10.&nbsp;How to
1.1       grant    4517:                 fetch all distfiles at once</h2>
                   4518:               </div>
                   4519:             </div>
                   4520:           </div>
                   4521: 
                   4522:           <p>You would like to download all the distfiles in a
                   4523:           single batch from work or university, where you can't run
1.14      xtraeme  4524:           a <span><strong class="command">make
                   4525:           fetch</strong></span>. There is an archive of distfiles
                   4526:           on <a href=
1.1       grant    4527:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4528:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4529:           entire directory may not be appropriate.</p>
                   4530: 
1.14      xtraeme  4531:           <p>The answer here is to do a <span><strong class=
                   4532:           "command">make fetch-list</strong></span> in <code class=
                   4533:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4534:           subdirectories, carry the resulting list to your machine
1.23      wiz      4535:           at work/school and use it there. If you don't have a
1.24      wiz      4536:           NetBSD-compatible <a href=
                   4537:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4538:           <span class="citerefentry"><span class=
                   4539:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   4540:           at work, don't forget to set <code class=
                   4541:           "varname">FETCH_CMD</code> to something that fetches a
                   4542:           URL:</p>
1.1       grant    4543: 
                   4544:           <p>At home:</p>
                   4545:           <pre class="screen">
1.14      xtraeme  4546: <code class="prompt">%</code> <strong class=
                   4547: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4548: <code class="prompt">%</code> <strong class=
                   4549: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4550: <code class="prompt">%</code> <strong class=
                   4551: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4552: </pre>
                   4553: 
                   4554:           <p>At work:</p>
                   4555:           <pre class="screen">
1.14      xtraeme  4556: <code class="prompt">%</code> <strong class=
                   4557: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4558: </pre>
                   4559: 
1.14      xtraeme  4560:           <p>then tar up <code class=
                   4561:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4562: 
                   4563:           <p>If you have a machine running NetBSD, and you want to
                   4564:           get <span class="emphasis"><em>all</em></span> distfiles
                   4565:           (even ones that aren't for your machine architecture),
                   4566:           you can do so by using the above-mentioned
1.14      xtraeme  4567:           <span><strong class="command">make
                   4568:           fetch-list</strong></span> approach, or fetch the
                   4569:           distfiles directly by running:</p>
1.1       grant    4570:           <pre class="screen">
1.14      xtraeme  4571: <code class="prompt">%</code> <strong class=
                   4572: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4573: </pre>
                   4574: 
1.14      xtraeme  4575:           <p>If you even decide to ignore <code class=
                   4576:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4577:           can get everything by running:</p>
1.1       grant    4578:           <pre class="screen">
1.14      xtraeme  4579: <code class="prompt">%</code> <strong class=
                   4580: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4581: </pre>
                   4582:         </div>
                   4583: 
                   4584:         <div class="sect1" lang="en" xml:lang="en">
                   4585:           <div class="titlepage">
                   4586:             <div>
                   4587:               <div>
                   4588:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4589:                 "tmac.andoc-missing" id=
        !          4590:                 "tmac.andoc-missing"></a>6.11.&nbsp;What does
1.1       grant    4591:                 &#8220;<span class="quote">Don't know how to make
                   4592:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4593:               </div>
                   4594:             </div>
                   4595:           </div>
                   4596: 
                   4597:           <p>When compiling the <a xmlns=
                   4598:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4599:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4600:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4601:           the error from make that it doesn't know how to make
                   4602:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4603:           This indicates that you don't have installed the
1.23      wiz      4604:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   4605:           ...) from the NetBSD base distribution on your machine.
                   4606:           It is recommended to do that to format manpages.</p>
1.1       grant    4607: 
                   4608:           <p>In the case of the <a xmlns=
                   4609:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4610:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4611:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4612:           get away with setting <code class=
                   4613:           "varname">NOMAN=YES</code> either in the environment or
                   4614:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4615:         </div>
                   4616: 
                   4617:         <div class="sect1" lang="en" xml:lang="en">
                   4618:           <div class="titlepage">
                   4619:             <div>
                   4620:               <div>
                   4621:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4622:                 "bsd.own.mk-missing" id=
        !          4623:                 "bsd.own.mk-missing"></a>6.12.&nbsp;What does
1.1       grant    4624:                 &#8220;<span class="quote">Could not find
                   4625:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4626:               </div>
                   4627:             </div>
                   4628:           </div>
                   4629: 
1.14      xtraeme  4630:           <p>You didn't install the compiler set, <code class=
                   4631:           "filename">comp.tgz</code>, when you installed your
                   4632:           NetBSD machine. Please get it and install it, by
                   4633:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4634:           <pre class="screen">
1.14      xtraeme  4635: <code class="prompt">#</code> <strong class=
                   4636: "userinput"><code>cd /</code></strong>
                   4637: <code class="prompt">#</code> <strong class=
                   4638: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4639: </pre>
                   4640: 
1.14      xtraeme  4641:           <p><code class="filename">comp.tgz</code> is part of
                   4642:           every NetBSD release. Get the one that corresponds to
                   4643:           your release (determine via <span><strong class=
                   4644:           "command">uname -r</strong></span>).</p>
1.1       grant    4645:         </div>
                   4646: 
                   4647:         <div class="sect1" lang="en" xml:lang="en">
                   4648:           <div class="titlepage">
                   4649:             <div>
                   4650:               <div>
                   4651:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      4652:                 "using-sudo-with-pkgsrc" id=
        !          4653:                 "using-sudo-with-pkgsrc"></a>6.13.&nbsp;Using
1.1       grant    4654:                 'sudo' with pkgsrc</h2>
                   4655:               </div>
                   4656:             </div>
                   4657:           </div>
                   4658: 
                   4659:           <p>When installing packages as non-root user and using
1.24      wiz      4660:           the just-in-time <a href=
                   4661:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   4662:           <span class="citerefentry"><span class=
                   4663:           "refentrytitle">su</span>(1)</span></a> feature of
                   4664:           pkgsrc, it can become annoying to type in the root
                   4665:           password for each required package installed. To avoid
                   4666:           this, the sudo package can be used, which does password
                   4667:           caching over a limited time. To use it, install sudo
                   4668:           (either as binary package or from <a xmlns=
                   4669:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4670:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4671:           class="pkgname">security/sudo</a>) and then put the
                   4672:           following into your <code class=
                   4673:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4674:           <pre class="programlisting">
1.23      wiz      4675:         .if exists(${LOCALBASE}/bin/sudo)
                   4676:         SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1       grant    4677:         .endif
                   4678:     
                   4679: </pre>
                   4680:         </div>
                   4681: 
                   4682:         <div class="sect1" lang="en" xml:lang="en">
                   4683:           <div class="titlepage">
                   4684:             <div>
                   4685:               <div>
                   4686:                 <h2 class="title" style="clear: both"><a name=
                   4687:                 "faq.conf" id=
1.14      xtraeme  4688:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4689:                 handling and placement</h2>
                   4690:               </div>
                   4691:             </div>
                   4692:           </div>
                   4693: 
1.14      xtraeme  4694:           <p>The global variable <code class=
                   4695:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4696:           set by the system administrator in <code class=
                   4697:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4698:           configuration files get installed. Therefore, packages
                   4699:           must be adapted to support this feature. Keep in mind
                   4700:           that you should only install files that are strictly
                   4701:           necessary in the configuration directory, files that can
1.14      xtraeme  4702:           go to <code class="filename">$PREFIX/share</code> should
                   4703:           go there.</p>
1.1       grant    4704: 
                   4705:           <p>We will take a look at available variables first
1.14      xtraeme  4706:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4707:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4708:           is where the configuration files for a package may be
                   4709:           found (that is, the full path, e.g. <code class=
                   4710:           "filename">/etc</code> or <code class=
                   4711:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4712:           customized in various ways:</p>
                   4713: 
                   4714:           <div class="orderedlist">
                   4715:             <ol type="1">
                   4716:               <li>
1.14      xtraeme  4717:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4718:                 the main config directory under which all package
1.1       grant    4719:                 configuration files are to be found. Users will
1.14      xtraeme  4720:                 typically want to set it to <code class=
                   4721:                 "filename">/etc</code>, or accept the default
                   4722:                 location of <code class=
                   4723:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4724:               </li>
                   4725: 
                   4726:               <li>
1.14      xtraeme  4727:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4728:                 is the subdirectory of <code class=
                   4729:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4730:                 configuration files for a particular package may be
1.14      xtraeme  4731:                 found. Defaults to <code class=
                   4732:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4733:               </li>
                   4734: 
                   4735:               <li>
1.14      xtraeme  4736:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4737:                 the special suffix used to distinguish any
                   4738:                 overriding values for a particular package (see
                   4739:                 next item). It defaults to <code class=
                   4740:                 "varname">${PKGBASE}</code>, but for a collection
                   4741:                 of related packages that should all have the same
                   4742:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4743:                 it can be set in each of the package Makefiles to a
                   4744:                 common value.</p>
1.1       grant    4745:               </li>
                   4746: 
                   4747:               <li>
1.14      xtraeme  4748:                 <p><code class=
                   4749:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4750:                 overrides the value of <code class=
                   4751:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4752:                 with the same value for <code class=
                   4753:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4754: 
                   4755:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4756:                 want to set <code class=
                   4757:                 "varname">PKG_SYSCONFVAR</code> to
                   4758:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4759:                 admins can set <code class=
                   4760:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4761:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4762:                 install KDE config files.</p>
                   4763:               </li>
                   4764:             </ol>
                   4765:           </div>
                   4766: 
                   4767:           <p>Programs' configuration directory should be defined
                   4768:           during the configure stage. Packages that use GNU
                   4769:           autoconf can usually do this by using the
                   4770:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4771:           parameter, but this brings some problems as we will see
                   4772:           now. When you change this pathname in packages, you
                   4773:           should not allow them to install files in that directory
                   4774:           directly. Instead they need to install those files under
1.14      xtraeme  4775:           <code class="filename">share/examples/${PKGNAME}</code>
                   4776:           so <code class="filename">PLIST</code> can register
                   4777:           them.</p>
1.1       grant    4778: 
                   4779:           <p>Once you have the required configuration files in
1.14      xtraeme  4780:           place (under the <code class=
                   4781:           "filename">share/examples</code> directory) the variable
                   4782:           <code class="varname">CONF_FILES</code> should be set to
                   4783:           copy them into <code class=
                   4784:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4785:           variable is formed by pairs of filenames; the first
1.1       grant    4786:           element of the pair specifies the file inside the
1.14      xtraeme  4787:           examples directory (registered by <code class=
                   4788:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4789:           the target file. This is done this way to allow binary
                   4790:           packages to place files in the right directory using
1.14      xtraeme  4791:           <code class="filename">INSTALL</code>/<code class=
                   4792:           "filename">DEINSTALL</code> scripts which are created
                   4793:           automatically. The package <code class=
                   4794:           "filename">Makefile</code> must also set <code class=
                   4795:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4796:           automatically generated scripts. The automatic copying of
                   4797:           config files can be toggled by setting the environment
1.14      xtraeme  4798:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4799:           package installation.</p>
                   4800: 
                   4801:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4802:           <pre class="programlisting">
                   4803:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4804: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4805: </pre>
                   4806: 
                   4807:           <p>As you can see, this package installs configuration
1.14      xtraeme  4808:           files inside <code class="varname">EGDIR</code>, which
                   4809:           are registered by <code class="filename">PLIST</code>.
                   4810:           After that, the variable <code class=
                   4811:           "varname">CONF_FILES</code> lists the installed file
                   4812:           first and then the target file. Users will also get an
                   4813:           automatic message when files are installed using this
                   4814:           method.</p>
1.1       grant    4815:         </div>
                   4816: 
                   4817:         <div class="sect1" lang="en" xml:lang="en">
                   4818:           <div class="titlepage">
                   4819:             <div>
                   4820:               <div>
                   4821:                 <h2 class="title" style="clear: both"><a name=
                   4822:                 "audit-packages" id=
1.14      xtraeme  4823:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4824:                 checks</h2>
                   4825:               </div>
                   4826:             </div>
                   4827:           </div>
                   4828: 
                   4829:           <p>Please be aware that there can often be bugs in
                   4830:           third-party software, and some of these bugs can leave a
                   4831:           machine vulnerable to exploitation by attackers. In an
                   4832:           effort to lessen the exposure, the NetBSD packages team
                   4833:           maintains a database of known-exploits to packages which
                   4834:           have at one time been included in pkgsrc. The database
                   4835:           can be downloaded automatically, and a security audit of
                   4836:           all packages installed on a system can take place. To do
                   4837:           this, install the <a xmlns=
                   4838:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4839:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20      ben      4840:           class="pkgname">security/audit-packages</a> package. It
                   4841:           has two components:</p>
1.1       grant    4842: 
                   4843:           <div class="orderedlist">
                   4844:             <ol type="1">
                   4845:               <li>
                   4846:                 <p>&#8220;<span class=
                   4847:                 "quote">download-vulnerability-list</span>&#8221;,
                   4848:                 an easy way to download a list of the security
                   4849:                 vulnerabilities information. This list is kept up
                   4850:                 to date by the NetBSD security officer and the
                   4851:                 NetBSD packages team, and is distributed from the
                   4852:                 NetBSD ftp server:</p>
                   4853: 
                   4854:                 <p><a href=
                   4855:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      4856:                 target=
                   4857:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4858:               </li>
                   4859: 
                   4860:               <li>
                   4861:                 <p>&#8220;<span class=
                   4862:                 "quote">audit-packages</span>&#8221;, an easy way
                   4863:                 to audit the current machine, checking each
                   4864:                 vulnerability which is known. If a vulnerable
                   4865:                 package is installed, it will be shown by output to
                   4866:                 stdout, including a description of the type of
                   4867:                 vulnerability, and a URL containing more
                   4868:                 information.</p>
                   4869:               </li>
                   4870:             </ol>
                   4871:           </div>
                   4872: 
1.23      wiz      4873:           <p>Use of the <a xmlns=
                   4874:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4875:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   4876:           class="pkgname">security/audit-packages</a> package is
                   4877:           strongly recommended! After &#8220;<span class=
                   4878:           "quote">audit-packages</span>&#8221; is installed, please
                   4879:           read the package's message, which you can get by running
                   4880:           <strong class="userinput"><code>pkg_info -D
                   4881:           audit-package</code></strong>.</p>
1.1       grant    4882:         </div>
                   4883:       </div>
                   4884:     </div>
                   4885: 
                   4886:     <div class="part" lang="en" xml:lang="en">
                   4887:       <div class="titlepage">
                   4888:         <div>
                   4889:           <div>
                   4890:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4891:             "developers-guide"></a>The pkgsrc developer's
                   4892:             guide</h1>
1.1       grant    4893:           </div>
                   4894:         </div>
                   4895:       </div>
                   4896: 
                   4897:       <div class="toc">
                   4898:         <p><b>Table of Contents</b></p>
                   4899: 
                   4900:         <dl>
1.27      rillig   4901:           <dt><span class="chapter"><a href="#components">7.
                   4902:           Package components - files, directories and
                   4903:           contents</a></span></dt>
                   4904: 
                   4905:           <dd>
                   4906:             <dl>
                   4907:               <dt><span class="sect1"><a href=
                   4908:               "#components.Makefile">7.1. <code class=
                   4909:               "filename">Makefile</code></a></span></dt>
                   4910: 
                   4911:               <dt><span class="sect1"><a href=
                   4912:               "#components.distinfo">7.2. <code class=
                   4913:               "filename">distinfo</code></a></span></dt>
                   4914: 
                   4915:               <dt><span class="sect1"><a href=
                   4916:               "#components.patches">7.3. patches/*</a></span></dt>
                   4917: 
1.30    ! wiz      4918:               <dt><span class="sect1"><a href=
        !          4919:               "#other-mandatory-files">7.4. Other mandatory
        !          4920:               files</a></span></dt>
1.27      rillig   4921: 
                   4922:               <dt><span class="sect1"><a href=
                   4923:               "#components.optional">7.5. Optional
                   4924:               files</a></span></dt>
                   4925: 
1.30    ! wiz      4926:               <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig   4927:               <code class="filename">work*</code></a></span></dt>
                   4928: 
1.30    ! wiz      4929:               <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig   4930:               <code class="filename">files/*</code></a></span></dt>
                   4931:             </dl>
                   4932:           </dd>
                   4933: 
                   4934:           <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig   4935:           Programming in <code class=
                   4936:           "filename">Makefile</code>s</a></span></dt>
                   4937: 
                   4938:           <dd>
                   4939:             <dl>
                   4940:               <dt><span class="sect1"><a href=
1.27      rillig   4941:               "#makefile.variables">8.1. <code class=
1.25      rillig   4942:               "filename">Makefile</code> variables</a></span></dt>
                   4943: 
1.27      rillig   4944:               <dd>
                   4945:                 <dl>
                   4946:                   <dt><span class="sect2"><a href=
                   4947:                   "#makefile.variables.names">8.1.1. Naming
                   4948:                   conventions</a></span></dt>
                   4949:                 </dl>
                   4950:               </dd>
                   4951: 
                   4952:               <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25      rillig   4953:               Code snippets</a></span></dt>
                   4954: 
                   4955:               <dd>
                   4956:                 <dl>
                   4957:                   <dt><span class="sect2"><a href=
1.30    ! wiz      4958:                   "#adding-to-list">8.2.1. Adding things to a
1.25      rillig   4959:                   list</a></span></dt>
                   4960: 
                   4961:                   <dt><span class="sect2"><a href=
1.30    ! wiz      4962:                   "#converting-internal-to-external">8.2.2.
        !          4963:                   Converting an internal list into an external
        !          4964:                   list</a></span></dt>
1.25      rillig   4965: 
                   4966:                   <dt><span class="sect2"><a href=
1.30    ! wiz      4967:                   "#passing-variable-to-shell">8.2.3. Passing
        !          4968:                   variables to a shell command</a></span></dt>
1.27      rillig   4969: 
                   4970:                   <dt><span class="sect2"><a href=
1.30    ! wiz      4971:                   "#quoting-guideline">8.2.4. Quoting
1.27      rillig   4972:                   guideline</a></span></dt>
                   4973: 
                   4974:                   <dt><span class="sect2"><a href=
1.30    ! wiz      4975:                   "#bsd-make-bug-workaround">8.2.5. Workaround for
        !          4976:                   a bug in BSD Make</a></span></dt>
1.25      rillig   4977:                 </dl>
                   4978:               </dd>
                   4979:             </dl>
                   4980:           </dd>
                   4981: 
                   4982:           <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant    4983:           issues</a></span></dt>
                   4984: 
                   4985:           <dd>
                   4986:             <dl>
1.30    ! wiz      4987:               <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1       grant    4988:               ID</a></span></dt>
                   4989: 
1.30    ! wiz      4990:               <dt><span class="sect1"><a href=
        !          4991:               "#automatic-plist-generation">9.2. Semi-automatic
        !          4992:               <code class="filename">PLIST</code>
1.14      xtraeme  4993:               generation</a></span></dt>
1.1       grant    4994: 
1.25      rillig   4995:               <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  4996:               Tweaking output of <span><strong class="command">make
                   4997:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4998: 
1.25      rillig   4999:               <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    5000:               Variable substitution in PLIST</a></span></dt>
                   5001: 
1.30    ! wiz      5002:               <dt><span class="sect1"><a href=
        !          5003:               "#manpage-compression">9.5.
1.1       grant    5004:               Manpage-compression</a></span></dt>
                   5005: 
1.30    ! wiz      5006:               <dt><span class="sect1"><a href=
        !          5007:               "#using-PLIST_SRC">9.6. Changing PLIST source with
        !          5008:               <code class=
1.14      xtraeme  5009:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5010: 
1.30    ! wiz      5011:               <dt><span class="sect1"><a href=
        !          5012:               "#platform-specific-plist">9.7. Platform specific and
        !          5013:               differing PLISTs</a></span></dt>
1.1       grant    5014: 
                   5015:               <dt><span class="sect1"><a href=
1.25      rillig   5016:               "#faq.common-dirs">9.8. Sharing directories between
1.1       grant    5017:               packages</a></span></dt>
                   5018:             </dl>
                   5019:           </dd>
                   5020: 
1.25      rillig   5021:           <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant    5022:           Buildlink methodology</a></span></dt>
                   5023: 
                   5024:           <dd>
                   5025:             <dl>
1.30    ! wiz      5026:               <dt><span class="sect1"><a href=
        !          5027:               "#converting-to-buildlink3">10.1. Converting packages
        !          5028:               to use buildlink3</a></span></dt>
1.1       grant    5029: 
1.30    ! wiz      5030:               <dt><span class="sect1"><a href=
        !          5031:               "#creating-buildlink3.mk">10.2. Writing <code class=
        !          5032:               "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    5033: 
                   5034:               <dd>
                   5035:                 <dl>
                   5036:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5037:                   "#anatomy-of-bl3">10.2.1. Anatomy of a
        !          5038:                   buildlink3.mk file</a></span></dt>
1.1       grant    5039: 
                   5040:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5041:                   "#updating-buildlink-depends">10.2.2. Updating
        !          5042:                   <code class=
        !          5043:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          5044:                   <code>pkg</code></em></code> in <code class=
        !          5045:                   "filename">buildlink3.mk</code>
1.1       grant    5046:                   files</a></span></dt>
                   5047:                 </dl>
                   5048:               </dd>
                   5049: 
1.30    ! wiz      5050:               <dt><span class="sect1"><a href=
        !          5051:               "#writing-builtin.mk">10.3. Writing <code class=
        !          5052:               "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    5053: 
                   5054:               <dd>
                   5055:                 <dl>
                   5056:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5057:                   "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
        !          5058:                   <code class="filename">builtin.mk</code>
        !          5059:                   file</a></span></dt>
1.1       grant    5060: 
                   5061:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5062:                   "#native-or-pkgsrc-preference">10.3.2. Global
        !          5063:                   preferences for native or pkgsrc
        !          5064:                   software</a></span></dt>
1.1       grant    5065:                 </dl>
                   5066:               </dd>
                   5067:             </dl>
                   5068:           </dd>
                   5069: 
1.25      rillig   5070:           <dt><span class="chapter"><a href="#options">11. Options
1.1       grant    5071:           handling</a></span></dt>
                   5072: 
                   5073:           <dd>
                   5074:             <dl>
1.30    ! wiz      5075:               <dt><span class="sect1"><a href=
        !          5076:               "#global-default-options">11.1. Global default
        !          5077:               options</a></span></dt>
1.1       grant    5078: 
1.30    ! wiz      5079:               <dt><span class="sect1"><a href=
        !          5080:               "#converting-to-options">11.2. Converting packages to
        !          5081:               use <code class=
1.14      xtraeme  5082:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    5083:             </dl>
                   5084:           </dd>
                   5085: 
1.25      rillig   5086:           <dt><span class="chapter"><a href="#build">12. The build
1.1       grant    5087:           process</a></span></dt>
                   5088: 
                   5089:           <dd>
                   5090:             <dl>
1.25      rillig   5091:               <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1       grant    5092:               Program location</a></span></dt>
                   5093: 
1.30    ! wiz      5094:               <dt><span class="sect1"><a href="#main-targets">12.2.
1.1       grant    5095:               Main targets</a></span></dt>
                   5096: 
                   5097:               <dt><span class="sect1"><a href=
1.25      rillig   5098:               "#build.helpful-targets">12.3. Other helpful
1.1       grant    5099:               targets</a></span></dt>
                   5100:             </dl>
                   5101:           </dd>
                   5102: 
1.25      rillig   5103:           <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1       grant    5104:           fixes for packages</a></span></dt>
                   5105: 
                   5106:           <dd>
                   5107:             <dl>
1.30    ! wiz      5108:               <dt><span class="sect1"><a href=
        !          5109:               "#general-operation">13.1. General
        !          5110:               operation</a></span></dt>
1.1       grant    5111: 
                   5112:               <dd>
                   5113:                 <dl>
                   5114:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5115:                   "#pulling-vars-from-etc-mk.conf">13.1.1. How to
        !          5116:                   pull in variables from
        !          5117:                   /etc/mk.conf</a></span></dt>
1.1       grant    5118: 
                   5119:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5120:                   "#restricted-packages">13.1.2. Restricted
1.1       grant    5121:                   packages</a></span></dt>
                   5122: 
                   5123:                   <dt><span class="sect2"><a href=
1.25      rillig   5124:                   "#dependencies">13.1.3. Handling
1.1       grant    5125:                   dependencies</a></span></dt>
                   5126: 
                   5127:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5128:                   "#conflicts">13.1.4. Handling conflicts with
1.1       grant    5129:                   other packages</a></span></dt>
                   5130: 
                   5131:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5132:                   "#not-building-packages">13.1.5. Packages that
        !          5133:                   cannot or should not be built</a></span></dt>
1.1       grant    5134: 
                   5135:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5136:                   "#undeletable-packages">13.1.6. Packages which
        !          5137:                   should not be deleted, once
        !          5138:                   installed</a></span></dt>
1.1       grant    5139: 
                   5140:                   <dt><span class="sect2"><a href=
1.25      rillig   5141:                   "#security-handling">13.1.7. Handling packages
1.1       grant    5142:                   with security problems</a></span></dt>
                   5143: 
                   5144:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5145:                   "#compiler-bugs">13.1.8. How to handle compiler
1.1       grant    5146:                   bugs</a></span></dt>
                   5147: 
                   5148:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5149:                   "#bumping-pkgrevision">13.1.9. How to handle
        !          5150:                   incrementing versions when fixing an existing
1.1       grant    5151:                   package</a></span></dt>
                   5152: 
                   5153:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5154:                   "#portability-of-packages">13.1.10. Portability
        !          5155:                   of packages</a></span></dt>
1.1       grant    5156:                 </dl>
                   5157:               </dd>
                   5158: 
1.30    ! wiz      5159:               <dt><span class="sect1"><a href=
        !          5160:               "#downloading-issues">13.2. Possible downloading
        !          5161:               issues</a></span></dt>
1.1       grant    5162: 
                   5163:               <dd>
                   5164:                 <dl>
                   5165:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5166:                   "#no-plain-download">13.2.1. Packages whose
        !          5167:                   distfiles aren't available for plain
1.1       grant    5168:                   downloading</a></span></dt>
                   5169: 
                   5170:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5171:                   "#modified-distfiles-same-name">13.2.2. How to
        !          5172:                   handle modified distfiles with the 'old'
        !          5173:                   name</a></span></dt>
1.1       grant    5174:                 </dl>
                   5175:               </dd>
                   5176: 
1.30    ! wiz      5177:               <dt><span class="sect1"><a href=
        !          5178:               "#configuration-gotchas">13.3. Configuration
        !          5179:               gotchas</a></span></dt>
1.1       grant    5180: 
                   5181:               <dd>
                   5182:                 <dl>
                   5183:                   <dt><span class="sect2"><a href=
1.25      rillig   5184:                   "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant    5185:                   libtool</a></span></dt>
                   5186: 
                   5187:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5188:                   "#using-libtool">13.3.2. Using libtool on GNU
1.1       grant    5189:                   packages that already support
                   5190:                   libtool</a></span></dt>
                   5191: 
                   5192:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5193:                   "#autoconf-automake">13.3.3. GNU
1.1       grant    5194:                   Autoconf/Automake</a></span></dt>
                   5195:                 </dl>
                   5196:               </dd>
                   5197: 
1.30    ! wiz      5198:               <dt><span class="sect1"><a href=
        !          5199:               "#building-considerations">13.4. Building
        !          5200:               considerations</a></span></dt>
1.1       grant    5201: 
                   5202:               <dd>
                   5203:                 <dl>
                   5204:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5205:                   "#cpp-defines">13.4.1. CPP
        !          5206:                   defines</a></span></dt>
1.1       grant    5207:                 </dl>
                   5208:               </dd>
                   5209: 
1.30    ! wiz      5210:               <dt><span class="sect1"><a href=
        !          5211:               "#package-specific-actions">13.5. Package specific
        !          5212:               actions</a></span></dt>
1.1       grant    5213: 
                   5214:               <dd>
                   5215:                 <dl>
                   5216:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5217:                   "#package-configuration-files">13.5.1. Package
        !          5218:                   configuration files</a></span></dt>
1.1       grant    5219: 
                   5220:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5221:                   "#user-interaction">13.5.2. User
1.2       hubertf  5222:                   interaction</a></span></dt>
1.1       grant    5223: 
                   5224:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5225:                   "#handling-licenses">13.5.3. Handling
1.1       grant    5226:                   licenses</a></span></dt>
                   5227: 
                   5228:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5229:                   "#creating-accounts">13.5.4. Creating an account
        !          5230:                   from a package</a></span></dt>
1.1       grant    5231: 
                   5232:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5233:                   "#installing-score-files">13.5.5. Installing
        !          5234:                   score files</a></span></dt>
1.1       grant    5235: 
                   5236:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5237:                   "#login-shells">13.5.6. Packages providing login
1.1       grant    5238:                   shells</a></span></dt>
                   5239: 
                   5240:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5241:                   "#perl-scripts">13.5.7. Packages containing perl
1.1       grant    5242:                   scripts</a></span></dt>
                   5243: 
                   5244:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5245:                   "#hardcoded-paths">13.5.8. Packages with
        !          5246:                   hardcoded paths to other
        !          5247:                   interpreters</a></span></dt>
1.1       grant    5248: 
                   5249:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5250:                   "#perl-modules">13.5.9. Packages installing perl
1.1       grant    5251:                   modules</a></span></dt>
                   5252: 
                   5253:                   <dt><span class="sect2"><a href=
1.25      rillig   5254:                   "#faq.info-files">13.5.10. Packages installing
1.1       grant    5255:                   info files</a></span></dt>
                   5256: 
                   5257:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5258:                   "#gconf2-data-files">13.5.11. Packages installing
        !          5259:                   GConf2 data files</a></span></dt>
1.1       grant    5260: 
                   5261:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5262:                   "#scrollkeeper-data-files">13.5.12. Packages
        !          5263:                   installing scrollkeeper data
        !          5264:                   files</a></span></dt>
1.1       grant    5265: 
                   5266:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5267:                   "#x11-fonts">13.5.13. Packages installing X11
1.1       grant    5268:                   fonts</a></span></dt>
                   5269: 
                   5270:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5271:                   "#gtk2-modules">13.5.14. Packages installing GTK2
1.1       grant    5272:                   modules</a></span></dt>
                   5273: 
                   5274:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5275:                   "#sgml-xml-data">13.5.15. Packages installing
        !          5276:                   SGML or XML data</a></span></dt>
1.1       grant    5277: 
                   5278:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5279:                   "#mime-database">13.5.16. Packages installing
1.1       grant    5280:                   extensions to the MIME database</a></span></dt>
                   5281: 
                   5282:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5283:                   "#intltool">13.5.17. Packages using
1.1       grant    5284:                   intltool</a></span></dt>
1.18      xtraeme  5285: 
                   5286:                   <dt><span class="sect2"><a href=
1.30    ! wiz      5287:                   "#startup-scripts">13.5.18. Packages installing
        !          5288:                   startup scripts</a></span></dt>
1.1       grant    5289:                 </dl>
                   5290:               </dd>
                   5291: 
1.30    ! wiz      5292:               <dt><span class="sect1"><a href=
        !          5293:               "#feedback-to-author">13.6. Feedback to the
        !          5294:               author</a></span></dt>
1.1       grant    5295:             </dl>
                   5296:           </dd>
                   5297: 
1.25      rillig   5298:           <dt><span class="chapter"><a href="#debug">14.
1.1       grant    5299:           Debugging</a></span></dt>
                   5300: 
1.25      rillig   5301:           <dt><span class="chapter"><a href="#submit">15.
1.1       grant    5302:           Submitting and Committing</a></span></dt>
                   5303: 
                   5304:           <dd>
                   5305:             <dl>
1.30    ! wiz      5306:               <dt><span class="sect1"><a href=
        !          5307:               "#submitting-your-package">15.1. Submitting your
        !          5308:               packages</a></span></dt>
1.1       grant    5309: 
1.30    ! wiz      5310:               <dt><span class="sect1"><a href=
        !          5311:               "#committing-importing">15.2. Committing: Importing a
        !          5312:               package into CVS</a></span></dt>
1.1       grant    5313: 
1.30    ! wiz      5314:               <dt><span class="sect1"><a href=
        !          5315:               "#updating-package">15.3. Updating a package to a
        !          5316:               newer version</a></span></dt>
1.1       grant    5317: 
1.30    ! wiz      5318:               <dt><span class="sect1"><a href=
        !          5319:               "#moving-package">15.4. Moving a package in
        !          5320:               pkgsrc</a></span></dt>
1.1       grant    5321:             </dl>
                   5322:           </dd>
                   5323:         </dl>
                   5324:       </div>
                   5325: 
                   5326:       <div class="chapter" lang="en" xml:lang="en">
                   5327:         <div class="titlepage">
                   5328:           <div>
                   5329:             <div>
1.27      rillig   5330:               <h2 class="title"><a name="components" id=
                   5331:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   5332:               components - files, directories and contents</h2>
1.25      rillig   5333:             </div>
                   5334:           </div>
                   5335:         </div>
                   5336: 
                   5337:         <div class="toc">
                   5338:           <p><b>Table of Contents</b></p>
                   5339: 
                   5340:           <dl>
                   5341:             <dt><span class="sect1"><a href=
1.27      rillig   5342:             "#components.Makefile">7.1. <code class=
                   5343:             "filename">Makefile</code></a></span></dt>
                   5344: 
                   5345:             <dt><span class="sect1"><a href=
                   5346:             "#components.distinfo">7.2. <code class=
                   5347:             "filename">distinfo</code></a></span></dt>
                   5348: 
                   5349:             <dt><span class="sect1"><a href=
                   5350:             "#components.patches">7.3. patches/*</a></span></dt>
1.25      rillig   5351: 
1.30    ! wiz      5352:             <dt><span class="sect1"><a href=
        !          5353:             "#other-mandatory-files">7.4. Other mandatory
        !          5354:             files</a></span></dt>
1.25      rillig   5355: 
1.27      rillig   5356:             <dt><span class="sect1"><a href=
                   5357:             "#components.optional">7.5. Optional
                   5358:             files</a></span></dt>
1.25      rillig   5359: 
1.30    ! wiz      5360:             <dt><span class="sect1"><a href="#work-dir">7.6.
1.27      rillig   5361:             <code class="filename">work*</code></a></span></dt>
1.25      rillig   5362: 
1.30    ! wiz      5363:             <dt><span class="sect1"><a href="#files-dir">7.7.
1.27      rillig   5364:             <code class="filename">files/*</code></a></span></dt>
1.25      rillig   5365:           </dl>
                   5366:         </div>
                   5367: 
1.27      rillig   5368:         <p>Whenever you're preparing a package, there are a number
                   5369:         of files involved which are described in the following
                   5370:         sections.</p>
1.25      rillig   5371: 
                   5372:         <div class="sect1" lang="en" xml:lang="en">
                   5373:           <div class="titlepage">
                   5374:             <div>
                   5375:               <div>
                   5376:                 <h2 class="title" style="clear: both"><a name=
1.27      rillig   5377:                 "components.Makefile" id=
                   5378:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5379:                 "filename">Makefile</code></h2>
1.25      rillig   5380:               </div>
                   5381:             </div>
                   5382:           </div>
                   5383: 
1.27      rillig   5384:           <p>Building, installation and creation of a binary
                   5385:           package are all controlled by the package's <code class=
                   5386:           "filename">Makefile</code>. The <code class=
                   5387:           "filename">Makefile</code> describes various things about
                   5388:           a package, for example from where to get it, how to
                   5389:           configure, build, and install it.</p>
                   5390: 
                   5391:           <p>A package <code class="filename">Makefile</code>
                   5392:           contains several sections that describe the package.</p>
1.25      rillig   5393: 
1.27      rillig   5394:           <p>In the first section there are the following
                   5395:           variables, which should appear exactly in the order given
                   5396:           here.</p>
1.25      rillig   5397: 
                   5398:           <div class="itemizedlist">
                   5399:             <ul type="disc">
                   5400:               <li>
1.27      rillig   5401:                 <p><code class="varname">DISTNAME</code> is the
                   5402:                 basename of the distribution file to be downloaded
                   5403:                 from the package's website.</p>
                   5404:               </li>
                   5405: 
                   5406:               <li>
                   5407:                 <p><code class="varname">PKGNAME</code> is the name
                   5408:                 of the package, as used by pkgsrc. You only need to
                   5409:                 provide it if it differs from DISTNAME. Usually it
                   5410:                 is the directory name together with the version
                   5411:                 number. It must match the regular expression
                   5412:                 <code class=
                   5413:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
                   5414:                 that is, it starts with a letter or digit, and
                   5415:                 contains only letters, digits, dashes, underscores,
                   5416:                 dots and plus signs.</p>
1.25      rillig   5417:               </li>
                   5418: 
                   5419:               <li>
1.27      rillig   5420:                 <p><code class="varname">CATEGORIES</code> is a
                   5421:                 list of categories which the package fits in. You
                   5422:                 can choose any of the top-level directories of
                   5423:                 pkgsrc for it.</p>
1.25      rillig   5424:               </li>
                   5425: 
                   5426:               <li>
1.27      rillig   5427:                 <p><code class="varname">MASTER_SITES</code> is a
                   5428:                 list of URLs where the distribution files can be
                   5429:                 downloaded. Each URL must end with a slash.</p>
1.25      rillig   5430:               </li>
                   5431:             </ul>
                   5432:           </div>
                   5433: 
1.27      rillig   5434:           <p>The second section contains the following
                   5435:           variables.</p>
1.25      rillig   5436: 
1.27      rillig   5437:           <div class="itemizedlist">
                   5438:             <ul type="disc">
                   5439:               <li>
                   5440:                 <p><code class="varname">MAINTAINER</code> is the
                   5441:                 mail address of the package's maintainer, which is
                   5442:                 the person you can contact when the package does
                   5443:                 not work.</p>
                   5444:               </li>
1.25      rillig   5445: 
1.27      rillig   5446:               <li>
                   5447:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   5448:                 where users can find more information about the
1.23      wiz      5449:                 package.</p>
                   5450:               </li>
1.1       grant    5451: 
1.23      wiz      5452:               <li>
                   5453:                 <p><code class="varname">COMMENT</code> is a
                   5454:                 one-line comment about the purpose of the
                   5455:                 package.</p>
                   5456:               </li>
                   5457:             </ul>
                   5458:           </div>
1.1       grant    5459: 
1.14      xtraeme  5460:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5461:           set to one of the predefined sites:</p>
1.1       grant    5462:           <pre class="programlisting">
                   5463:         ${MASTER_SITE_APACHE}
1.27      rillig   5464:         ${MASTER_SITE_BACKUP}
                   5465:         ${MASTER_SITE_CYGWIN}
1.1       grant    5466:         ${MASTER_SITE_DEBIAN}
1.27      rillig   5467:         ${MASTER_SITE_FREEBSD}
                   5468:         ${MASTER_SITE_FREEBSD_LOCAL}
1.1       grant    5469:         ${MASTER_SITE_GNOME}
                   5470:         ${MASTER_SITE_GNU}
                   5471:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5472:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5473:         ${MASTER_SITE_MOZILLA}
1.27      rillig   5474:         ${MASTER_SITE_OPENOFFICE}
1.1       grant    5475:         ${MASTER_SITE_PERL_CPAN}
1.27      rillig   5476:         ${MASTER_SITE_R_CRAN}
1.1       grant    5477:         ${MASTER_SITE_SOURCEFORGE}
                   5478:         ${MASTER_SITE_SUNSITE}
                   5479:         ${MASTER_SITE_SUSE}
                   5480:         ${MASTER_SITE_TEX_CTAN}
                   5481:         ${MASTER_SITE_XCONTRIB}
1.27      rillig   5482:         ${MASTER_SITE_XEMACS}
                   5483:     
1.1       grant    5484: </pre>
                   5485: 
                   5486:           <p>If one of these predefined sites is chosen, you may
                   5487:           require the ability to specify a subdirectory of that
                   5488:           site. Since these macros may expand to more than one
                   5489:           actual site, you <span class=
                   5490:           "emphasis"><em>must</em></span> use the following
                   5491:           construct to specify a subdirectory:</p>
                   5492:           <pre class="programlisting">
                   5493:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5494:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5495: </pre>
                   5496: 
                   5497:           <p>Note the trailing slash after the subdirectory
                   5498:           name.</p>
                   5499: 
                   5500:           <div class="note" style=
                   5501:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5502:             <h3 class="title">Note</h3>
                   5503: 
1.14      xtraeme  5504:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5505:             been deprecated and <span class="emphasis"><em>should
                   5506:             no longer be used</em></span>.</p>
1.1       grant    5507:           </div>
                   5508: 
1.14      xtraeme  5509:           <p>If the package has multiple <code class=
                   5510:           "varname">DISTFILES</code> or multiple <code class=
                   5511:           "varname">PATCHFILES</code> from different sites, set
                   5512:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5513:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5514:           may be found. &#8220;<span class=
                   5515:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5516:           <pre class="programlisting">
                   5517: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5518: DISTFILES+=     foo-file.tar.gz
                   5519: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5520:         http://www.somewhereelse.com/mirror/somehow/
                   5521: </pre>
                   5522: 
1.14      xtraeme  5523:           <p>Note that the normal default setting of <code class=
                   5524:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5525:           want to add to it (rather than replace it), as you
                   5526:           usually would.</p>
                   5527: 
                   5528:           <p>Currently the following values are available for
1.14      xtraeme  5529:           <code class="varname">CATEGORIES</code>. If more than one
                   5530:           is used, they need to be separated by spaces:</p>
1.1       grant    5531:           <pre class="programlisting">
                   5532: archivers     cross         geography     meta-pkgs     security
                   5533: audio         databases     graphics      misc          shells
                   5534: benchmarks    devel         ham           multimedia    sysutils
                   5535: biology       editors       inputmethod   net           textproc
                   5536: cad           emulators     lang          news          time
                   5537: chat          finance       mail          parallel      wm
                   5538: comms         fonts         math          pkgtools      www
                   5539: converters    games         mbone         print         x11
                   5540: </pre>
                   5541: 
                   5542:           <p>Please pay attention to the following gotchas:</p>
                   5543: 
                   5544:           <div class="itemizedlist">
                   5545:             <ul type="disc">
                   5546:               <li>
1.14      xtraeme  5547:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5548:                 if manpages are installed in compressed form by the
                   5549:                 package; see comment in <code class=
                   5550:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5551:               </li>
                   5552: 
                   5553:               <li>
1.14      xtraeme  5554:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5555:                 with &#8220;<span class=
                   5556:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5557:                 patches, below).</p>
                   5558:               </li>
                   5559: 
                   5560:               <li>
                   5561:                 <p>If the package installs any info files, see
                   5562:                 <a href="#faq.info-files" title=
1.25      rillig   5563:                 "13.5.10.&nbsp;Packages installing info files">Section
                   5564:                 13.5.10, &#8220;Packages installing info
1.1       grant    5565:                 files&#8221;</a>.</p>
                   5566:               </li>
                   5567: 
                   5568:               <li>
1.14      xtraeme  5569:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5570:                 be yourself. If you really can't maintain the
                   5571:                 package for future updates, set it to <code class=
1.1       grant    5572:                 "email">&lt;<a href=
1.14      xtraeme  5573:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5574:               </li>
                   5575: 
                   5576:               <li>
                   5577:                 <p>If a home page for the software in question
1.14      xtraeme  5578:                 exists, add the variable <code class=
                   5579:                 "varname">HOMEPAGE</code> right after <code class=
                   5580:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5581:                 variable should be the URL for the home page.</p>
                   5582:               </li>
                   5583: 
                   5584:               <li>
1.14      xtraeme  5585:                 <p>Be sure to set the <code class=
                   5586:                 "varname">COMMENT</code> variable to a short
1.1       grant    5587:                 description of the package, not containing the
                   5588:                 pkg's name.</p>
                   5589:               </li>
                   5590:             </ul>
                   5591:           </div>
                   5592:         </div>
                   5593: 
                   5594:         <div class="sect1" lang="en" xml:lang="en">
                   5595:           <div class="titlepage">
                   5596:             <div>
                   5597:               <div>
                   5598:                 <h2 class="title" style="clear: both"><a name=
                   5599:                 "components.distinfo" id=
1.27      rillig   5600:                 "components.distinfo"></a>7.2.&nbsp;<code class=
1.14      xtraeme  5601:                 "filename">distinfo</code></h2>
1.1       grant    5602:               </div>
                   5603:             </div>
                   5604:           </div>
                   5605: 
                   5606:           <p>Most important, the mandatory message digest, or
                   5607:           checksum, of all the distfiles needed for the package to
                   5608:           compile, confirming they match the original file
                   5609:           distributed by the author. This ensures that the distfile
                   5610:           retrieved from the Internet has not been corrupted during
                   5611:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5612:           security hole. It is generated using the
                   5613:           <span><strong class="command">make
                   5614:           makesum</strong></span> command. The digest algorithm
                   5615:           used was, at one stage, md5, but that was felt lacking
                   5616:           compared to sha1, and so sha1 is now the default
1.1       grant    5617:           algorithm. The distfile size is also generated and stored
                   5618:           in new distinfo files. The <a xmlns=
                   5619:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5620:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5621:           class="pkgname">pkgtools/digest</a> utility calculates
                   5622:           all of the digests in the distinfo file, and it provides
                   5623:           various different algorithms. At the current time, the
                   5624:           algorithms provided are: <span class=
                   5625:           "emphasis"><em>md5</em></span>, <span class=
                   5626:           "emphasis"><em>rmd160</em></span>, <span class=
                   5627:           "emphasis"><em>sha1</em></span>, <span class=
                   5628:           "emphasis"><em>sha256</em></span>, <span class=
                   5629:           "emphasis"><em>sha384</em></span> and <span class=
                   5630:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5631: 
                   5632:           <p>Some packages have different sets of distfiles on a
                   5633:           per architecture basis, for example <a xmlns=
                   5634:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5635:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5636:           class="pkgname">www/navigator</a>). These are kept in the
                   5637:           same distinfo file and care should be taken when
                   5638:           upgrading such a package to ensure distfile information
                   5639:           is not lost.</p>
1.1       grant    5640: 
                   5641:           <p>The message digest/checksum for all the official
1.14      xtraeme  5642:           patches found in the <code class=
                   5643:           "filename">patches/</code> directory (see <a href=
                   5644:           "#components.patches" title=
1.27      rillig   5645:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    5646:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5647:           stored in the <code class="filename">distinfo</code>
                   5648:           file. This is a message digest/checksum of all lines in
                   5649:           the patch file except the NetBSD RCS Id. This file is
                   5650:           generated by invoking <span><strong class="command">make
                   5651:           makepatchsum</strong></span> (or <span><strong class=
                   5652:           "command">make mps</strong></span> if you're in a
                   5653:           hurry).</p>
1.1       grant    5654:         </div>
                   5655: 
                   5656:         <div class="sect1" lang="en" xml:lang="en">
                   5657:           <div class="titlepage">
                   5658:             <div>
                   5659:               <div>
                   5660:                 <h2 class="title" style="clear: both"><a name=
                   5661:                 "components.patches" id=
1.27      rillig   5662:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
1.1       grant    5663:               </div>
                   5664:             </div>
                   5665:           </div>
                   5666: 
                   5667:           <p>This directory contains files that are used by the
                   5668:           <a href=
                   5669:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5670:           <span class="citerefentry"><span class=
                   5671:           "refentrytitle">patch</span>(1)</span></a> command to
                   5672:           modify the sources as distributed in the distribution
                   5673:           file into a form that will compile and run perfectly on
                   5674:           NetBSD. The files are applied successively in alphabetic
                   5675:           order (as returned by a shell &#8220;<span class=
                   5676:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5677:           <code class="filename">patch-aa</code> is applied before
                   5678:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5679: 
1.14      xtraeme  5680:           <p>The <code class="filename">patch-*</code> files should
                   5681:           be in <span><strong class="command">diff
                   5682:           -bu</strong></span> format, and apply without a fuzz to
                   5683:           avoid problems. (To force patches to apply with fuzz you
                   5684:           can set <code class=
                   5685:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5686:           not put changes for more than one file into a single
                   5687:           patch-file, as this will make future modifications more
                   5688:           difficult.</p>
                   5689: 
                   5690:           <p>Similar, a file should be patched at most once, not
                   5691:           several times by several different patches. If a file
                   5692:           needs several patches, they should be combined into one
                   5693:           file.</p>
                   5694: 
                   5695:           <p>One important thing to mention is to pay attention
                   5696:           that no RCS IDs get stored in the patch files, as these
                   5697:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5698:           CVS tree. Use the <span><strong class=
                   5699:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5700:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5701:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5702:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5703:           these problems.</p>
1.1       grant    5704: 
                   5705:           <p>For even more automation, we recommend using
1.14      xtraeme  5706:           <span><strong class="command">mkpatches</strong></span>
                   5707:           from the same package to make a whole set of patches. You
                   5708:           just have to backup files before you edit them to
                   5709:           <code class="filename">filename.orig</code>, e.g. with
                   5710:           <span><strong class="command">cp -p filename
                   5711:           filename.orig</strong></span> or, easier, by using
                   5712:           <span><strong class="command">pkgvi</strong></span> again
                   5713:           from the same package. If you upgrade a package this way,
                   5714:           you can easily compare the new set of patches with the
                   5715:           previously existing one with <span><strong class=
                   5716:           "command">patchdiff</strong></span>.</p>
1.1       grant    5717: 
                   5718:           <p>When you have finished a package, remember to generate
                   5719:           the checksums for the patch files by using the
1.14      xtraeme  5720:           <span><strong class="command">make
                   5721:           makepatchsum</strong></span> command, see <a href=
                   5722:           "#components.distinfo" title=
1.27      rillig   5723:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5724:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5725: 
                   5726:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5727:           other maintainers can be listed in <code class=
                   5728:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5729: 
                   5730:           <p>If it is desired to store any patches that should not
                   5731:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5732:           pkgsrc tree in the <code class=
                   5733:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5734:           tree there is expected to have the same
                   5735:           &#8220;<span class="quote">category/package</span>&#8221;
                   5736:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5737:           stored inside these dirs (also known as <code class=
                   5738:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5739:           you want to keep a private patch for <code class=
                   5740:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5741:           <code class=
                   5742:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5743:           files in the named directory are expected to be patch
1.1       grant    5744:           files, and <span class="emphasis"><em>they are applied
                   5745:           after pkgsrc patches are applied</em></span>.</p>
1.27      rillig   5746:         </div>
                   5747: 
                   5748:         <div class="sect1" lang="en" xml:lang="en">
                   5749:           <div class="titlepage">
                   5750:             <div>
                   5751:               <div>
                   5752:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      5753:                 "other-mandatory-files" id=
        !          5754:                 "other-mandatory-files"></a>7.4.&nbsp;Other
1.27      rillig   5755:                 mandatory files</h2>
                   5756:               </div>
                   5757:             </div>
                   5758:           </div>
                   5759: 
                   5760:           <div class="variablelist">
                   5761:             <dl>
                   5762:               <dt><span class="term"><code class=
                   5763:               "filename">DESCR</code></span></dt>
                   5764: 
                   5765:               <dd>
                   5766:                 <p>A multi-line description of the piece of
                   5767:                 software. This should include any credits where
                   5768:                 they are due. Please bear in mind that others do
                   5769:                 not share your sense of humour (or spelling
                   5770:                 idiosyncrasies), and that others will read
                   5771:                 everything that you write here.</p>
                   5772:               </dd>
                   5773: 
                   5774:               <dt><span class="term"><code class=
                   5775:               "filename">PLIST</code></span></dt>
                   5776: 
                   5777:               <dd>
                   5778:                 <p>This file governs the files that are installed
                   5779:                 on your system: all the binaries, manual pages,
                   5780:                 etc. There are other directives which may be
                   5781:                 entered in this file, to control the creation and
                   5782:                 deletion of directories, and the location of
                   5783:                 inserted files. See <a href="#plist" title=
                   5784:                 "Chapter&nbsp;9.&nbsp;PLIST issues">Chapter&nbsp;9,
                   5785:                 <i>PLIST issues</i></a> for more information.</p>
                   5786:               </dd>
                   5787:             </dl>
                   5788:           </div>
                   5789:         </div>
                   5790: 
                   5791:         <div class="sect1" lang="en" xml:lang="en">
                   5792:           <div class="titlepage">
                   5793:             <div>
                   5794:               <div>
                   5795:                 <h2 class="title" style="clear: both"><a name=
                   5796:                 "components.optional" id=
                   5797:                 "components.optional"></a>7.5.&nbsp;Optional
                   5798:                 files</h2>
                   5799:               </div>
                   5800:             </div>
                   5801:           </div>
                   5802: 
                   5803:           <div class="variablelist">
                   5804:             <dl>
                   5805:               <dt><span class="term"><code class=
                   5806:               "filename">INSTALL</code></span></dt>
                   5807: 
                   5808:               <dd>
                   5809:                 <p>This shell script is invoked twice by <a href=
                   5810:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5811:                 <span class="citerefentry"><span class=
                   5812:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5813:                 time after package extraction and before files are
                   5814:                 moved in place, the second time after the files to
                   5815:                 install are moved in place. This can be used to do
                   5816:                 any custom procedures not possible with @exec
                   5817:                 commands in <code class="filename">PLIST</code>.
                   5818:                 See <a href=
                   5819:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5820:                 <span class="citerefentry"><span class=
                   5821:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5822:                 <a href=
                   5823:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5824:                 <span class="citerefentry"><span class=
                   5825:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5826:                 more information.</p>
                   5827:               </dd>
                   5828: 
                   5829:               <dt><span class="term"><code class=
                   5830:               "filename">DEINSTALL</code></span></dt>
                   5831: 
                   5832:               <dd>
                   5833:                 <p>This script is executed before and after any
                   5834:                 files are removed. It is this script's
                   5835:                 responsibility to clean up any additional messy
                   5836:                 details around the package's installation, since
                   5837:                 all pkg_delete knows is how to delete the files
                   5838:                 created in the original distribution. See <a href=
                   5839:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5840:                 <span class="citerefentry"><span class=
                   5841:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5842:                 <a href=
                   5843:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5844:                 <span class="citerefentry"><span class=
                   5845:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5846:                 more information.</p>
                   5847:               </dd>
                   5848: 
                   5849:               <dt><span class="term"><code class=
                   5850:               "filename">MESSAGE</code></span></dt>
                   5851: 
                   5852:               <dd>
                   5853:                 <p>Display this file after installation of the
                   5854:                 package. Useful for things like legal notices on
                   5855:                 almost-free software and hints for updating config
                   5856:                 files after installing modules for apache, PHP etc.
                   5857:                 Please note that you can modify variables in it
                   5858:                 easily by using <code class=
                   5859:                 "varname">MESSAGE_SUBST</code> in the package's
                   5860:                 <code class="filename">Makefile</code>:</p>
                   5861:                 <pre class="programlisting">
                   5862: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5863: </pre>
                   5864: 
                   5865:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
                   5866:                 "quote">somevalue</span>&#8221; in <code class=
                   5867:                 "filename">MESSAGE</code>.</p>
                   5868:               </dd>
                   5869:             </dl>
                   5870:           </div>
                   5871:         </div>
                   5872: 
                   5873:         <div class="sect1" lang="en" xml:lang="en">
                   5874:           <div class="titlepage">
                   5875:             <div>
                   5876:               <div>
                   5877:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      5878:                 "work-dir" id="work-dir"></a>7.6.&nbsp;<code class=
1.27      rillig   5879:                 "filename">work*</code></h2>
                   5880:               </div>
                   5881:             </div>
                   5882:           </div>
                   5883: 
                   5884:           <p>When you type <span><strong class=
                   5885:           "command">make</strong></span> the distribution files are
                   5886:           unpacked into this directory. It can be removed by
                   5887:           running <span><strong class="command">make
                   5888:           clean</strong></span>. Besides the sources, this
                   5889:           directory is also used to keep various timestamp
                   5890:           files.</p>
                   5891: 
                   5892:           <p>If a package doesn't create a subdirectory for itself
                   5893:           (like GNU software does, for instance), but extracts
                   5894:           itself in the current directory, you should set
                   5895:           <code class="varname">WRKSRC</code> accordingly, e.g.
                   5896:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5897:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
                   5898:           class="pkgname">editors/sam</a> again, but the quick
                   5899:           answer is:</p>
                   5900:           <pre class="programlisting">
                   5901: WRKSRC=             ${WRKDIR}
                   5902: </pre>
                   5903: 
                   5904:           <p>Please note that the old <code class=
                   5905:           "varname">NO_WRKSUBDIR</code> has been deprecated and
                   5906:           should not be used. Also, if your package doesn't create
                   5907:           a subdir with the name of <code class=
                   5908:           "varname">DISTNAME</code> but some different name, set
                   5909:           <code class="varname">WRKSRC</code> to point to the
                   5910:           proper name in <code class="filename">${WRKDIR}</code>.
                   5911:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5912:           href=
                   5913:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
                   5914:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5915:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5916:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5917:           class="pkgname">x11/tk</a> for examples, and here is
                   5918:           another one:</p>
                   5919:           <pre class="programlisting">
                   5920: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5921: </pre>
                   5922: 
                   5923:           <p>The name of the working directory created by pkgsrc is
                   5924:           <code class="filename">work</code> by default. If the
                   5925:           same pkgsrc tree should be used on several different
                   5926:           platforms, the variable <code class=
                   5927:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
                   5928:           attach the platform to the directory name, e.g.
                   5929:           <code class="filename">work.i386</code> or <code class=
                   5930:           "filename">work.sparc</code>.</p>
                   5931:         </div>
                   5932: 
                   5933:         <div class="sect1" lang="en" xml:lang="en">
                   5934:           <div class="titlepage">
                   5935:             <div>
                   5936:               <div>
                   5937:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      5938:                 "files-dir" id=
        !          5939:                 "files-dir"></a>7.7.&nbsp;<code class=
1.27      rillig   5940:                 "filename">files/*</code></h2>
                   5941:               </div>
                   5942:             </div>
                   5943:           </div>
                   5944: 
                   5945:           <p>If you have any files that you wish to be placed in
                   5946:           the package prior to configuration or building, you could
                   5947:           place these files here and use a &#8220;<span class=
                   5948:           "quote">${CP}</span>&#8221; command in the
                   5949:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5950:           target to achieve this. Alternatively, you could simply
                   5951:           diff the file against <code class=
                   5952:           "filename">/dev/null</code> and use the patch mechanism
                   5953:           to manage the creation of this file.</p>
                   5954:         </div>
                   5955:       </div>
                   5956: 
                   5957:       <div class="chapter" lang="en" xml:lang="en">
                   5958:         <div class="titlepage">
                   5959:           <div>
                   5960:             <div>
                   5961:               <h2 class="title"><a name="makefile" id=
                   5962:               "makefile"></a>Chapter&nbsp;8.&nbsp;Programming in
                   5963:               <code class="filename">Makefile</code>s</h2>
                   5964:             </div>
                   5965:           </div>
                   5966:         </div>
                   5967: 
                   5968:         <div class="toc">
                   5969:           <p><b>Table of Contents</b></p>
                   5970: 
                   5971:           <dl>
                   5972:             <dt><span class="sect1"><a href=
                   5973:             "#makefile.variables">8.1. <code class=
                   5974:             "filename">Makefile</code> variables</a></span></dt>
                   5975: 
                   5976:             <dd>
                   5977:               <dl>
                   5978:                 <dt><span class="sect2"><a href=
                   5979:                 "#makefile.variables.names">8.1.1. Naming
                   5980:                 conventions</a></span></dt>
                   5981:               </dl>
                   5982:             </dd>
                   5983: 
                   5984:             <dt><span class="sect1"><a href="#makefile.code">8.2.
                   5985:             Code snippets</a></span></dt>
                   5986: 
                   5987:             <dd>
                   5988:               <dl>
1.30    ! wiz      5989:                 <dt><span class="sect2"><a href=
        !          5990:                 "#adding-to-list">8.2.1. Adding things to a
        !          5991:                 list</a></span></dt>
1.27      rillig   5992: 
1.30    ! wiz      5993:                 <dt><span class="sect2"><a href=
        !          5994:                 "#converting-internal-to-external">8.2.2.
1.27      rillig   5995:                 Converting an internal list into an external
                   5996:                 list</a></span></dt>
                   5997: 
1.30    ! wiz      5998:                 <dt><span class="sect2"><a href=
        !          5999:                 "#passing-variable-to-shell">8.2.3. Passing
        !          6000:                 variables to a shell command</a></span></dt>
1.27      rillig   6001: 
1.30    ! wiz      6002:                 <dt><span class="sect2"><a href=
        !          6003:                 "#quoting-guideline">8.2.4. Quoting
        !          6004:                 guideline</a></span></dt>
1.27      rillig   6005: 
1.30    ! wiz      6006:                 <dt><span class="sect2"><a href=
        !          6007:                 "#bsd-make-bug-workaround">8.2.5. Workaround for a
        !          6008:                 bug in BSD Make</a></span></dt>
1.27      rillig   6009:               </dl>
                   6010:             </dd>
                   6011:           </dl>
                   6012:         </div>
                   6013: 
                   6014:         <p>Pkgsrc consists of many <code class=
                   6015:         "filename">Makefile</code> fragments, each of which forms a
                   6016:         well-defined part of the pkgsrc system. Using the <a href=
                   6017:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6018:         <span class="citerefentry"><span class=
                   6019:         "refentrytitle">make</span>(1)</span></a> system as a
                   6020:         programming language for a big system like pkgsrc requires
                   6021:         some discipline to keep the code correct and
                   6022:         understandable.</p>
                   6023: 
                   6024:         <p>The basic ingredients for <code class=
                   6025:         "filename">Makefile</code> programming are variables (which
                   6026:         are actually macros) and shell commands. Among these shell
                   6027:         commands may even be more complex ones like <a href=
                   6028:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
                   6029:         <span class="citerefentry"><span class=
                   6030:         "refentrytitle">awk</span>(1)</span></a> programs. To make
                   6031:         sure that every shell command runs as intended it is
                   6032:         necessary to quote all variables correctly when they are
                   6033:         used.</p>
                   6034: 
                   6035:         <p>This chapter describes some patterns, that appear quite
                   6036:         often in <code class="filename">Makefile</code>s, including
                   6037:         the pitfalls that come along with them.</p>
                   6038: 
                   6039:         <div class="sect1" lang="en" xml:lang="en">
                   6040:           <div class="titlepage">
                   6041:             <div>
                   6042:               <div>
                   6043:                 <h2 class="title" style="clear: both"><a name=
                   6044:                 "makefile.variables" id=
                   6045:                 "makefile.variables"></a>8.1.&nbsp;<code class=
                   6046:                 "filename">Makefile</code> variables</h2>
                   6047:               </div>
                   6048:             </div>
                   6049:           </div>
                   6050: 
                   6051:           <p><code class="filename">Makefile</code> variables
                   6052:           contain strings that can be processed using the five
                   6053:           operators ``='', ``+='', ``?='', ``:='', and ``!='',
                   6054:           which are described in the <a href=
                   6055:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6056:           <span class="citerefentry"><span class=
                   6057:           "refentrytitle">make</span>(1)</span></a> man page.</p>
                   6058: 
                   6059:           <p>When a variable's value is parsed from a <code class=
                   6060:           "filename">Makefile</code>, the hash character ``#'' and
                   6061:           the backslash character ``\'' are handled specially. If a
                   6062:           backslash is followed by a newline, any whitespace
                   6063:           immediately in front of the backslash, the backslash, the
                   6064:           newline, and any whitespace immediately behind the
                   6065:           newline are replaced with a single space. A backspace
                   6066:           character and an immediately following hash character are
                   6067:           replaced with a single hash character. Otherwise the
                   6068:           backslash is passed as is. In a variable assignment, any
                   6069:           hash character that is not preceded by a backslash starts
                   6070:           a comment that continues upto the end of the logical
                   6071:           line.</p>
                   6072: 
                   6073:           <p><span class="emphasis"><em>Note:</em></span> Because
                   6074:           of this parsing algorithm the only way to create a
                   6075:           variable consisting of a single backslash is using the
                   6076:           ``!='' operator, for example: <code class=
                   6077:           "varname">BACKSLASH!=echo "\\"</code>.</p>
                   6078: 
                   6079:           <p>So far for defining variables. The other thing you can
                   6080:           do with variables is evaluating them. A variable is
                   6081:           evaluated when it is part of the right side of the ``:=''
                   6082:           or the ``!='' operator, or directly before executing a
                   6083:           shell command which the variable is part of. In all other
                   6084:           cases <a href=
                   6085:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6086:           <span class="citerefentry"><span class=
                   6087:           "refentrytitle">make</span>(1)</span></a> performs lazy
                   6088:           evaluation, that is, variables are not evaluated until
                   6089:           there's no other way. The ``modifiers'' mentioned in the
                   6090:           man page also evaluate the variable.</p>
                   6091: 
                   6092:           <p>Some of the modifiers split the string into words and
                   6093:           then operate on the words, others operate on the string
                   6094:           as a whole. When a string is splitted into words, it is
                   6095:           splitted as you would expect it from <a href=
                   6096:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   6097:           <span class="citerefentry"><span class=
                   6098:           "refentrytitle">sh</span>(1)</span></a>.</p>
                   6099: 
                   6100:           <p>No rule without exception&#8212;the
                   6101:           <span><strong class="command">.for</strong></span> loop
                   6102:           does not follow the shell quoting rules but splits at
                   6103:           sequences of whitespace.</p>
                   6104: 
                   6105:           <p>There are several types of variables that should be
                   6106:           handled differently. Strings and two types of lists.</p>
                   6107: 
                   6108:           <div class="itemizedlist">
                   6109:             <ul type="disc">
                   6110:               <li>
                   6111:                 <p><span class="emphasis"><em>Strings</em></span>
                   6112:                 can contain arbitrary characters. Nevertheless you
                   6113:                 should restrict yourself to only using printable
                   6114:                 characters. Examples are <code class=
                   6115:                 "varname">PREFIX</code> and <code class=
                   6116:                 "varname">COMMENT</code>.</p>
                   6117:               </li>
                   6118: 
                   6119:               <li>
                   6120:                 <p><span class="emphasis"><em>Internal
                   6121:                 lists</em></span> are lists that are never exported
                   6122:                 to any shell command. Their elements are separated
                   6123:                 by whitespace. Therefore the elements themselves
                   6124:                 cannot have embedded whitespace. Any other
                   6125:                 characters are allowed. Internal lists can be used
                   6126:                 in <span><strong class=
                   6127:                 "command">.for</strong></span> loops. Examples are
                   6128:                 <code class="varname">DEPENDS</code> and
                   6129:                 <code class="varname">BUILD_DEPENDS</code>.</p>
                   6130:               </li>
                   6131: 
                   6132:               <li>
                   6133:                 <p><span class="emphasis"><em>External
                   6134:                 lists</em></span> are lists that may be exported to
                   6135:                 a shell command. Their elements can contain any
                   6136:                 characters, including whitespace. That's why they
                   6137:                 cannot be used in <span><strong class=
                   6138:                 "command">.for</strong></span> loops. Examples are
                   6139:                 <code class="varname">DISTFILES</code> and
                   6140:                 <code class="varname">MASTER_SITES</code>.</p>
                   6141:               </li>
                   6142:             </ul>
                   6143:           </div>
                   6144: 
                   6145:           <div class="sect2" lang="en" xml:lang="en">
                   6146:             <div class="titlepage">
                   6147:               <div>
                   6148:                 <div>
                   6149:                   <h3 class="title"><a name=
                   6150:                   "makefile.variables.names" id=
                   6151:                   "makefile.variables.names"></a>8.1.1.&nbsp;Naming
                   6152:                   conventions</h3>
                   6153:                 </div>
                   6154:               </div>
                   6155:             </div>
                   6156: 
                   6157:             <div class="itemizedlist">
                   6158:               <ul type="disc">
                   6159:                 <li>
                   6160:                   <p>All variable names starting with an underscore
                   6161:                   are reserved for use by the pkgsrc
                   6162:                   infrastructure. They shall not be used by package
                   6163:                   <code class="filename">Makefile</code>s.</p>
                   6164:                 </li>
                   6165: 
                   6166:                 <li>
                   6167:                   <p>In <span><strong class=
                   6168:                   "command">.for</strong></span> loops you should
                   6169:                   use lowercase variable names for the iteration
                   6170:                   variables.</p>
                   6171:                 </li>
                   6172: 
                   6173:                 <li>
                   6174:                   <p>All list variables should have a ``plural''
                   6175:                   name, e.g. <code class=
                   6176:                   "varname">PKG_OPTIONS</code> or <code class=
                   6177:                   "varname">DISTFILES</code>.</p>
                   6178:                 </li>
                   6179:               </ul>
                   6180:             </div>
                   6181:           </div>
                   6182:         </div>
                   6183: 
                   6184:         <div class="sect1" lang="en" xml:lang="en">
                   6185:           <div class="titlepage">
                   6186:             <div>
                   6187:               <div>
                   6188:                 <h2 class="title" style="clear: both"><a name=
                   6189:                 "makefile.code" id=
                   6190:                 "makefile.code"></a>8.2.&nbsp;Code snippets</h2>
                   6191:               </div>
                   6192:             </div>
                   6193:           </div>
                   6194: 
                   6195:           <p>This section presents you with some code snippets you
                   6196:           should use in your own code. If you don't find anything
                   6197:           appropriate here, you should test your code and add it
                   6198:           here.</p>
                   6199: 
                   6200:           <div class="sect2" lang="en" xml:lang="en">
                   6201:             <div class="titlepage">
                   6202:               <div>
                   6203:                 <div>
1.30    ! wiz      6204:                   <h3 class="title"><a name="adding-to-list" id=
        !          6205:                   "adding-to-list"></a>8.2.1.&nbsp;Adding things to
        !          6206:                   a list</h3>
1.27      rillig   6207:                 </div>
                   6208:               </div>
                   6209:             </div>
                   6210:             <pre class="programlisting">
                   6211: STRING=                 foo * bar `date`
                   6212: INT_LIST=               # empty
                   6213: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
                   6214: EXT_LIST=               # empty
                   6215: ANOTHER_EXT_LIST=       a=b c=d
                   6216: 
                   6217: INT_LIST+=              ${STRING}               # 1
                   6218: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
                   6219: EXT_LIST+=              ${STRING:Q}             # 3
                   6220: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
                   6221:       
                   6222: </pre>
                   6223: 
                   6224:             <p>When you add a string to an external list (example
                   6225:             3), it must be quoted. In all other cases, you must not
                   6226:             add a quoting level. You must not merge internal and
                   6227:             external lists, unless you are sure that all entries
                   6228:             are correctly interpreted in both lists.</p>
                   6229:           </div>
                   6230: 
                   6231:           <div class="sect2" lang="en" xml:lang="en">
                   6232:             <div class="titlepage">
                   6233:               <div>
                   6234:                 <div>
1.30    ! wiz      6235:                   <h3 class="title"><a name=
        !          6236:                   "converting-internal-to-external" id=
        !          6237:                   "converting-internal-to-external"></a>8.2.2.&nbsp;Converting
        !          6238:                   an internal list into an external list</h3>
1.27      rillig   6239:                 </div>
                   6240:               </div>
                   6241:             </div>
                   6242:             <pre class="programlisting">
                   6243: EXT_LIST=       # empty
                   6244: .for i in ${INT_LIST}
                   6245: EXT_LIST+=      ${i:Q}""
                   6246: .endfor
                   6247:       
                   6248: </pre>
                   6249: 
                   6250:             <p>This code converts the internal list <code class=
                   6251:             "varname">INT_LIST</code> into the external list
                   6252:             <code class="varname">EXT_LIST</code>. As the elements
                   6253:             of an internal list are unquoted they must be quoted
                   6254:             here. The reason for appending <code class=
                   6255:             "varname">""</code> is explained below.</p>
                   6256:           </div>
1.1       grant    6257: 
1.27      rillig   6258:           <div class="sect2" lang="en" xml:lang="en">
                   6259:             <div class="titlepage">
1.1       grant    6260:               <div>
1.27      rillig   6261:                 <div>
1.30    ! wiz      6262:                   <h3 class="title"><a name=
        !          6263:                   "passing-variable-to-shell" id=
        !          6264:                   "passing-variable-to-shell"></a>8.2.3.&nbsp;Passing
        !          6265:                   variables to a shell command</h3>
1.27      rillig   6266:                 </div>
1.1       grant    6267:               </div>
                   6268:             </div>
1.27      rillig   6269:             <pre class="programlisting">
                   6270: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   6271: EXT_LIST=       string=${STRING:Q} x=second\ item
                   6272: 
                   6273: all:
                   6274:         echo ${STRING}                  # 1
                   6275:         echo "${STRING}"                # 2
                   6276:         echo "${STRING:Q}"              # 3
                   6277:         echo ${STRING:Q}                # 4
                   6278:         echo x${STRING:Q} | sed 1s,.,,  # 5
                   6279:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
                   6280:       
                   6281: </pre>
                   6282: 
                   6283:             <p>Example 1 leads to a syntax error in the shell, as
                   6284:             the characters are just copied.</p>
                   6285: 
                   6286:             <p>Example 2 leads to a syntax error too, and if you
                   6287:             leave out the last " character from <code class=
                   6288:             "varname">${STRING}</code>, <a href=
                   6289:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
                   6290:             <span class="citerefentry"><span class=
                   6291:             "refentrytitle">date</span>(1)</span></a> will be
                   6292:             executed. The <code class="varname">$HOME</code> shell
                   6293:             variable would be evaluated, too.</p>
                   6294: 
                   6295:             <p>Example 3 outputs each space character preceded by a
                   6296:             backslash (or not), depending on the implementation of
                   6297:             the <a href=
                   6298:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6299:             <span class="citerefentry"><span class=
                   6300:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    6301: 
1.27      rillig   6302:             <p>Example 4 handles correctly every string that does
                   6303:             not start with a dash. In that case, the result depends
                   6304:             on the implementation of the <a href=
                   6305:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6306:             <span class="citerefentry"><span class=
                   6307:             "refentrytitle">echo</span>(1)</span></a> command. As
                   6308:             long as you can guarantee that your input does not
                   6309:             start with a dash this form is appropriate.</p>
1.1       grant    6310: 
1.27      rillig   6311:             <p>Example 5 handles even the case of a leading dash
                   6312:             correctly.</p>
1.1       grant    6313: 
1.27      rillig   6314:             <p>The <code class="varname">EXT_LIST</code> does not
                   6315:             need to be quoted because the quoting has already be
                   6316:             done when adding elements to the list.</p>
1.1       grant    6317: 
1.27      rillig   6318:             <p>As internal lists shall not be passed to the shell,
                   6319:             there is no example for it.</p>
1.1       grant    6320:           </div>
                   6321: 
1.27      rillig   6322:           <div class="sect2" lang="en" xml:lang="en">
                   6323:             <div class="titlepage">
1.1       grant    6324:               <div>
1.27      rillig   6325:                 <div>
1.30    ! wiz      6326:                   <h3 class="title"><a name="quoting-guideline" id=
        !          6327:                   "quoting-guideline"></a>8.2.4.&nbsp;Quoting
1.27      rillig   6328:                   guideline</h3>
                   6329:                 </div>
1.1       grant    6330:               </div>
                   6331:             </div>
                   6332: 
1.27      rillig   6333:             <p>There are many possible sources of wrongly quoted
                   6334:             variables. This section lists some of the commonly
                   6335:             known ones.</p>
1.1       grant    6336: 
1.27      rillig   6337:             <div class="itemizedlist">
                   6338:               <ul type="disc">
                   6339:                 <li>
                   6340:                   <p>Whenever you use the value of a list, think
                   6341:                   about what happens to leading or trailing
                   6342:                   whitespace. If the list is a well-formed shell
                   6343:                   expression you can apply the <code class=
                   6344:                   "varname">:M*</code> modifier to strip leading
                   6345:                   and trailing whitespace from each word. The
                   6346:                   <code class="varname">:M</code> operator first
                   6347:                   splits its argument according to the rules of the
                   6348:                   shell, and then creates a new list consisting of
                   6349:                   all words that match the shell glob expression
                   6350:                   <code class="varname">*</code>, that is: all. One
                   6351:                   class of situations where this is needed is when
                   6352:                   adding a variable like <code class=
                   6353:                   "varname">CPPFLAGS</code> to <code class=
                   6354:                   "varname">CONFIGURE_ARGS</code>. If the configure
                   6355:                   script invokes other configure scripts it strips
                   6356:                   the leading and trailing whitespace from the
                   6357:                   variable and then passes it to the other
                   6358:                   configure scripts. But these configure scripts
                   6359:                   expect the (child) <code class=
                   6360:                   "varname">CPPFLAGS</code> variable to be the same
                   6361:                   as the parent <code class=
                   6362:                   "varname">CPPFLAGS</code>. That's why we better
                   6363:                   pass the <code class="varname">CPPFLAGS</code>
                   6364:                   value properly trimmed. And here is how we do
                   6365:                   it:</p>
                   6366:                   <pre class="programlisting">
                   6367: CPPFLAGS=               # empty
                   6368: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
                   6369: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    6370: 
1.27      rillig   6371: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    6372: 
1.27      rillig   6373: all:
                   6374:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   6375:         echo x${CONFIGURE_ARGS}x        # properly trimmed
                   6376:         
                   6377: </pre>
                   6378:                 </li>
1.1       grant    6379: 
1.27      rillig   6380:                 <li>
                   6381:                   <p>The example above contains one bug: The
                   6382:                   <code class="varname">${PREFIX}</code> is a
                   6383:                   properly quoted shell expression, but there is
                   6384:                   the C compiler after it, which also expects a
                   6385:                   properly quoted string (this time in C syntax).
                   6386:                   The version above is therefore only correct if
                   6387:                   <code class="varname">${PREFIX}</code> does not
                   6388:                   have embedded backslashes or double quotes. If
                   6389:                   you want to allow these, you have to add another
                   6390:                   layer of quoting to each variable that is used as
                   6391:                   a C string literal. You cannot use the
                   6392:                   <code class="varname">:Q</code> operator for it,
                   6393:                   as this operator only works for the shell.</p>
                   6394:                 </li>
1.1       grant    6395: 
1.27      rillig   6396:                 <li>
                   6397:                   <p>Whenever a variable can be empty the
                   6398:                   <code class="varname">:Q</code> operator can have
                   6399:                   surprising results. Here are two completely
                   6400:                   different cases which can be solved with the same
                   6401:                   trick.</p>
                   6402:                   <pre class="programlisting">
                   6403: EMPTY=                  # empty
                   6404: empty_test:
                   6405:         for i in a ${EMPTY:Q} c; do \
                   6406:                 echo "$$i"; \
                   6407:         done
                   6408: 
                   6409: for_test:
                   6410: .for i in a:\ a:\test.txt
                   6411:         echo ${i:Q}
                   6412:         echo "foo"
                   6413: .endfor
                   6414:         
1.1       grant    6415: </pre>
                   6416: 
1.27      rillig   6417:                   <p>The first example will only print two of the
                   6418:                   three lines we might have expected. This is
                   6419:                   because <code class="varname">${EMPTY:Q}</code>
                   6420:                   expands to the empty string, which the shell
                   6421:                   cannot see. The workaround is to write
                   6422:                   <code class="varname">${EMPTY:Q}""</code>. This
                   6423:                   pattern can be often found as <code class=
                   6424:                   "varname">${TEST} -z ${VAR:Q}</code> or as
                   6425:                   <code class="varname">${TEST} -f
                   6426:                   ${FNAME:Q}</code> (both of these are wrong).</p>
                   6427: 
                   6428:                   <p>The second example will only print three lines
                   6429:                   instead of four. The first line looks like
                   6430:                   <code class="varname">a:\ echo foo</code>. This
                   6431:                   is because the backslash of the value
                   6432:                   <code class="varname">a:\</code> is interpreted
                   6433:                   as a line-continuation by <a href=
                   6434:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6435:                   <span class="citerefentry"><span class=
                   6436:                   "refentrytitle">make</span>(1)</span></a>, which
                   6437:                   makes the second line the arguments of the
                   6438:                   <a href=
                   6439:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
                   6440:                   <span class="citerefentry"><span class=
                   6441:                   "refentrytitle">echo</span>(1)</span></a> command
                   6442:                   from the first line. To avoid this, write
                   6443:                   <code class="varname">${i:Q}""</code>.</p>
                   6444:                 </li>
                   6445:               </ul>
                   6446:             </div>
1.1       grant    6447:           </div>
                   6448: 
1.27      rillig   6449:           <div class="sect2" lang="en" xml:lang="en">
                   6450:             <div class="titlepage">
1.1       grant    6451:               <div>
1.27      rillig   6452:                 <div>
1.30    ! wiz      6453:                   <h3 class="title"><a name=
        !          6454:                   "bsd-make-bug-workaround" id=
        !          6455:                   "bsd-make-bug-workaround"></a>8.2.5.&nbsp;Workaround
        !          6456:                   for a bug in BSD Make</h3>
1.27      rillig   6457:                 </div>
1.1       grant    6458:               </div>
                   6459:             </div>
                   6460: 
1.27      rillig   6461:             <p>The pkgsrc bmake program does not handle the
                   6462:             following assignment correctly. In case <code class=
                   6463:             "varname">_othervar_</code> contains a ``-'' character,
                   6464:             one of the closing braces is included in <code class=
                   6465:             "varname">${VAR}</code> after this code executes.</p>
                   6466:             <pre class="programlisting">
                   6467:         VAR:= ${VAR:N${_othervar_:C/-//}}
                   6468:       
1.1       grant    6469: </pre>
                   6470: 
1.27      rillig   6471:             <p>For a more complex code snippet and a workaround,
                   6472:             see the package <a xmlns=
                   6473:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   6474:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
                   6475:             class="pkgname">regress/make-quoting</a>, testcase
                   6476:             <code class="varname">bug1</code>.</p>
1.1       grant    6477:           </div>
                   6478:         </div>
                   6479:       </div>
                   6480: 
                   6481:       <div class="chapter" lang="en" xml:lang="en">
                   6482:         <div class="titlepage">
                   6483:           <div>
                   6484:             <div>
                   6485:               <h2 class="title"><a name="plist" id=
1.25      rillig   6486:               "plist"></a>Chapter&nbsp;9.&nbsp;PLIST issues</h2>
1.1       grant    6487:             </div>
                   6488:           </div>
                   6489:         </div>
                   6490: 
                   6491:         <div class="toc">
                   6492:           <p><b>Table of Contents</b></p>
                   6493: 
                   6494:           <dl>
1.30    ! wiz      6495:             <dt><span class="sect1"><a href="#rcs-id">9.1. RCS
1.1       grant    6496:             ID</a></span></dt>
                   6497: 
1.30    ! wiz      6498:             <dt><span class="sect1"><a href=
        !          6499:             "#automatic-plist-generation">9.2. Semi-automatic
        !          6500:             <code class="filename">PLIST</code>
1.14      xtraeme  6501:             generation</a></span></dt>
1.1       grant    6502: 
1.25      rillig   6503:             <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  6504:             Tweaking output of <span><strong class="command">make
                   6505:             print-PLIST</strong></span></a></span></dt>
1.1       grant    6506: 
1.25      rillig   6507:             <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    6508:             Variable substitution in PLIST</a></span></dt>
                   6509: 
1.30    ! wiz      6510:             <dt><span class="sect1"><a href=
        !          6511:             "#manpage-compression">9.5.
1.1       grant    6512:             Manpage-compression</a></span></dt>
                   6513: 
1.30    ! wiz      6514:             <dt><span class="sect1"><a href="#using-PLIST_SRC">9.6.
1.14      xtraeme  6515:             Changing PLIST source with <code class=
                   6516:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6517: 
1.30    ! wiz      6518:             <dt><span class="sect1"><a href=
        !          6519:             "#platform-specific-plist">9.7. Platform specific and
        !          6520:             differing PLISTs</a></span></dt>
1.1       grant    6521: 
1.25      rillig   6522:             <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1       grant    6523:             Sharing directories between packages</a></span></dt>
                   6524:           </dl>
                   6525:         </div>
                   6526: 
1.14      xtraeme  6527:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    6528:         package's &#8220;<span class="quote">packing
                   6529:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  6530:         package (relative to the <code class=
                   6531:         "filename">${PREFIX}</code> directory it's been installed
                   6532:         in) plus some additional statements - see the <a href=
1.1       grant    6533:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6534:         <span class="citerefentry"><span class=
                   6535:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   6536:         a full list. This chapter addresses some issues that need
1.14      xtraeme  6537:         attention when dealing with the <code class=
                   6538:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    6539: 
                   6540:         <div class="sect1" lang="en" xml:lang="en">
                   6541:           <div class="titlepage">
                   6542:             <div>
                   6543:               <div>
                   6544:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      6545:                 "rcs-id" id="rcs-id"></a>9.1.&nbsp;RCS ID</h2>
1.1       grant    6546:               </div>
                   6547:             </div>
                   6548:           </div>
                   6549: 
                   6550:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  6551:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    6552:           <pre class="programlisting">
1.17      sketch   6553: @comment $NetBSD$
1.1       grant    6554: </pre>
                   6555:         </div>
                   6556: 
                   6557:         <div class="sect1" lang="en" xml:lang="en">
                   6558:           <div class="titlepage">
                   6559:             <div>
                   6560:               <div>
                   6561:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      6562:                 "automatic-plist-generation" id=
        !          6563:                 "automatic-plist-generation"></a>9.2.&nbsp;Semi-automatic
1.14      xtraeme  6564:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    6565:               </div>
                   6566:             </div>
                   6567:           </div>
                   6568: 
1.14      xtraeme  6569:           <p>You can use the <span><strong class="command">make
                   6570:           print-PLIST</strong></span> command to output a PLIST
                   6571:           that matches any new files since the package was
                   6572:           extracted. See <a href="#build.helpful-targets" title=
1.25      rillig   6573:           "12.3.&nbsp;Other helpful targets">Section&nbsp;12.3,
1.1       grant    6574:           &#8220;Other helpful targets&#8221;</a> for more
                   6575:           information on this target.</p>
                   6576:         </div>
                   6577: 
                   6578:         <div class="sect1" lang="en" xml:lang="en">
                   6579:           <div class="titlepage">
                   6580:             <div>
                   6581:               <div>
                   6582:                 <h2 class="title" style="clear: both"><a name=
                   6583:                 "print-PLIST" id=
1.25      rillig   6584:                 "print-PLIST"></a>9.3.&nbsp;Tweaking output of
1.14      xtraeme  6585:                 <span><strong class="command">make
                   6586:                 print-PLIST</strong></span></h2>
1.1       grant    6587:               </div>
                   6588:             </div>
                   6589:           </div>
                   6590: 
                   6591:           <p>If you have used any of the *-dirs packages, as
                   6592:           explained in <a href="#faq.common-dirs" title=
1.25      rillig   6593:           "9.8.&nbsp;Sharing directories between packages">Section&nbsp;9.8,
1.1       grant    6594:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  6595:           you may have noticed that <span><strong class=
                   6596:           "command">make print-PLIST</strong></span> outputs a set
                   6597:           of <code class="varname">@comment</code>s instead of real
                   6598:           <code class="varname">@dirrm</code> lines. You can also
                   6599:           do this for specific directories and files, so that the
                   6600:           results of that command are very close to reality. This
                   6601:           helps <span class="emphasis"><em>a lot</em></span> during
                   6602:           the update of packages.</p>
                   6603: 
                   6604:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   6605:           variable takes a set of AWK patterns and actions that are
                   6606:           used to filter the output of print-PLIST. You can
                   6607:           <span class="emphasis"><em>append</em></span> any chunk
                   6608:           of AWK scripting you like to it, but be careful with
1.1       grant    6609:           quoting.</p>
                   6610: 
1.14      xtraeme  6611:           <p>For example, to get all files inside the <code class=
                   6612:           "filename">libdata/foo</code> directory removed from the
1.1       grant    6613:           resulting PLIST:</p>
                   6614:           <pre class="programlisting">
                   6615:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   6616:     
                   6617: </pre>
                   6618: 
1.14      xtraeme  6619:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    6620:           lines referring to a specific (shared) directory
1.14      xtraeme  6621:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    6622:           <pre class="programlisting">
                   6623:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   6624:     
                   6625: </pre>
                   6626:         </div>
                   6627: 
                   6628:         <div class="sect1" lang="en" xml:lang="en">
                   6629:           <div class="titlepage">
                   6630:             <div>
                   6631:               <div>
                   6632:                 <h2 class="title" style="clear: both"><a name=
1.25      rillig   6633:                 "plist.misc" id="plist.misc"></a>9.4.&nbsp;Variable
1.1       grant    6634:                 substitution in PLIST</h2>
                   6635:               </div>
                   6636:             </div>
                   6637:           </div>
                   6638: 
                   6639:           <p>A number of variables are substituted automatically in
                   6640:           PLISTs when a package is installed on a system. This
                   6641:           includes the following variables:</p>
                   6642: 
                   6643:           <div class="variablelist">
                   6644:             <dl>
1.14      xtraeme  6645:               <dt><span class="term"><code class=
                   6646:               "varname">${MACHINE_ARCH}</code>, <code class=
                   6647:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    6648: 
                   6649:               <dd>
                   6650:                 <p>Some packages like emacs and perl embed
                   6651:                 information about which architecture they were
                   6652:                 built on into the pathnames where they install
                   6653:                 their file. To handle this case, PLIST will be
                   6654:                 preprocessed before actually used, and the symbol
1.14      xtraeme  6655:                 &#8220;<span class="quote"><code class=
                   6656:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   6657:                 be replaced by what <span><strong class=
                   6658:                 "command">uname -p</strong></span> gives. The same
                   6659:                 is done if the string <code class=
                   6660:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   6661:                 PLIST somewhere - use this on packages that have
                   6662:                 GNU autoconf created configure scripts.</p>
1.1       grant    6663: 
                   6664:                 <div class="note" style=
                   6665:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   6666:                   <h3 class="title">Legacy note</h3>
                   6667: 
                   6668:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  6669:                   "quote"><code class=
                   6670:                   "varname">$ARCH</code></span>&#8221; that was
                   6671:                   replaced by the output of <span><strong class=
                   6672:                   "command">uname -m</strong></span>, but that's no
1.1       grant    6673:                   longer supported and has been removed.</p>
                   6674:                 </div>
                   6675:               </dd>
                   6676: 
1.14      xtraeme  6677:               <dt><span class="term"><code class=
                   6678:               "varname">${OPSYS}</code>, <code class=
                   6679:               "varname">${LOWER_OPSYS}</code>, <code class=
                   6680:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    6681: 
                   6682:               <dd>
                   6683:                 <p>Some packages want to embed the OS name and
                   6684:                 version into some paths. To do this, use these
1.14      xtraeme  6685:                 variables in the <code class=
                   6686:                 "filename">PLIST</code>:</p>
1.1       grant    6687: 
                   6688:                 <div class="itemizedlist">
                   6689:                   <ul type="disc">
                   6690:                     <li>
1.14      xtraeme  6691:                       <p><code class="varname">${OPSYS}</code> -
                   6692:                       output of &#8220;<span class=
                   6693:                       "quote"><span><strong class="command">uname
                   6694:                       -s</strong></span></span>&#8221;</p>
1.1       grant    6695:                     </li>
                   6696: 
                   6697:                     <li>
1.14      xtraeme  6698:                       <p><code class=
                   6699:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   6700:                       common name (eg. &#8220;<span class=
                   6701:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    6702:                     </li>
                   6703: 
                   6704:                     <li>
1.14      xtraeme  6705:                       <p><code class="varname">${OS_VERSION}</code>
                   6706:                       - &#8220;<span class=
                   6707:                       "quote"><span><strong class="command">uname
                   6708:                       -r</strong></span></span>&#8221;</p>
1.1       grant    6709:                     </li>
                   6710:                   </ul>
                   6711:                 </div>
                   6712:               </dd>
                   6713: 
1.14      xtraeme  6714:               <dt><span class="term"><code class=
                   6715:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    6716: 
                   6717:               <dd>
                   6718:                 <p>Packages that install locale files should list
                   6719:                 them in the PLIST as &#8220;<span class=
                   6720:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   6721:                 instead of &#8220;<span class=
                   6722:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   6723:                 This properly handles the fact that different
                   6724:                 operating systems expect locale files to be either
1.14      xtraeme  6725:                 in <code class="filename">share</code> or
                   6726:                 <code class="filename">lib</code> by default.</p>
1.1       grant    6727:               </dd>
                   6728:             </dl>
                   6729:           </div>
                   6730: 
                   6731:           <p>For a complete list of values which are replaced by
1.14      xtraeme  6732:           default, please look in <code class=
                   6733:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    6734:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   6735: 
                   6736:           <p>If you want to change other variables not listed
                   6737:           above, you can add variables and their expansions to this
1.14      xtraeme  6738:           variable in the following way, similar to <code class=
                   6739:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    6740:           "#components.optional" title=
1.27      rillig   6741:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
1.1       grant    6742:           &#8220;Optional files&#8221;</a>):</p>
                   6743:           <pre class="programlisting">
                   6744: PLIST_SUBST+=    SOMEVAR="somevalue"
                   6745: </pre>
                   6746: 
                   6747:           <p>This replaces all occurrences of &#8220;<span class=
                   6748:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   6749:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   6750:         </div>
                   6751: 
                   6752:         <div class="sect1" lang="en" xml:lang="en">
                   6753:           <div class="titlepage">
                   6754:             <div>
                   6755:               <div>
                   6756:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      6757:                 "manpage-compression" id=
        !          6758:                 "manpage-compression"></a>9.5.&nbsp;Manpage-compression</h2>
1.1       grant    6759:               </div>
                   6760:             </div>
                   6761:           </div>
                   6762: 
                   6763:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  6764:           <code class="varname">MANZ</code> is set (in <code class=
                   6765:           "filename">bsd.own.mk</code>), and uncompressed
                   6766:           otherwise. To handle this in the <code class=
                   6767:           "filename">PLIST</code> file, the suffix
                   6768:           &#8220;<span class="quote">.gz</span>&#8221; is
                   6769:           appended/removed automatically for manpages according to
                   6770:           <code class="varname">MANZ</code> and <code class=
                   6771:           "varname">MANCOMPRESSED</code> being set or not, see
                   6772:           above for details. This modification of the <code class=
                   6773:           "filename">PLIST</code> file is done on a copy of it, not
                   6774:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    6775:         </div>
                   6776: 
                   6777:         <div class="sect1" lang="en" xml:lang="en">
                   6778:           <div class="titlepage">
                   6779:             <div>
                   6780:               <div>
                   6781:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      6782:                 "using-PLIST_SRC" id=
        !          6783:                 "using-PLIST_SRC"></a>9.6.&nbsp;Changing PLIST
        !          6784:                 source with <code class=
1.14      xtraeme  6785:                 "varname">PLIST_SRC</code></h2>
1.1       grant    6786:               </div>
                   6787:             </div>
                   6788:           </div>
                   6789: 
1.14      xtraeme  6790:           <p>To use one or more files as source for the
                   6791:           <code class="filename">PLIST</code> used in generating
                   6792:           the binary package, set the variable <code class=
                   6793:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      6794:           The files are later concatenated using <a href=
                   6795:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   6796:           <span class="citerefentry"><span class=
                   6797:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   6798:           things is important.</p>
1.1       grant    6799:         </div>
                   6800: 
                   6801:         <div class="sect1" lang="en" xml:lang="en">
                   6802:           <div class="titlepage">
                   6803:             <div>
                   6804:               <div>
                   6805:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      6806:                 "platform-specific-plist" id=
        !          6807:                 "platform-specific-plist"></a>9.7.&nbsp;Platform
1.1       grant    6808:                 specific and differing PLISTs</h2>
                   6809:               </div>
                   6810:             </div>
                   6811:           </div>
                   6812: 
                   6813:           <p>Some packages decide to install a different set of
                   6814:           files based on the operating system being used. These
                   6815:           differences can be automatically handled by using the
                   6816:           following files:</p>
                   6817: 
                   6818:           <div class="itemizedlist">
                   6819:             <ul type="disc">
                   6820:               <li>
1.14      xtraeme  6821:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    6822:               </li>
                   6823: 
                   6824:               <li>
1.14      xtraeme  6825:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    6826:               </li>
                   6827: 
                   6828:               <li>
1.14      xtraeme  6829:                 <p><code class=
1.21      ben      6830:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   6831:               </li>
                   6832: 
                   6833:               <li>
                   6834:                 <p><code class=
                   6835:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   6836:               </li>
                   6837: 
                   6838:               <li>
                   6839:                 <p><code class=
1.14      xtraeme  6840:                 "filename">PLIST.common_end</code></p>
1.1       grant    6841:               </li>
                   6842:             </ul>
                   6843:           </div>
                   6844:         </div>
                   6845: 
                   6846:         <div class="sect1" lang="en" xml:lang="en">
                   6847:           <div class="titlepage">
                   6848:             <div>
                   6849:               <div>
                   6850:                 <h2 class="title" style="clear: both"><a name=
                   6851:                 "faq.common-dirs" id=
1.25      rillig   6852:                 "faq.common-dirs"></a>9.8.&nbsp;Sharing directories
1.1       grant    6853:                 between packages</h2>
                   6854:               </div>
                   6855:             </div>
                   6856:           </div>
                   6857: 
                   6858:           <p>A &#8220;<span class="quote">shared
                   6859:           directory</span>&#8221; is a directory where multiple
                   6860:           (and unrelated) packages install files. These directories
                   6861:           are problematic because you have to add special tricks in
                   6862:           the PLIST to conditionally remove them, or have some
                   6863:           centralized package handle them.</p>
                   6864: 
                   6865:           <p>Within pkgsrc, you'll find both approaches. If a
                   6866:           directory is shared by a few unrelated packages, it's
                   6867:           often not worth to add an extra package to remove it.
                   6868:           Therefore, one simply does:</p>
                   6869:           <pre class="programlisting">
                   6870:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   6871:     
                   6872: </pre>
                   6873: 
                   6874:           <p>in the PLISTs of all affected packages, instead of the
                   6875:           regular "@dirrm" line.</p>
                   6876: 
                   6877:           <p>However, if the directory is shared across many
                   6878:           packages, two different solutions are available:</p>
                   6879: 
                   6880:           <div class="orderedlist">
                   6881:             <ol type="1">
                   6882:               <li>
                   6883:                 <p>If the packages have a common dependency, the
                   6884:                 directory can be removed in that. For example, see
                   6885:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6886:                 href=
                   6887:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      6888:                 class="pkgname">textproc/scrollkeeper</a>, which
                   6889:                 removes the shared directory <code class=
                   6890:                 "filename">share/omf</code>.</p>
1.1       grant    6891:               </li>
                   6892: 
                   6893:               <li>
                   6894:                 <p>If the packages using the directory are not
                   6895:                 related at all (they have no common dependencies),
                   6896:                 a *-dirs package is used.</p>
                   6897:               </li>
                   6898:             </ol>
                   6899:           </div>
                   6900: 
                   6901:           <p>From now on, we'll discuss the second solution. To get
                   6902:           an idea of the *-dirs packages available, issue:</p>
                   6903:           <pre class="programlisting">
1.14      xtraeme  6904:       <code class="prompt">%</code> cd .../pkgsrc
                   6905:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    6906:     
                   6907: </pre>
                   6908: 
                   6909:           <p>Their use from other packages is very simple. The
1.14      xtraeme  6910:           <code class="varname">USE_DIRS</code> variable takes a
                   6911:           list of package names (without the &#8220;<span class=
1.1       grant    6912:           "quote">-dirs</span>&#8221; part) together with the
                   6913:           required version number (always pick the latest one when
                   6914:           writting new packages).</p>
                   6915: 
                   6916:           <p>For example, if a package installs files under
1.14      xtraeme  6917:           <code class="filename">share/applications</code>, it
                   6918:           should have the following line in it:</p>
1.1       grant    6919:           <pre class="programlisting">
                   6920:       USE_DIRS+= xdg-1.1
                   6921:     
                   6922: </pre>
                   6923: 
1.14      xtraeme  6924:           <p>After regenerating the PLIST using
                   6925:           <span><strong class="command">make
                   6926:           print-PLIST</strong></span>, you should get the right
                   6927:           (commented out) lines.</p>
1.1       grant    6928: 
1.14      xtraeme  6929:           <p>Note that, even if your package is using <code class=
                   6930:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    6931:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  6932:           part and pkgsrc (in particular, <code class=
                   6933:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    6934:         </div>
                   6935:       </div>
                   6936: 
                   6937:       <div class="chapter" lang="en" xml:lang="en">
                   6938:         <div class="titlepage">
                   6939:           <div>
                   6940:             <div>
                   6941:               <h2 class="title"><a name="buildlink" id=
1.25      rillig   6942:               "buildlink"></a>Chapter&nbsp;10.&nbsp;Buildlink
1.1       grant    6943:               methodology</h2>
                   6944:             </div>
                   6945:           </div>
                   6946:         </div>
                   6947: 
                   6948:         <div class="toc">
                   6949:           <p><b>Table of Contents</b></p>
                   6950: 
                   6951:           <dl>
1.30    ! wiz      6952:             <dt><span class="sect1"><a href=
        !          6953:             "#converting-to-buildlink3">10.1. Converting packages
        !          6954:             to use buildlink3</a></span></dt>
1.1       grant    6955: 
1.30    ! wiz      6956:             <dt><span class="sect1"><a href=
        !          6957:             "#creating-buildlink3.mk">10.2. Writing <code class=
        !          6958:             "filename">buildlink3.mk</code> files</a></span></dt>
1.1       grant    6959: 
                   6960:             <dd>
                   6961:               <dl>
1.25      rillig   6962:                 <dt><span class="sect2"><a href=
1.30    ! wiz      6963:                 "#anatomy-of-bl3">10.2.1. Anatomy of a
        !          6964:                 buildlink3.mk file</a></span></dt>
1.1       grant    6965: 
1.25      rillig   6966:                 <dt><span class="sect2"><a href=
1.30    ! wiz      6967:                 "#updating-buildlink-depends">10.2.2. Updating
        !          6968:                 <code class="varname">BUILDLINK_DEPENDS.<em class=
1.14      xtraeme  6969:                 "replaceable"><code>pkg</code></em></code> in
                   6970:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6971:                 files</a></span></dt>
                   6972:               </dl>
                   6973:             </dd>
                   6974: 
1.30    ! wiz      6975:             <dt><span class="sect1"><a href=
        !          6976:             "#writing-builtin.mk">10.3. Writing <code class=
        !          6977:             "filename">builtin.mk</code> files</a></span></dt>
1.1       grant    6978: 
                   6979:             <dd>
                   6980:               <dl>
1.25      rillig   6981:                 <dt><span class="sect2"><a href=
1.30    ! wiz      6982:                 "#anatomy-of-builtin.mk">10.3.1. Anatomy of a
        !          6983:                 <code class="filename">builtin.mk</code>
        !          6984:                 file</a></span></dt>
1.1       grant    6985: 
1.25      rillig   6986:                 <dt><span class="sect2"><a href=
1.30    ! wiz      6987:                 "#native-or-pkgsrc-preference">10.3.2. Global
        !          6988:                 preferences for native or pkgsrc
        !          6989:                 software</a></span></dt>
1.1       grant    6990:               </dl>
                   6991:             </dd>
                   6992:           </dl>
                   6993:         </div>
                   6994: 
                   6995:         <p>Buildlink is a framework in pkgsrc that controls what
                   6996:         headers and libraries are seen by a package's configure and
                   6997:         build processes. This is implemented in a two step
                   6998:         process:</p>
                   6999: 
                   7000:         <div class="orderedlist">
                   7001:           <ol type="1">
                   7002:             <li>
                   7003:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  7004:               into <code class="varname">BUILDLINK_DIR</code>,
                   7005:               which by default is a subdirectory of <code class=
                   7006:               "varname">WRKDIR</code>.</p>
1.1       grant    7007:             </li>
                   7008: 
                   7009:             <li>
                   7010:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  7011:               the normal compiler tools that translate <code class=
                   7012:               "option">-I${LOCALBASE}/include</code> and
                   7013:               <code class="option">-L${LOCALBASE}/lib</code> into
                   7014:               references to <code class=
                   7015:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   7016:               also make native compiler on some operating systems
                   7017:               look like GCC, so that packages that expect GCC won't
                   7018:               require modifications to build with those native
                   7019:               compilers.</p>
1.1       grant    7020:             </li>
                   7021:           </ol>
                   7022:         </div>
                   7023: 
                   7024:         <p>This normalizes the environment in which a package is
                   7025:         built so that the package may be built consistently despite
                   7026:         what other software may be installed. Please note that the
1.14      xtraeme  7027:         normal system header and library paths, e.g. <code class=
                   7028:         "filename">/usr/include</code>, <code class=
                   7029:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    7030:         buildlink3 is designed to insulate the package build from
                   7031:         non-system-supplied software.</p>
                   7032: 
                   7033:         <div class="sect1" lang="en" xml:lang="en">
                   7034:           <div class="titlepage">
                   7035:             <div>
                   7036:               <div>
                   7037:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      7038:                 "converting-to-buildlink3" id=
        !          7039:                 "converting-to-buildlink3"></a>10.1.&nbsp;Converting
        !          7040:                 packages to use buildlink3</h2>
1.1       grant    7041:               </div>
                   7042:             </div>
                   7043:           </div>
                   7044: 
                   7045:           <p>The process of converting packages to use the
                   7046:           buildlink3 framework (&#8220;<span class=
                   7047:           "quote">bl3ifying</span>&#8221;) is fairly
                   7048:           straightforward. The things to keep in mind are:</p>
                   7049: 
                   7050:           <div class="orderedlist">
                   7051:             <ol type="1">
                   7052:               <li>
                   7053:                 <p>Ensure that the build always calls the wrapper
                   7054:                 scripts instead of the actual toolchain. Some
                   7055:                 packages are tricky, and the only way to know for
1.14      xtraeme  7056:                 sure is the check <code class=
                   7057:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    7058:                 wrappers are being invoked.</p>
                   7059:               </li>
                   7060: 
                   7061:               <li>
1.14      xtraeme  7062:                 <p>Don't override <code class=
                   7063:                 "varname">PREFIX</code> from within the package
                   7064:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   7065:                 because the code to symlink files into <code class=
                   7066:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    7067:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  7068:                 <em class=
                   7069:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    7070:               </li>
                   7071: 
                   7072:               <li>
                   7073:                 <p>Remember that <span class=
1.14      xtraeme  7074:                 "emphasis"><em>only</em></span> the <code class=
                   7075:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    7076:                 in a package's Makefile are added as dependencies
                   7077:                 for that package.</p>
                   7078:               </li>
                   7079:             </ol>
                   7080:           </div>
                   7081: 
                   7082:           <p>If a dependency on a particular package is required
                   7083:           for its libraries and headers, then we replace:</p>
                   7084:           <pre class="programlisting">
1.27      rillig   7085: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    7086: </pre>
                   7087: 
                   7088:           <p>with</p>
                   7089:           <pre class="programlisting">
                   7090: .include "../../category/foo/buildlink3.mk"
                   7091: </pre>
                   7092: 
1.14      xtraeme  7093:           <p>There are several <code class=
                   7094:           "filename">buildlink3.mk</code> files in <code class=
                   7095:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    7096:           issues:</p>
                   7097: 
                   7098:           <div class="itemizedlist">
                   7099:             <ul type="disc">
                   7100:               <li>
1.14      xtraeme  7101:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    7102:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  7103:                 implementation based on the values of <code class=
                   7104:                 "varname">BDB_ACCEPTED</code> and <code class=
                   7105:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    7106:               </li>
                   7107: 
                   7108:               <li>
1.14      xtraeme  7109:                 <p><code class=
                   7110:                 "filename">curses.buildlink3.mk</code> If the
                   7111:                 system comes with neither Curses nor NCurses, this
                   7112:                 will take care to install the <a xmlns=
                   7113:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    7114:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      7115:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    7116:               </li>
                   7117: 
                   7118:               <li>
1.14      xtraeme  7119:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   7120:                 uses the value of <code class=
                   7121:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    7122:                 adding a dependency on Heimdal or MIT-krb5 for
                   7123:                 packages that require a Kerberos 5
                   7124:                 implementation.</p>
                   7125:               </li>
                   7126: 
                   7127:               <li>
1.14      xtraeme  7128:                 <p><code class=
                   7129:                 "filename">motif.buildlink3.mk</code> checks for a
                   7130:                 system-provided Motif installation or adds a
                   7131:                 dependency on <a xmlns=
1.1       grant    7132:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7133:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      7134:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   7135:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7136:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   7137:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    7138:               </li>
                   7139: 
                   7140:               <li>
1.14      xtraeme  7141:                 <p><code class=
                   7142:                 "filename">ossaudio.buildlink3.mk</code> defines
                   7143:                 several variables that may be used by packages that
                   7144:                 use the Open Sound System (OSS) API;</p>
1.1       grant    7145:               </li>
                   7146: 
                   7147:               <li>
1.14      xtraeme  7148:                 <p><code class=
                   7149:                 "filename">pgsql.buildlink3.mk</code> will accept
                   7150:                 either Postgres 7.3 or 7.4, whichever is found
                   7151:                 installed. See the file for more information.</p>
1.1       grant    7152:               </li>
                   7153: 
                   7154:               <li>
1.14      xtraeme  7155:                 <p><code class=
                   7156:                 "filename">pthread.buildlink3.mk</code> uses the
                   7157:                 value of <code class="varname">PTHREAD_OPTS</code>
                   7158:                 and checks for native pthreads or adds a dependency
                   7159:                 on <a xmlns=
1.1       grant    7160:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7161:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      7162:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    7163:               </li>
                   7164: 
                   7165:               <li>
1.14      xtraeme  7166:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   7167:                 uses the value of <code class=
                   7168:                 "varname">XAW_TYPE</code> to choose a particular
                   7169:                 Athena widgets library.</p>
1.1       grant    7170:               </li>
                   7171:             </ul>
                   7172:           </div>
                   7173: 
1.14      xtraeme  7174:           <p>The comments in those <code class=
                   7175:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    7176:           complete description of how to use them properly.</p>
                   7177:         </div>
                   7178: 
                   7179:         <div class="sect1" lang="en" xml:lang="en">
                   7180:           <div class="titlepage">
                   7181:             <div>
                   7182:               <div>
                   7183:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      7184:                 "creating-buildlink3.mk" id=
        !          7185:                 "creating-buildlink3.mk"></a>10.2.&nbsp;Writing
1.14      xtraeme  7186:                 <code class="filename">buildlink3.mk</code>
                   7187:                 files</h2>
1.1       grant    7188:               </div>
                   7189:             </div>
                   7190:           </div>
                   7191: 
1.14      xtraeme  7192:           <p>A package's <code class=
                   7193:           "filename">buildlink3.mk</code> file is included by
                   7194:           Makefiles to indicate the need to compile and link
                   7195:           against header files and libraries provided by the
                   7196:           package. A <code class="filename">buildlink3.mk</code>
                   7197:           file should always provide enough information to add the
                   7198:           correct type of dependency relationship and include any
                   7199:           other <code class="filename">buildlink3.mk</code> files
                   7200:           that it needs to find headers and libraries that it needs
                   7201:           in turn.</p>
1.1       grant    7202: 
1.14      xtraeme  7203:           <p>To generate an initial <code class=
                   7204:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    7205:           Rene Hexel's <a xmlns=
                   7206:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7207:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      7208:           class="pkgname">pkgtools/createbuildlink</a> package is
                   7209:           highly recommended. For most packages, the following
                   7210:           command will generate a good starting point for
                   7211:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    7212:           <pre class="screen">
1.14      xtraeme  7213: <code class="prompt">%</code> <strong class=
                   7214: "userinput"><code>cd pkgsrc/<em class=
                   7215: "replaceable"><code>category</code></em>/<em class=
                   7216: "replaceable"><code>pkgdir</code></em>
                   7217: <code class=
                   7218: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    7219: </pre>
                   7220: 
                   7221:           <div class="sect2" lang="en" xml:lang="en">
                   7222:             <div class="titlepage">
                   7223:               <div>
                   7224:                 <div>
1.30    ! wiz      7225:                   <h3 class="title"><a name="anatomy-of-bl3" id=
        !          7226:                   "anatomy-of-bl3"></a>10.2.1. Anatomy of a
1.25      rillig   7227:                   buildlink3.mk file</h3>
1.1       grant    7228:                 </div>
                   7229:               </div>
                   7230:             </div>
                   7231: 
1.14      xtraeme  7232:             <p>The following real-life example <code class=
                   7233:             "filename">buildlink3.mk</code> is taken from
                   7234:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    7235:             <pre class="programlisting">
1.17      sketch   7236: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    7237: 
                   7238: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   7239: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   7240: 
                   7241: .if !empty(BUILDLINK_DEPTH:M+)
                   7242: BUILDLINK_DEPENDS+=     tiff
                   7243: .endif
                   7244: 
                   7245: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   7246: BUILDLINK_PACKAGES+=    tiff
                   7247: 
                   7248: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   7249: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   7250: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   7251: .endif  # TIFF_BUILDLINK3_MK
                   7252: 
                   7253: .include "../../devel/zlib/buildlink3.mk"
                   7254: .include "../../graphics/jpeg/buildlink3.mk"
                   7255: 
                   7256: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   7257: </pre>
                   7258: 
1.14      xtraeme  7259:             <p>The header and footer manipulate <code class=
                   7260:             "varname">BUILDLINK_DEPTH</code>, which is common
                   7261:             across all <code class="filename">buildlink3.mk</code>
                   7262:             files and is used to track at what depth we are
                   7263:             including <code class="filename">buildlink3.mk</code>
                   7264:             files.</p>
1.1       grant    7265: 
                   7266:             <p>The first section controls if the dependency on
1.14      xtraeme  7267:             <em class="replaceable"><code>pkg</code></em> is added.
                   7268:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    7269:             global list of packages for which dependencies are
                   7270:             added by buildlink3.</p>
                   7271: 
                   7272:             <p>The second section advises pkgsrc that the
1.14      xtraeme  7273:             <code class="filename">buildlink3.mk</code> file for
                   7274:             <em class="replaceable"><code>pkg</code></em> has been
                   7275:             included at some point. <code class=
                   7276:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   7277:             of packages for which <code class=
                   7278:             "filename">buildlink3.mk</code> files have been
                   7279:             included. It must <span class=
                   7280:             "emphasis"><em>always</em></span> be appended to within
                   7281:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    7282: 
                   7283:             <p>The third section is protected from multiple
1.14      xtraeme  7284:             inclusion and controls how the dependency on <em class=
                   7285:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    7286:             important variables are set in the section:</p>
                   7287: 
                   7288:             <div class="itemizedlist">
                   7289:               <ul type="disc">
                   7290:                 <li>
1.14      xtraeme  7291:                   <p><code class=
                   7292:                   "varname">BUILDLINK_DEPENDS.<em class=
                   7293:                   "replaceable"><code>pkg</code></em></code> is the
                   7294:                   actual dependency recorded in the installed
                   7295:                   package; this should always be set using
                   7296:                   <span><strong class="command">+=</strong></span>
                   7297:                   to ensure that we're appending to any
                   7298:                   pre-existing list of values. This variable should
                   7299:                   be set to the first version of the package that
                   7300:                   had the last change in the major number of a
                   7301:                   shared library or that had a major API
                   7302:                   change.</p>
1.1       grant    7303:                 </li>
                   7304: 
                   7305:                 <li>
1.14      xtraeme  7306:                   <p><code class=
                   7307:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   7308:                   "replaceable"><code>pkg</code></em></code> is the
                   7309:                   location of the <em class=
                   7310:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    7311:                   directory;</p>
                   7312:                 </li>
                   7313: 
                   7314:                 <li>
1.14      xtraeme  7315:                   <p><code class=
                   7316:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7317:                   "replaceable"><code>pkg</code></em></code> (not
                   7318:                   shown above) controls whether we use <code class=
                   7319:                   "varname">BUILD_DEPENDS</code> or <code class=
                   7320:                   "varname">DEPENDS</code> to add the dependency on
                   7321:                   <em class="replaceable"><code>pkg</code></em>.
                   7322:                   The build dependency is selected by setting
                   7323:                   <code class=
                   7324:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7325:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    7326:                   &#8220;<span class="quote">build</span>&#8221;.
                   7327:                   By default, the full dependency is used.</p>
                   7328:                 </li>
                   7329: 
                   7330:                 <li>
1.14      xtraeme  7331:                   <p><code class=
                   7332:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7333:                   "replaceable"><code>pkg</code></em></code> and
                   7334:                   <code class=
                   7335:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   7336:                   <code>pkg</code></em></code> (not shown above)
                   7337:                   are lists of subdirectories of <code class=
                   7338:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7339:                   "replaceable"><code>pkg</code></em>}</code> to
                   7340:                   add to the header and library search paths. These
1.1       grant    7341:                   default to &#8220;<span class=
                   7342:                   "quote">include</span>&#8221; and
                   7343:                   &#8220;<span class="quote">lib</span>&#8221;
                   7344:                   respectively.</p>
                   7345:                 </li>
                   7346: 
                   7347:                 <li>
1.14      xtraeme  7348:                   <p><code class=
                   7349:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   7350:                   "replaceable"><code>pkg</code></em></code> (not
                   7351:                   shown above) is the list of preprocessor flags to
                   7352:                   add to <code class="varname">CPPFLAGS</code>,
                   7353:                   which are passed on to the configure and build
                   7354:                   phases. The &#8220;<span class=
                   7355:                   "quote">-I</span>&#8221; option should be avoided
                   7356:                   and instead be handled using <code class=
                   7357:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7358:                   "replaceable"><code>pkg</code></em></code> as
                   7359:                   above.</p>
1.1       grant    7360:                 </li>
                   7361:               </ul>
                   7362:             </div>
                   7363: 
                   7364:             <p>The following variables are all optionally defined
                   7365:             within this second section (protected against multiple
                   7366:             inclusion) and control which package files are
1.14      xtraeme  7367:             symlinked into <code class=
                   7368:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    7369:             are transformed during the symlinking:</p>
                   7370: 
                   7371:             <div class="itemizedlist">
                   7372:               <ul type="disc">
                   7373:                 <li>
1.14      xtraeme  7374:                   <p><code class=
                   7375:                   "varname">BUILDLINK_FILES.<em class=
                   7376:                   "replaceable"><code>pkg</code></em></code> (not
                   7377:                   shown above) is a shell glob pattern relative to
                   7378:                   <code class=
                   7379:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7380:                   "replaceable"><code>pkg</code></em>}</code> to be
                   7381:                   symlinked into <code class=
                   7382:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   7383:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    7384:                 </li>
                   7385: 
                   7386:                 <li>
1.14      xtraeme  7387:                   <p><code class=
                   7388:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   7389:                   "replaceable"><code>pkg</code></em></code> (not
                   7390:                   shown above) is a shell pipeline that outputs to
                   7391:                   stdout a list of files relative to <code class=
                   7392:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7393:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    7394:                   resulting files are to be symlinked into
1.14      xtraeme  7395:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   7396:                   By default, this takes the <code class=
                   7397:                   "filename">+CONTENTS</code> of a <em class=
                   7398:                   "replaceable"><code>pkg</code></em> and filters
                   7399:                   it through <code class=
                   7400:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   7401:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    7402:                 </li>
                   7403: 
                   7404:                 <li>
1.14      xtraeme  7405:                   <p><code class=
                   7406:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7407:                   "replaceable"><code>pkg</code></em></code> (not
                   7408:                   shown above) is a filter command that filters
                   7409:                   <code class="filename">+CONTENTS</code> input
                   7410:                   into a list of files relative to <code class=
                   7411:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7412:                   "replaceable"><code>pkg</code></em>}</code> on
                   7413:                   stdout. By default for overwrite packages,
                   7414:                   <code class=
                   7415:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7416:                   "replaceable"><code>pkg</code></em></code>
                   7417:                   outputs the contents of the <code class=
                   7418:                   "filename">include</code> and <code class=
                   7419:                   "filename">lib</code> directories in the package
                   7420:                   <code class="filename">+CONTENTS</code>, and for
                   7421:                   pkgviews packages, it outputs any libtool
                   7422:                   archives in <code class="filename">lib</code>
1.1       grant    7423:                   directories.</p>
                   7424:                 </li>
                   7425: 
                   7426:                 <li>
1.14      xtraeme  7427:                   <p><code class=
                   7428:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   7429:                   "replaceable"><code>pkg</code></em></code> (not
                   7430:                   shown above) is a list of sed arguments used to
1.1       grant    7431:                   transform the name of the source filename into a
1.14      xtraeme  7432:                   destination filename, e.g. <span><strong class=
1.1       grant    7433:                   "command">-e
1.14      xtraeme  7434:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    7435:                 </li>
                   7436:               </ul>
                   7437:             </div>
                   7438: 
1.14      xtraeme  7439:             <p>The last section includes any <code class=
                   7440:             "filename">buildlink3.mk</code> needed for <em class=
                   7441:             "replaceable"><code>pkg</code></em>'s library
                   7442:             dependencies. Including these <code class=
                   7443:             "filename">buildlink3.mk</code> files means that the
                   7444:             headers and libraries for these dependencies are also
                   7445:             symlinked into <code class=
                   7446:             "filename">${BUILDLINK_DIR}</code> whenever the
                   7447:             <em class="replaceable"><code>pkg</code></em>
                   7448:             <code class="filename">buildlink3.mk</code> file is
                   7449:             included.</p>
1.1       grant    7450:           </div>
                   7451: 
                   7452:           <div class="sect2" lang="en" xml:lang="en">
                   7453:             <div class="titlepage">
                   7454:               <div>
                   7455:                 <div>
1.30    ! wiz      7456:                   <h3 class="title"><a name=
        !          7457:                   "updating-buildlink-depends" id=
        !          7458:                   "updating-buildlink-depends"></a>10.2.2. Updating
        !          7459:                   <code class=
        !          7460:                   "varname">BUILDLINK_DEPENDS.<em class="replaceable">
        !          7461:                   <code>pkg</code></em></code> in <code class=
        !          7462:                   "filename">buildlink3.mk</code> files</h3>
1.1       grant    7463:                 </div>
                   7464:               </div>
                   7465:             </div>
                   7466: 
                   7467:             <p>There are two situations that require increasing the
1.14      xtraeme  7468:             dependency listed in <code class=
                   7469:             "varname">BUILDLINK_DEPENDS.<em class=
                   7470:             "replaceable"><code>pkg</code></em></code> after a
                   7471:             package update:</p>
1.1       grant    7472: 
                   7473:             <div class="orderedlist">
                   7474:               <ol type="1">
                   7475:                 <li>
                   7476:                   <p>if the sonames (major number of the library
                   7477:                   version) of any installed shared libraries
                   7478:                   change;</p>
                   7479:                 </li>
                   7480: 
                   7481:                 <li>
                   7482:                   <p>if the API or interface to the header files
                   7483:                   change.</p>
                   7484:                 </li>
                   7485:               </ol>
                   7486:             </div>
                   7487: 
1.14      xtraeme  7488:             <p>In these cases, <code class=
                   7489:             "varname">BUILDLINK_DEPENDS.<em class=
                   7490:             "replaceable"><code>pkg</code></em></code> should be
                   7491:             adjusted to require at least the new package version.
                   7492:             In some cases, the packages that depend on this new
                   7493:             version may need their <code class=
                   7494:             "varname">PKGREVISION</code>s increased and, if they
                   7495:             have <code class="filename">buildlink3.mk</code> files,
                   7496:             their <code class=
                   7497:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   7498:             pkg</code></em></code> adjusted, too. This is needed so
                   7499:             that binary packages made using it will require the
                   7500:             correct package dependency and not settle for an older
                   7501:             one which will not contain the necessary shared
                   7502:             libraries.</p>
1.1       grant    7503: 
                   7504:             <p>Please take careful consideration before adjusting
1.14      xtraeme  7505:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   7506:             "replaceable"><code>pkg</code></em></code> as we don't
                   7507:             want to cause unneeded package deletions and rebuilds.
                   7508:             In many cases, new versions of packages work just fine
                   7509:             with older dependencies. See <a href="#dependencies"
1.25      rillig   7510:             title="13.1.3.&nbsp;Handling dependencies">Section
                   7511:             13.1.3, &#8220;Handling dependencies&#8221;</a> and
1.14      xtraeme  7512:             <a href="#buildlink" title=
1.25      rillig   7513:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter
                   7514:             10, <i>Buildlink methodology</i></a> for more
                   7515:             information about dependencies on other packages,
                   7516:             including the <code class=
                   7517:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   7518:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    7519:           </div>
                   7520:         </div>
                   7521: 
                   7522:         <div class="sect1" lang="en" xml:lang="en">
                   7523:           <div class="titlepage">
                   7524:             <div>
                   7525:               <div>
                   7526:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      7527:                 "writing-builtin.mk" id=
        !          7528:                 "writing-builtin.mk"></a>10.3.&nbsp;Writing
1.14      xtraeme  7529:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    7530:               </div>
                   7531:             </div>
                   7532:           </div>
                   7533: 
                   7534:           <p>Some packages in pkgsrc install headers and libraries
                   7535:           that coincide with headers and libraries present in the
1.14      xtraeme  7536:           base system. Aside from a <code class=
                   7537:           "filename">buildlink3.mk</code> file, these packages
                   7538:           should also include a <code class=
                   7539:           "filename">builtin.mk</code> file that includes the
                   7540:           necessary checks to decide whether using the built-in
                   7541:           software or the pkgsrc software is appropriate.</p>
1.1       grant    7542: 
                   7543:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  7544:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    7545: 
                   7546:           <div class="orderedlist">
                   7547:             <ol type="1">
                   7548:               <li>
1.14      xtraeme  7549:                 <p>It should set <code class=
                   7550:                 "varname">USE_BUILTIN.<em class=
                   7551:                 "replaceable"><code>pkg</code></em></code> to
                   7552:                 either &#8220;<span class="quote">yes</span>&#8221;
                   7553:                 or &#8220;<span class="quote">no</span>&#8221;
                   7554:                 after it is included.</p>
1.1       grant    7555:               </li>
                   7556: 
                   7557:               <li>
                   7558:                 <p>It should <span class=
                   7559:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  7560:                 <code class="varname">USE_BUILTIN.<em class=
                   7561:                 "replaceable"><code>pkg</code></em></code> which is
                   7562:                 already set before the <code class=
                   7563:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    7564:               </li>
                   7565: 
                   7566:               <li>
                   7567:                 <p>It should be written to allow multiple
                   7568:                 inclusion. This is <span class=
                   7569:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  7570:                 careful attention to <code class=
                   7571:                 "filename">Makefile</code> coding.</p>
1.1       grant    7572:               </li>
                   7573:             </ol>
                   7574:           </div>
                   7575: 
                   7576:           <div class="sect2" lang="en" xml:lang="en">
                   7577:             <div class="titlepage">
                   7578:               <div>
                   7579:                 <div>
1.30    ! wiz      7580:                   <h3 class="title"><a name="anatomy-of-builtin.mk"
        !          7581:                   id=
        !          7582:                   "anatomy-of-builtin.mk"></a>10.3.1.&nbsp;Anatomy
        !          7583:                   of a <code class="filename">builtin.mk</code>
1.14      xtraeme  7584:                   file</h3>
1.1       grant    7585:                 </div>
                   7586:               </div>
                   7587:             </div>
                   7588: 
                   7589:             <p>The following is the recommended template for
                   7590:             builtin.mk files:</p>
                   7591:             <pre class="programlisting">
                   7592: .if !defined(IS_BUILTIN.foo)
                   7593: #
                   7594: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   7595: # genuinely exists in the system or not.
                   7596: #
                   7597: IS_BUILTIN.foo?=        no
                   7598: 
                   7599: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   7600: # version can be determined.
                   7601: #
                   7602: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   7603: BUILTIN_PKG.foo?=       foo-1.0
                   7604: .  endif
                   7605: .endif  # IS_BUILTIN.foo
                   7606: 
                   7607: .if !defined(USE_BUILTIN.foo)
                   7608: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   7609: .  if defined(BUILTIN_PKG.foo)
                   7610: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   7611: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   7612: USE_BUILTIN.foo!=                                                       \
                   7613:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   7614:               ${ECHO} "yes";                                            \
                   7615:       else                                                              \
                   7616:               ${ECHO} "no";                                             \
                   7617:       fi
                   7618: .      endif
                   7619: .    endfor
                   7620: .  endif
                   7621: .endif  # USE_BUILTIN.foo
                   7622: 
                   7623: CHECK_BUILTIN.foo?=     no
                   7624: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   7625: #
                   7626: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   7627: # "yes" or "no".
                   7628: #
                   7629: .endif  # CHECK_BUILTIN.foo
                   7630:       
                   7631: </pre>
                   7632: 
1.14      xtraeme  7633:             <p>The first section sets <code class=
                   7634:             "varname">IS_BUILTIN.<em class=
                   7635:             "replaceable"><code>pkg</code></em></code> depending on
                   7636:             if <em class="replaceable"><code>pkg</code></em> really
                   7637:             exists in the base system. This should not be a base
                   7638:             system software with similar functionality to
                   7639:             <em class="replaceable"><code>pkg</code></em>; it
                   7640:             should only be &#8220;<span class=
                   7641:             "quote">yes</span>&#8221; if the actual package is
                   7642:             included as part of the base system. This variable is
                   7643:             only used internally within the <code class=
                   7644:             "filename">builtin.mk</code> file.</p>
                   7645: 
                   7646:             <p>The second section sets <code class=
                   7647:             "varname">BUILTIN_PKG.<em class=
                   7648:             "replaceable"><code>pkg</code></em></code> to the
                   7649:             version of <em class=
                   7650:             "replaceable"><code>pkg</code></em> in the base system
                   7651:             if it exists (if <code class=
                   7652:             "varname">IS_BUILTIN.<em class=
                   7653:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7654:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  7655:             variable is only used internally within the
                   7656:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    7657: 
1.14      xtraeme  7658:             <p>The third section sets <code class=
                   7659:             "varname">USE_BUILTIN.<em class=
                   7660:             "replaceable"><code>pkg</code></em></code> and is
                   7661:             <span class="emphasis"><em>required</em></span> in all
                   7662:             <code class="filename">builtin.mk</code> files. The
                   7663:             code in this section must make the determination
                   7664:             whether the built-in software is adequate to satisfy
                   7665:             the dependencies listed in <code class=
                   7666:             "varname">BUILDLINK_DEPENDS.<em class=
                   7667:             "replaceable"><code>pkg</code></em></code>. This is
                   7668:             typically done by comparing <code class=
                   7669:             "varname">BUILTIN_PKG.<em class=
                   7670:             "replaceable"><code>pkg</code></em></code> against each
                   7671:             of the dependencies in <code class=
                   7672:             "varname">BUILDLINK_DEPENDS.<em class=
                   7673:             "replaceable"><code>pkg</code></em></code>.
                   7674:             <code class="varname">USE_BUILTIN.<em class=
                   7675:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    7676:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  7677:             value by the end of the <code class=
                   7678:             "filename">builtin.mk</code> file. Note that
                   7679:             <code class="varname">USE_BUILTIN.<em class=
                   7680:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    7681:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  7682:             <code class="varname">IS_BUILTIN.<em class=
                   7683:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7684:             &#8220;<span class="quote">no</span>&#8221; because we
                   7685:             may make the determination that the built-in version of
                   7686:             the software is similar enough to be used as a
                   7687:             replacement.</p>
                   7688: 
1.14      xtraeme  7689:             <p>The last section is guarded by <code class=
                   7690:             "varname">CHECK_BUILTIN.<em class=
                   7691:             "replaceable"><code>pkg</code></em></code>, and
                   7692:             includes code that uses the value of <code class=
                   7693:             "varname">USE_BUILTIN.<em class=
                   7694:             "replaceable"><code>pkg</code></em></code> set in the
                   7695:             previous section. This typically includes, e.g., adding
1.1       grant    7696:             additional dependency restrictions and listing
1.14      xtraeme  7697:             additional files to symlink into <code class=
                   7698:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   7699:             "varname">BUILDLINK_FILES.<em class=
                   7700:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    7701:           </div>
                   7702: 
                   7703:           <div class="sect2" lang="en" xml:lang="en">
                   7704:             <div class="titlepage">
                   7705:               <div>
                   7706:                 <div>
1.30    ! wiz      7707:                   <h3 class="title"><a name=
        !          7708:                   "native-or-pkgsrc-preference" id=
        !          7709:                   "native-or-pkgsrc-preference"></a>10.3.2.&nbsp;Global
        !          7710:                   preferences for native or pkgsrc software</h3>
1.1       grant    7711:                 </div>
                   7712:               </div>
                   7713:             </div>
                   7714: 
                   7715:             <p>When building packages, it's possible to choose
                   7716:             whether to set a global preference for using either the
                   7717:             built-in (native) version or the pkgsrc version of
                   7718:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  7719:             setting <code class="varname">PREFER_PKGSRC</code> and
                   7720:             <code class="varname">PREFER_NATIVE</code>. These
                   7721:             variables take values of either &#8220;<span class=
1.1       grant    7722:             "quote">yes</span>&#8221;, &#8220;<span class=
                   7723:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  7724:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   7725:             to use the pkgsrc versions of software, while
                   7726:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   7727:             to use the built-in versions. Preferences are
                   7728:             determined by the most specific instance of the package
                   7729:             in either <code class="varname">PREFER_PKGSRC</code> or
                   7730:             <code class="varname">PREFER_NATIVE</code>. If a
                   7731:             package is specified in neither or in both variables,
                   7732:             then <code class="varname">PREFER_PKGSRC</code> has
                   7733:             precedence over <code class=
                   7734:             "varname">PREFER_NATIVE</code>. For example, to require
                   7735:             using pkgsrc versions of software for all but the most
                   7736:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    7737:             <pre class="programlisting">
                   7738:         PREFER_PKGSRC=  yes
                   7739:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   7740:       
                   7741: </pre>
                   7742: 
                   7743:             <p>A package <span class=
1.14      xtraeme  7744:             "emphasis"><em>must</em></span> have a <code class=
                   7745:             "filename">builtin.mk</code> file to be listed in
                   7746:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   7747:             it is simply ignored in that list.</p>
1.1       grant    7748:           </div>
                   7749:         </div>
                   7750:       </div>
                   7751: 
                   7752:       <div class="chapter" lang="en" xml:lang="en">
                   7753:         <div class="titlepage">
                   7754:           <div>
                   7755:             <div>
                   7756:               <h2 class="title"><a name="options" id=
1.25      rillig   7757:               "options"></a>Chapter&nbsp;11.&nbsp;Options
1.1       grant    7758:               handling</h2>
                   7759:             </div>
                   7760:           </div>
                   7761:         </div>
                   7762: 
                   7763:         <div class="toc">
                   7764:           <p><b>Table of Contents</b></p>
                   7765: 
                   7766:           <dl>
1.30    ! wiz      7767:             <dt><span class="sect1"><a href=
        !          7768:             "#global-default-options">11.1. Global default
        !          7769:             options</a></span></dt>
1.1       grant    7770: 
1.30    ! wiz      7771:             <dt><span class="sect1"><a href=
        !          7772:             "#converting-to-options">11.2. Converting packages to
        !          7773:             use <code class=
1.14      xtraeme  7774:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    7775:           </dl>
                   7776:         </div>
                   7777: 
                   7778:         <p>Many packages have the ability to be built to support
1.14      xtraeme  7779:         different sets of features. <code class=
                   7780:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    7781:         that provides generic handling of those options that
                   7782:         determine different ways in which the packages can be
                   7783:         built. It's possible for the user to specify exactly which
                   7784:         sets of options will be built into a package or to allow a
                   7785:         set of global default options apply.</p>
                   7786: 
                   7787:         <div class="sect1" lang="en" xml:lang="en">
                   7788:           <div class="titlepage">
                   7789:             <div>
                   7790:               <div>
                   7791:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      7792:                 "global-default-options" id=
        !          7793:                 "global-default-options"></a>11.1.&nbsp;Global
1.1       grant    7794:                 default options</h2>
                   7795:               </div>
                   7796:             </div>
                   7797:           </div>
                   7798: 
1.14      xtraeme  7799:           <p>Global default options are listed in <code class=
                   7800:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    7801:           the options that should be built into every package if
                   7802:           that option is supported. This variable should be set in
1.14      xtraeme  7803:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7804:         </div>
                   7805: 
                   7806:         <div class="sect1" lang="en" xml:lang="en">
                   7807:           <div class="titlepage">
                   7808:             <div>
                   7809:               <div>
                   7810:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      7811:                 "converting-to-options" id=
        !          7812:                 "converting-to-options"></a>11.2.&nbsp;Converting
        !          7813:                 packages to use <code class=
1.14      xtraeme  7814:                 "filename">bsd.options.mk</code></h2>
1.1       grant    7815:               </div>
                   7816:             </div>
                   7817:           </div>
                   7818: 
1.14      xtraeme  7819:           <p>The following example shows how <code class=
1.27      rillig   7820:           "filename">bsd.options.mk</code> should be used by the
                   7821:           hypothetical ``wibble'' package, either in the package
                   7822:           <code class="filename">Makefile</code>, or in a file,
                   7823:           e.g. <code class="filename">options.mk</code>, that is
                   7824:           included by the main package <code class=
1.14      xtraeme  7825:           "filename">Makefile</code>.</p>
1.1       grant    7826:           <pre class="programlisting">
                   7827: # Global and legacy options
                   7828: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   7829: PKG_SUPPORTED_OPTIONS=  ldap sasl
1.27      rillig   7830: PKG_SUGGESTED_OPTIONS=  sasl
                   7831: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
                   7832: 
1.1       grant    7833: .include "../../mk/bsd.options.mk"
                   7834: 
                   7835: # Package-specific option-handling
                   7836: 
                   7837: ###
                   7838: ### LDAP support
                   7839: ###
                   7840: .if !empty(PKG_OPTIONS:Mldap)
                   7841: .  include "../../databases/openldap/buildlink3.mk"
                   7842: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   7843: .endif
                   7844: 
                   7845: ###
                   7846: ### SASL authentication
                   7847: ###
                   7848: .if !empty(PKG_OPTIONS:Msasl)
                   7849: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   7850: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   7851: .endif
                   7852:       
                   7853: </pre>
                   7854: 
1.28      rillig   7855:           <p>The first section contains the information about which
                   7856:           build options are supported by the package, and any
1.1       grant    7857:           default options settings if needed.</p>
                   7858: 
                   7859:           <div class="orderedlist">
                   7860:             <ol type="1">
                   7861:               <li>
1.14      xtraeme  7862:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   7863:                 the name of the <a href=
1.1       grant    7864:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7865:                 <span class="citerefentry"><span class=
1.27      rillig   7866:                 "refentrytitle">make</span>(1)</span></a> variable
                   7867:                 that contains the options the user wishes to
                   7868:                 select. The recommended value is
                   7869:                 &#8220;<span class="quote">PKG_OPTIONS.<em class=
1.14      xtraeme  7870:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   7871:                 but any package-specific value may be used. This
1.1       grant    7872:                 variable should be set in a package Makefile.</p>
                   7873:               </li>
                   7874: 
                   7875:               <li>
1.14      xtraeme  7876:                 <p><code class=
                   7877:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   7878:                 build options supported by the package. This
                   7879:                 variable should be set in a package Makefile.</p>
1.1       grant    7880:               </li>
                   7881: 
                   7882:               <li>
1.27      rillig   7883:                 <p><code class=
                   7884:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   7885:                 build options which are enabled by default.</p>
                   7886:               </li>
                   7887: 
                   7888:               <li>
1.14      xtraeme  7889:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27      rillig   7890:                 (the variable named in <code class=
                   7891:                 "varname">PKG_OPTIONS_VAR</code>) lists the
                   7892:                 selected build options and overrides any default
                   7893:                 options given in <code class=
1.14      xtraeme  7894:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    7895:                 options begin with a &#8220;<span class=
                   7896:                 "quote">-</span>&#8221;, then that option is always
                   7897:                 removed from the selected build options, e.g.</p>
                   7898:                 <pre class="programlisting">
                   7899:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   7900:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7901:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
1.28      rillig   7902:         # leads to PKG_OPTIONS = kerberos ldap
1.1       grant    7903:           
                   7904: </pre>
                   7905: 
                   7906:                 <p>or</p>
                   7907:                 <pre class="programlisting">
                   7908:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7909:         WIBBLE_OPTIONS=         kerberos -ldap ldap
1.28      rillig   7910:         # leads to PKG_OPTIONS = kerberos
1.1       grant    7911:           
                   7912: </pre>
                   7913: 
1.14      xtraeme  7914:                 <p>This variable should be set in <code class=
                   7915:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    7916:               </li>
                   7917: 
                   7918:               <li>
1.28      rillig   7919:                 <p>The <code class=
                   7920:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
                   7921:                 needed if you are converting a package that had its
                   7922:                 own ad-hoc options handling to use <code class=
                   7923:                 "filename">bsd.options.mk</code>. It converts
                   7924:                 global or legacy options variables into an
                   7925:                 equivalent <code class=
                   7926:                 "varname">PKG_OPTIONS.<em class=
                   7927:                 "replaceable"><code>pkg</code></em></code>
                   7928:                 value.</p>
1.1       grant    7929:               </li>
1.28      rillig   7930:             </ol>
1.1       grant    7931:           </div>
                   7932: 
1.28      rillig   7933:           <p>After the inclusion of bsd.options.mk, the variable
                   7934:           <code class="varname">PKG_OPTIONS</code> contains the
                   7935:           list of the selected build options, properly filtered to
                   7936:           remove unsupported and duplicate options.</p>
                   7937: 
1.1       grant    7938:           <p>The remaining sections contain the logic that is
                   7939:           specific to each option. There should be a check for
1.14      xtraeme  7940:           every option listed in <code class=
                   7941:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   7942:           be clear documentation on what turning on the option will
                   7943:           do in the comments preceding each section. The correct
                   7944:           way to check for an option is to check whether it is
                   7945:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7946:         </div>
                   7947:       </div>
                   7948: 
                   7949:       <div class="chapter" lang="en" xml:lang="en">
                   7950:         <div class="titlepage">
                   7951:           <div>
                   7952:             <div>
                   7953:               <h2 class="title"><a name="build" id=
1.25      rillig   7954:               "build"></a>Chapter&nbsp;12.&nbsp;The build
1.1       grant    7955:               process</h2>
                   7956:             </div>
                   7957:           </div>
                   7958:         </div>
                   7959: 
                   7960:         <div class="toc">
                   7961:           <p><b>Table of Contents</b></p>
                   7962: 
                   7963:           <dl>
1.25      rillig   7964:             <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1       grant    7965:             Program location</a></span></dt>
                   7966: 
1.30    ! wiz      7967:             <dt><span class="sect1"><a href="#main-targets">12.2.
        !          7968:             Main targets</a></span></dt>
1.1       grant    7969: 
                   7970:             <dt><span class="sect1"><a href=
1.25      rillig   7971:             "#build.helpful-targets">12.3. Other helpful
1.1       grant    7972:             targets</a></span></dt>
                   7973:           </dl>
                   7974:         </div>
                   7975: 
                   7976:         <p>The basic steps for building a program are always the
                   7977:         same. First the program's source (<span class=
                   7978:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7979:         local system and then extracted. After any patches to
                   7980:         compile properly on NetBSD are applied, the software can be
                   7981:         configured, then built (usually by compiling), and finally
                   7982:         the generated binaries, etc. can be put into place on the
                   7983:         system. These are exactly the steps performed by the NetBSD
                   7984:         package system, which is implemented as a series of targets
1.14      xtraeme  7985:         in a central Makefile, <code class=
                   7986:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7987: 
                   7988:         <div class="sect1" lang="en" xml:lang="en">
                   7989:           <div class="titlepage">
                   7990:             <div>
                   7991:               <div>
                   7992:                 <h2 class="title" style="clear: both"><a name=
                   7993:                 "build.prefix" id=
1.25      rillig   7994:                 "build.prefix"></a>12.1.&nbsp;Program location</h2>
1.1       grant    7995:               </div>
                   7996:             </div>
                   7997:           </div>
                   7998: 
                   7999:           <p>Before outlining the process performed by the NetBSD
                   8000:           package system in the next section, here's a brief
                   8001:           discussion on where programs are installed, and which
                   8002:           variables influence this.</p>
                   8003: 
1.14      xtraeme  8004:           <p>The automatic variable <code class=
                   8005:           "varname">PREFIX</code> indicates where all files of the
                   8006:           final program shall be installed. It is usually set to
                   8007:           <code class="varname">LOCALBASE</code> (<code class=
                   8008:           "filename">/usr/pkg</code>), or <code class=
                   8009:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    8010:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  8011:           The value of <code class="varname">PREFIX</code> needs to
                   8012:           be put into the various places in the program's source
                   8013:           where paths to these files are encoded. See <a href=
1.1       grant    8014:           "#components.patches" title=
1.27      rillig   8015:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8016:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   8017:           title=
1.25      rillig   8018:           "13.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;13.3.1,
1.1       grant    8019:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   8020:           details.</p>
                   8021: 
                   8022:           <p>When choosing which of these variables to use, follow
                   8023:           the following rules:</p>
                   8024: 
                   8025:           <div class="itemizedlist">
                   8026:             <ul type="disc">
                   8027:               <li>
1.14      xtraeme  8028:                 <p><code class="varname">PREFIX</code> always
                   8029:                 points to the location where the current pkg will
                   8030:                 be installed. When referring to a pkg's own
1.1       grant    8031:                 installation path, use &#8220;<span class=
                   8032:                 "quote">${PREFIX}</span>&#8221;.</p>
                   8033:               </li>
                   8034: 
                   8035:               <li>
1.14      xtraeme  8036:                 <p><code class="varname">LOCALBASE</code> is where
                   8037:                 all non-X11 pkgs are installed. If you need to
1.1       grant    8038:                 construct a -I or -L argument to the compiler to
                   8039:                 find includes and libraries installed by another
                   8040:                 non-X11 pkg, use &#8220;<span class=
                   8041:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   8042:               </li>
                   8043: 
                   8044:               <li>
1.14      xtraeme  8045:                 <p><code class="varname">X11BASE</code> is where
                   8046:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    8047:                 installed. When looking for <span class=
                   8048:                 "emphasis"><em>standard</em></span> X11 includes
                   8049:                 (not those installed by a pkg), use
                   8050:                 &#8220;<span class=
                   8051:                 "quote">${X11BASE}</span>&#8221;.</p>
                   8052:               </li>
                   8053: 
                   8054:               <li>
                   8055:                 <p>X11 based are special in that they may be
1.14      xtraeme  8056:                 installed in either <code class=
                   8057:                 "varname">X11BASE</code> or <code class=
                   8058:                 "varname">LOCALBASE</code>.</p>
1.1       grant    8059: 
                   8060:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  8061:                 <code class="varname">LOCALBASE</code> whenever
                   8062:                 possible. Note that you will need to set
                   8063:                 <code class="varname">USE_X11</code> in them to
                   8064:                 request the presence of X11 and to get the right
                   8065:                 compilation flags.</p>
1.1       grant    8066: 
                   8067:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  8068:                 be installed under <code class=
                   8069:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    8070:                 app-defaults files. These packages are special and
1.14      xtraeme  8071:                 they must be placed under <code class=
                   8072:                 "varname">X11BASE</code>. To accomplish this, set
                   8073:                 either <code class="varname">USE_X11BASE</code> or
                   8074:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    8075:                 package.</p>
                   8076: 
1.14      xtraeme  8077:                 <p>Some notes: <code class="varname">USE_X11</code>
                   8078:                 and <code class="varname">USE_X11BASE</code> are
                   8079:                 mutually exclusive. If you need to find includes or
                   8080:                 libraries installed by a pkg that has <code class=
                   8081:                 "varname">USE_IMAKE</code> or <code class=
                   8082:                 "varname">USE_X11BASE</code> in its pkg
                   8083:                 <code class="filename">Makefile</code>, you need to
                   8084:                 use <span class="emphasis"><em>both</em></span>
                   8085:                 <code class="filename">${X11BASE}</code> and
                   8086:                 <code class="filename">${LOCALBASE}</code>. To
                   8087:                 force installation of all X11 packages in
                   8088:                 <code class="varname">LOCALBASE</code>, the
                   8089:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8090:                 href=
1.1       grant    8091:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      8092:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   8093:                 by default.</p>
1.1       grant    8094:               </li>
                   8095: 
                   8096:               <li>
1.14      xtraeme  8097:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    8098:                 used to refer to the installed location of an X11
1.14      xtraeme  8099:                 package. <code class="varname">X11PREFIX</code>
                   8100:                 will be set to <code class="varname">X11BASE</code>
                   8101:                 if xpkgwedge is not installed, and to <code class=
                   8102:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    8103:                 installed.</p>
                   8104:               </li>
                   8105: 
                   8106:               <li>
                   8107:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  8108:                 have some packages installed in <code class=
                   8109:                 "varname">X11BASE</code> and some in <code class=
                   8110:                 "varname">LOCALBASE</code>. To determine the prefix
                   8111:                 of an installed package, the <code class=
                   8112:                 "varname">EVAL_PREFIX</code> definition can be
                   8113:                 used. It takes pairs in the format
                   8114:                 &#8220;<span class=
1.1       grant    8115:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      8116:                 the <a href=
                   8117:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8118:                 <span class="citerefentry"><span class=
                   8119:                 "refentrytitle">make</span>(1)</span></a> variable
                   8120:                 <code class="varname">DIRNAME</code> will be set to
                   8121:                 the prefix of the installed package
                   8122:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    8123:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   8124:                 is not installed.</p>
                   8125: 
                   8126:                 <p>This is best illustrated by example.</p>
                   8127: 
1.14      xtraeme  8128:                 <p>The following lines are taken from <code class=
                   8129:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    8130:                 <pre class="programlisting">
1.14      xtraeme  8131: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    8132: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   8133:                         --with-gtk-prefix="${GTKDIR}"           \
                   8134:                         --enable-multibyte
                   8135: </pre>
                   8136: 
                   8137:                 <p>Specific defaults can be defined for the
1.14      xtraeme  8138:                 packages evaluated using <code class=
                   8139:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    8140:                 of the form:</p>
                   8141:                 <pre class="programlisting">
                   8142: GTKDIR_DEFAULT= ${LOCALBASE}
                   8143: </pre>
                   8144: 
1.14      xtraeme  8145:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    8146:                 corresponds to the first definition in the
1.14      xtraeme  8147:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    8148:               </li>
                   8149: 
                   8150:               <li>
1.14      xtraeme  8151:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      8152:                 packages should install files according to <a href=
                   8153:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   8154:                 <span class="citerefentry"><span class=
                   8155:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   8156:                 exception that manual pages go into <code class=
                   8157:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  8158:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    8159:               </li>
                   8160:             </ul>
                   8161:           </div>
                   8162:         </div>
                   8163: 
                   8164:         <div class="sect1" lang="en" xml:lang="en">
                   8165:           <div class="titlepage">
                   8166:             <div>
                   8167:               <div>
                   8168:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      8169:                 "main-targets" id=
        !          8170:                 "main-targets"></a>12.2.&nbsp;Main targets</h2>
1.1       grant    8171:               </div>
                   8172:             </div>
                   8173:           </div>
                   8174: 
                   8175:           <p>The main targets used during the build process defined
1.14      xtraeme  8176:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    8177: 
                   8178:           <div class="variablelist">
                   8179:             <dl>
                   8180:               <dt><span class="term">fetch</span></dt>
                   8181: 
                   8182:               <dd>
                   8183:                 <p>This will check if the file(s) given in the
1.14      xtraeme  8184:                 variables <code class="varname">DISTFILES</code>
                   8185:                 and <code class="varname">PATCHFILES</code> (as
                   8186:                 defined in the package's Makefile) are present on
                   8187:                 the local system in <code class=
                   8188:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   8189:                 are not present, an attempt will be made to fetch
                   8190:                 them using commands of the form:</p>
1.1       grant    8191:                 <pre class="programlisting">
                   8192: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   8193: </pre>
                   8194: 
                   8195:                 <p>where ${site} varies through several
1.14      xtraeme  8196:                 possibilities in turn: first, <code class=
                   8197:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   8198:                 then the sites specified in either <code class=
                   8199:                 "varname">SITES_file</code> if defined, else
                   8200:                 <code class="varname">MASTER_SITES</code> or
                   8201:                 <code class="varname">PATCH_SITES</code>, as
                   8202:                 applies, then finally the value of <code class=
                   8203:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   8204:                 all except the first can be optionally sorted by
                   8205:                 the user, via setting either <code class=
                   8206:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   8207:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    8208:               </dd>
                   8209: 
                   8210:               <dt><span class="term">checksum</span></dt>
                   8211: 
                   8212:               <dd>
                   8213:                 <p>After the distfile(s) are fetched, their
                   8214:                 checksum is generated and compared with the
                   8215:                 checksums stored in the distinfo file. If the
                   8216:                 checksums don't match, the build is aborted. This
                   8217:                 is to ensure the same distfile is used for
                   8218:                 building, and that the distfile wasn't changed,
                   8219:                 e.g. by some malign force, deliberately changed
                   8220:                 distfiles on the master distribution site or
                   8221:                 network lossage.</p>
                   8222:               </dd>
                   8223: 
                   8224:               <dt><span class="term">extract</span></dt>
                   8225: 
                   8226:               <dd>
                   8227:                 <p>When the distfiles are present on the local
                   8228:                 system, they need to be extracted, as they are
                   8229:                 usually in the form of some compressed archive
1.14      xtraeme  8230:                 format, most commonly <code class=
                   8231:                 "filename">.tar.gz</code>.</p>
1.1       grant    8232: 
                   8233:                 <p>If only some of the distfiles need to be
                   8234:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  8235:                 be put into <code class=
                   8236:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    8237: 
1.14      xtraeme  8238:                 <p>If the distfiles are not in <code class=
                   8239:                 "filename">.tar.gz</code> format, they can be
                   8240:                 extracted by setting either <code class=
                   8241:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   8242:                 "varname">EXTRACT_CMD</code>, <code class=
                   8243:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   8244:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   8245:                 the former case, pkgsrc knows how to extract a
                   8246:                 number of suffixes (<code class=
                   8247:                 "filename">.tar.gz</code>, <code class=
                   8248:                 "filename">.tgz</code>, <code class=
                   8249:                 "filename">.tar.gz2</code>, <code class=
                   8250:                 "filename">.tbz</code>, <code class=
                   8251:                 "filename">.tar.Z</code>, <code class=
                   8252:                 "filename">.tar</code>, <code class=
                   8253:                 "filename">.shar.gz</code>, <code class=
                   8254:                 "filename">.shar.bz2</code>, <code class=
                   8255:                 "filename">.shar.Z</code>, <code class=
                   8256:                 "filename">.shar</code>, <code class=
                   8257:                 "filename">.Z</code>, <code class=
                   8258:                 "filename">.bz2</code> and <code class=
                   8259:                 "filename">.gz</code>; see the definition of the
                   8260:                 various <code class="varname">DECOMPRESS_CMD</code>
                   8261:                 variables <code class="filename">bsd.pkg.mk</code>
                   8262:                 for a complete list). Here's an example on how to
                   8263:                 use the other variables for a program that comes
                   8264:                 with a compressed shell archive whose name ends in
                   8265:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    8266:                 <pre class="programlisting">
                   8267:      EXTRACT_SUFX=   .msg.gz
                   8268:      EXTRACT_CMD=            zcat
                   8269:      EXTRACT_BEFORE_ARGS=
                   8270:      EXTRACT_AFTER_ARGS=     |sh
                   8271: </pre>
                   8272:               </dd>
                   8273: 
                   8274:               <dt><span class="term">patch</span></dt>
                   8275: 
                   8276:               <dd>
                   8277:                 <p>After extraction, all the patches named by the
1.14      xtraeme  8278:                 <code class="varname">PATCHFILES</code>, those
                   8279:                 present in the patches subdirectory of the package
                   8280:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   8281:                 <code class=
                   8282:                 "filename">/usr/local/patches/graphics/png</code>)
                   8283:                 are applied. Patchfiles ending in <code class=
                   8284:                 "filename">.Z</code> or <code class=
                   8285:                 "filename">.gz</code> are uncompressed before they
                   8286:                 are applied, files ending in <code class=
                   8287:                 "filename">.orig</code> or <code class=
                   8288:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      8289:                 options to <a href=
                   8290:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8291:                 <span class="citerefentry"><span class=
                   8292:                 "refentrytitle">patch</span>(1)</span></a> can be
                   8293:                 handed in <code class=
1.14      xtraeme  8294:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   8295:                 "#components.patches" title=
1.27      rillig   8296:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8297:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   8298: 
1.24      wiz      8299:                 <p>By default <a href=
                   8300:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8301:                 <span class="citerefentry"><span class=
                   8302:                 "refentrytitle">patch</span>(1)</span></a> is given
                   8303:                 special args to make it fail if the patches apply
                   8304:                 with some lines of fuzz. Please fix (regen) the
                   8305:                 patches so that they apply cleanly. The rationale
                   8306:                 behind this is that patches that don't apply
                   8307:                 cleanly may end up being applied in the wrong
                   8308:                 place, and cause severe harm there.</p>
1.1       grant    8309:               </dd>
                   8310: 
                   8311:               <dt><span class="term">configure</span></dt>
                   8312: 
                   8313:               <dd>
                   8314:                 <p>Most pieces of software need information on the
                   8315:                 header files, system calls, and library routines
                   8316:                 which are available in NetBSD. This is the process
                   8317:                 known as configuration, and is usually automated.
                   8318:                 In most cases, a script is supplied with the
                   8319:                 source, and its invocation results in generation of
                   8320:                 header files, Makefiles, etc.</p>
                   8321: 
                   8322:                 <p>If the program's distfile contains its own
                   8323:                 configure script, this can be invoked by setting
1.14      xtraeme  8324:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    8325:                 configure script is a GNU autoconf script,
1.14      xtraeme  8326:                 <code class="varname">GNU_CONFIGURE</code> should
                   8327:                 be specified instead. In either case, any arguments
                   8328:                 to the configure script can be specified in the
                   8329:                 <code class="varname">CONFIGURE_ARGS</code>
                   8330:                 variable, and the configure script's name can be
                   8331:                 set in <code class=
                   8332:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   8333:                 from the default &#8220;<span class=
1.1       grant    8334:                 "quote">configure</span>&#8221;. Here's an example
                   8335:                 from the <a xmlns=
                   8336:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8337:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      8338:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    8339:                 <pre class="programlisting">
                   8340: HAS_CONFIGURE=          yes
                   8341: CONFIGURE_SCRIPT=       Configure
                   8342: CONFIGURE_ARGS+=        netbsd13
                   8343: </pre>
                   8344: 
                   8345:                 <p>If the program uses an Imakefile for
                   8346:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  8347:                 by setting <code class="varname">USE_IMAKE</code>
                   8348:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   8349:                 (If you only want the package installed in
                   8350:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   8351:                 not being run, set <code class=
                   8352:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    8353:               </dd>
                   8354: 
                   8355:               <dt><span class="term">build</span></dt>
                   8356: 
                   8357:               <dd>
                   8358:                 <p>Once configuration has taken place, the software
1.14      xtraeme  8359:                 will be built by invoking <code class=
                   8360:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   8361:                 "varname">$MAKEFILE</code> with <code class=
                   8362:                 "varname">$BUILD_TARGET</code> as the target to
                   8363:                 build. The default <code class=
                   8364:                 "varname">MAKE_PROGRAM</code> is
                   8365:                 &#8220;<span class="quote">gmake</span>&#8221; if
1.29      rillig   8366:                 <code class="varname">USE_TOOLS</code> contains
                   8367:                 &#8220;<span class="quote">gmake</span>&#8221;,
1.1       grant    8368:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  8369:                 otherwise. <code class="varname">MAKEFILE</code> is
                   8370:                 set to &#8220;<span class=
1.1       grant    8371:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  8372:                 <code class="varname">BUILD_TARGET</code> defaults
                   8373:                 to &#8220;<span class="quote">all</span>&#8221;.
                   8374:                 Any of these variables can be set in the package's
1.1       grant    8375:                 Makefile to change the default build process.</p>
                   8376:               </dd>
                   8377: 
                   8378:               <dt><span class="term">install</span></dt>
                   8379: 
                   8380:               <dd>
                   8381:                 <p>Once the build stage has completed, the final
                   8382:                 step is to install the software in public
                   8383:                 directories, so users can access the programs and
1.14      xtraeme  8384:                 files. As in the build-target, <code class=
                   8385:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   8386:                 <code class="varname">$MAKEFILE</code> here, but
                   8387:                 with the <code class=
                   8388:                 "varname">$INSTALL_TARGET</code> instead, the
                   8389:                 latter defaulting to &#8220;<span class=
                   8390:                 "quote">install</span>&#8221; (plus
                   8391:                 &#8220;<span class=
                   8392:                 "quote">install.man</span>&#8221;, if <code class=
                   8393:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    8394:               </dd>
                   8395:             </dl>
                   8396:           </div>
                   8397: 
                   8398:           <p>If no target is specified, the default is
                   8399:           &#8220;<span class="quote">build</span>&#8221;. If a
                   8400:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  8401:           e.g. <span><strong class="command">make
                   8402:           build</strong></span> will also perform the equivalent
                   8403:           of:</p>
1.1       grant    8404:           <pre class="programlisting">
                   8405: make fetch
                   8406: make checksum
                   8407: make extract
                   8408: make patch
                   8409: make configure
                   8410: make build
                   8411: </pre>
                   8412:         </div>
                   8413: 
                   8414:         <div class="sect1" lang="en" xml:lang="en">
                   8415:           <div class="titlepage">
                   8416:             <div>
                   8417:               <div>
                   8418:                 <h2 class="title" style="clear: both"><a name=
                   8419:                 "build.helpful-targets" id=
1.25      rillig   8420:                 "build.helpful-targets"></a>12.3.&nbsp;Other
1.1       grant    8421:                 helpful targets</h2>
                   8422:               </div>
                   8423:             </div>
                   8424:           </div>
                   8425: 
                   8426:           <div class="variablelist">
                   8427:             <dl>
                   8428:               <dt><span class="term">pre/post-*</span></dt>
                   8429: 
                   8430:               <dd>
                   8431:                 <p>For any of the main targets described in the
                   8432:                 previous section, two auxiliary targets exist with
                   8433:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   8434:                 &#8220;<span class="quote">post-</span>&#8221; used
                   8435:                 as a prefix for the main target's name. These
                   8436:                 targets are invoked before and after the main
                   8437:                 target is called, allowing extra configuration or
                   8438:                 installation steps be performed from a package's
                   8439:                 Makefile, for example, which a program's configure
                   8440:                 script or install target omitted.</p>
                   8441:               </dd>
                   8442: 
                   8443:               <dt><span class="term">do-*</span></dt>
                   8444: 
                   8445:               <dd>
                   8446:                 <p>Should one of the main targets do the wrong
                   8447:                 thing, and should there be no variable to fix this,
                   8448:                 you can redefine it with the do-* target. (Note
                   8449:                 that redefining the target itself instead of the
                   8450:                 do-* target is a bad idea, as the pre-* and post-*
                   8451:                 targets won't be called anymore, etc.) You will not
                   8452:                 usually need to do this.</p>
                   8453:               </dd>
                   8454: 
                   8455:               <dt><span class="term">reinstall</span></dt>
                   8456: 
                   8457:               <dd>
1.14      xtraeme  8458:                 <p>If you did a <span><strong class="command">make
                   8459:                 install</strong></span> and you noticed some file
                   8460:                 was not installed properly, you can repeat the
1.1       grant    8461:                 installation with this target, which will ignore
                   8462:                 the &#8220;<span class="quote">already
                   8463:                 installed</span>&#8221; flag.</p>
                   8464:               </dd>
                   8465: 
                   8466:               <dt><span class="term">deinstall</span></dt>
                   8467: 
                   8468:               <dd>
1.24      wiz      8469:                 <p>This target does a <a href=
                   8470:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8471:                 <span class="citerefentry"><span class=
                   8472:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   8473:                 the current directory, effectively de-installing
                   8474:                 the package. The following variables can be used to
                   8475:                 tune the behaviour:</p>
1.1       grant    8476: 
                   8477:                 <div class="variablelist">
                   8478:                   <dl>
1.14      xtraeme  8479:                     <dt><span class="term"><code class=
                   8480:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    8481: 
                   8482:                     <dd>
                   8483:                       <p>Add a "-v" to the <a href=
                   8484:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8485:                       <span class="citerefentry"><span class=
                   8486:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8487:                       command.</p>
                   8488:                     </dd>
                   8489: 
1.14      xtraeme  8490:                     <dt><span class="term"><code class=
                   8491:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    8492: 
                   8493:                     <dd>
                   8494:                       <p>Remove all packages that require (depend
                   8495:                       on) the given package. This can be used to
                   8496:                       remove any packages that may have been pulled
                   8497:                       in by a given package, e.g. if
1.14      xtraeme  8498:                       <span><strong class="command">make deinstall
                   8499:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   8500:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    8501:                       this is likely to remove whole KDE. Works by
                   8502:                       adding &#8220;<span class=
                   8503:                       "quote">-R</span>&#8221; to the <a href=
                   8504:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8505:                       <span class="citerefentry"><span class=
                   8506:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8507:                       command line.</p>
                   8508:                     </dd>
                   8509:                   </dl>
                   8510:                 </div>
                   8511:               </dd>
                   8512: 
                   8513:               <dt><span class="term">update</span></dt>
                   8514: 
                   8515:               <dd>
                   8516:                 <p>This target causes the current package to be
                   8517:                 updated to the latest version. The package and all
                   8518:                 depending packages first get de-installed, then
                   8519:                 current versions of the corresponding packages get
                   8520:                 compiled and installed. This is similar to manually
                   8521:                 noting which packages are currently installed, then
1.14      xtraeme  8522:                 performing a series of <span><strong class=
                   8523:                 "command">make deinstall</strong></span> and
                   8524:                 <span><strong class="command">make
                   8525:                 install</strong></span> (or whatever <code class=
                   8526:                 "varname">UPDATE_TARGET</code> is set to) for these
                   8527:                 packages.</p>
1.1       grant    8528: 
                   8529:                 <p>You can use the &#8220;<span class=
                   8530:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  8531:                 package updating in case a previous
                   8532:                 <span><strong class="command">make
                   8533:                 update</strong></span> was interrupted for some
                   8534:                 reason. However, in this case, make sure you don't
                   8535:                 call <span><strong class="command">make
                   8536:                 clean</strong></span> or otherwise remove the list
                   8537:                 of dependent packages in <code class=
                   8538:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    8539:                 ability to automatically update the current package
                   8540:                 along with the dependent packages you have
                   8541:                 installed.</p>
                   8542: 
1.14      xtraeme  8543:                 <p>Resuming an interrupted <span><strong class=
                   8544:                 "command">make update</strong></span> will only
                   8545:                 work as long as the package tree remains unchanged.
                   8546:                 If the source code for one of the packages to be
                   8547:                 updated has been changed, resuming
                   8548:                 <span><strong class="command">make
                   8549:                 update</strong></span> will most certainly
                   8550:                 fail!</p>
1.1       grant    8551: 
                   8552:                 <p>The following variables can be used either on
1.14      xtraeme  8553:                 the command line or in <code class=
                   8554:                 "filename">/etc/mk.conf</code> to alter the
                   8555:                 behaviour of <span><strong class="command">make
                   8556:                 update</strong></span>:</p>
1.1       grant    8557: 
                   8558:                 <div class="variablelist">
                   8559:                   <dl>
1.14      xtraeme  8560:                     <dt><span class="term"><code class=
                   8561:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    8562: 
                   8563:                     <dd>
                   8564:                       <p>Install target to recursively use for the
                   8565:                       updated package and the dependent packages.
1.14      xtraeme  8566:                       Defaults to <code class=
                   8567:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    8568:                       &#8220;<span class=
                   8569:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  8570:                       <span><strong class="command">make
                   8571:                       update</strong></span>. e.g.
                   8572:                       <span><strong class="command">make update
                   8573:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    8574:                     </dd>
                   8575: 
1.14      xtraeme  8576:                     <dt><span class="term"><code class=
                   8577:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    8578: 
                   8579:                     <dd>
                   8580:                       <p>Don't clean up after updating. Useful if
                   8581:                       you want to leave the work sources of the
                   8582:                       updated packages around for inspection or
                   8583:                       other purposes. Be sure you eventually clean
                   8584:                       up the source tree (see the
                   8585:                       &#8220;<span class=
                   8586:                       "quote">clean-update</span>&#8221; target
                   8587:                       below) or you may run into troubles with old
                   8588:                       source code still lying around on your next
1.14      xtraeme  8589:                       <span><strong class=
                   8590:                       "command">make</strong></span> or
                   8591:                       <span><strong class="command">make
                   8592:                       update</strong></span>.</p>
1.1       grant    8593:                     </dd>
                   8594: 
1.14      xtraeme  8595:                     <dt><span class="term"><code class=
                   8596:                     "varname">REINSTALL</code></span></dt>
1.1       grant    8597: 
                   8598:                     <dd>
                   8599:                       <p>Deinstall each package before installing
1.14      xtraeme  8600:                       (making <code class=
                   8601:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    8602:                       necessary if the &#8220;<span class=
                   8603:                       "quote">clean-update</span>&#8221; target
                   8604:                       (see below) was called after interrupting a
1.14      xtraeme  8605:                       running <span><strong class="command">make
                   8606:                       update</strong></span>.</p>
1.1       grant    8607:                     </dd>
                   8608: 
1.14      xtraeme  8609:                     <dt><span class="term"><code class=
                   8610:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    8611: 
                   8612:                     <dd>
                   8613:                       <p>Allows you to disable recursion and
                   8614:                       hardcode the target for packages. The default
                   8615:                       is &#8220;<span class=
                   8616:                       "quote">update</span>&#8221; for the update
                   8617:                       target, facilitating a recursive update of
1.14      xtraeme  8618:                       prerequisite packages. Only set <code class=
                   8619:                       "varname">DEPENDS_TARGET</code> if you want
                   8620:                       to disable recursive updates. Use
                   8621:                       <code class="varname">UPDATE_TARGET</code>
                   8622:                       instead to just set a specific target for
                   8623:                       each package to be installed during
                   8624:                       <span><strong class="command">make
                   8625:                       update</strong></span> (see above).</p>
1.1       grant    8626:                     </dd>
                   8627:                   </dl>
                   8628:                 </div>
                   8629:               </dd>
                   8630: 
                   8631:               <dt><span class="term">clean-update</span></dt>
                   8632: 
                   8633:               <dd>
                   8634:                 <p>Clean the source tree for all packages that
1.14      xtraeme  8635:                 would get updated if <span><strong class=
                   8636:                 "command">make update</strong></span> was called
                   8637:                 from the current directory. This target should not
                   8638:                 be used if the current package (or any of its
                   8639:                 depending packages) have already been de-installed
                   8640:                 (e.g., after calling <span><strong class=
                   8641:                 "command">make update</strong></span>) or you may
                   8642:                 lose some packages you intended to update. As a
                   8643:                 rule of thumb: only use this target <span class=
                   8644:                 "emphasis"><em>before</em></span> the first time
                   8645:                 you run <span><strong class="command">make
                   8646:                 update</strong></span> and only if you have a dirty
                   8647:                 package tree (e.g., if you used <code class=
                   8648:                 "varname">NOCLEAN</code>).</p>
1.1       grant    8649: 
                   8650:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  8651:                 you can either perform a <span><strong class=
                   8652:                 "command">make clean</strong></span> at the top of
                   8653:                 the tree, or use the following sequence of commands
1.1       grant    8654:                 from the directory of the package you want to
                   8655:                 update (<span class=
                   8656:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  8657:                 <span><strong class="command">make
                   8658:                 update</strong></span> for the first time,
                   8659:                 otherwise you lose all the packages you wanted to
                   8660:                 update!):</p>
1.1       grant    8661:                 <pre class="screen">
1.14      xtraeme  8662: <code class="prompt">#</code> <strong class=
                   8663: "userinput"><code>make clean-update</code></strong>
                   8664: <code class="prompt">#</code> <strong class=
                   8665: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   8666: <code class="prompt">#</code> <strong class=
                   8667: "userinput"><code>make update</code></strong>
1.1       grant    8668: </pre>
                   8669: 
                   8670:                 <p>The following variables can be used either on
1.14      xtraeme  8671:                 the command line or in <code class=
                   8672:                 "filename">/etc/mk.conf</code> to alter the
                   8673:                 behaviour of <span><strong class="command">make
                   8674:                 clean-update</strong></span>:</p>
1.1       grant    8675: 
                   8676:                 <div class="variablelist">
                   8677:                   <dl>
1.14      xtraeme  8678:                     <dt><span class="term"><code class=
                   8679:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    8680: 
                   8681:                     <dd>
1.14      xtraeme  8682:                       <p>After <span><strong class="command">make
                   8683:                       clean</strong></span>, do not reconstruct the
                   8684:                       list of directories to update for this
                   8685:                       package. Only use this if
                   8686:                       <span><strong class="command">make
                   8687:                       update</strong></span> successfully installed
                   8688:                       all packages you wanted to update. Normally,
                   8689:                       this is done automatically on
                   8690:                       <span><strong class="command">make
                   8691:                       update</strong></span>, but may have been
                   8692:                       suppressed by the <code class=
                   8693:                       "varname">NOCLEAN</code> variable (see
1.1       grant    8694:                       above).</p>
                   8695:                     </dd>
                   8696:                   </dl>
                   8697:                 </div>
                   8698:               </dd>
                   8699: 
                   8700:               <dt><span class="term">info</span></dt>
                   8701: 
                   8702:               <dd>
                   8703:                 <p>This target invokes <a href=
                   8704:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8705:                 <span class="citerefentry"><span class=
                   8706:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   8707:                 the current package. You can use this to check
                   8708:                 which version of a package is installed.</p>
                   8709:               </dd>
                   8710: 
                   8711:               <dt><span class="term">readme</span></dt>
                   8712: 
                   8713:               <dd>
1.14      xtraeme  8714:                 <p>This target generates a <code class=
                   8715:                 "filename">README.html</code> file, which can be
1.1       grant    8716:                 viewed using a browser such as <a xmlns=
                   8717:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8718:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      8719:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   8720:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8721:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   8722:                 class="pkgname">www/links</a>. The generated files
                   8723:                 contain references to any packages which are in the
                   8724:                 <code class="varname">PACKAGES</code> directory on
                   8725:                 the local host. The generated files can be made to
                   8726:                 refer to URLs based on <code class=
                   8727:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   8728:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   8729:                 wanted to generate <code class=
                   8730:                 "filename">README.html</code> files which pointed
                   8731:                 to binary packages on the local machine, in the
                   8732:                 directory <code class=
                   8733:                 "filename">/usr/packages</code>, set <code class=
                   8734:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   8735:                 and <code class=
                   8736:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   8737:                 <code class="varname">${PACKAGES}</code> directory
                   8738:                 and its subdirectories will be searched for all the
                   8739:                 binary packages.</p>
1.1       grant    8740:               </dd>
                   8741: 
                   8742:               <dt><span class="term">readme-all</span></dt>
                   8743: 
                   8744:               <dd>
1.14      xtraeme  8745:                 <p>Use this target to create a file <code class=
                   8746:                 "filename">README-all.html</code> which contains a
1.1       grant    8747:                 list of all packages currently available in the
                   8748:                 NetBSD Packages Collection, together with the
                   8749:                 category they belong to and a short description.
1.14      xtraeme  8750:                 This file is compiled from the <code class=
                   8751:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    8752:                 sure to run this <span class=
1.14      xtraeme  8753:                 "emphasis"><em>after</em></span> a
                   8754:                 <span><strong class="command">make
                   8755:                 readme</strong></span>.</p>
1.1       grant    8756:               </dd>
                   8757: 
                   8758:               <dt><span class="term">cdrom-readme</span></dt>
                   8759: 
                   8760:               <dd>
                   8761:                 <p>This is very much the same as the
                   8762:                 &#8220;<span class="quote">readme</span>&#8221;
                   8763:                 target (see above), but is to be used when
                   8764:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  8765:                 This target also produces <code class=
                   8766:                 "filename">README.html</code> files, and can be
                   8767:                 made to refer to URLs based on <code class=
                   8768:                 "varname">CDROM_PKG_URL_HOST</code> and
                   8769:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    8770:               </dd>
                   8771: 
                   8772:               <dt><span class="term">show-distfiles</span></dt>
                   8773: 
                   8774:               <dd>
                   8775:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  8776:                 are needed to build the package. (<code class=
                   8777:                 "varname">DISTFILES</code> and <code class=
                   8778:                 "varname">PATCHFILES</code>, but not <code class=
                   8779:                 "filename">patches/*</code>)</p>
1.1       grant    8780:               </dd>
                   8781: 
                   8782:               <dt><span class="term">show-downlevel</span></dt>
                   8783: 
                   8784:               <dd>
                   8785:                 <p>This target shows nothing if the package is not
                   8786:                 installed. If a version of this package is
                   8787:                 installed, but is not the version provided in this
                   8788:                 version of pkgsrc, then a warning message is
                   8789:                 displayed. This target can be used to show which of
                   8790:                 your installed packages are downlevel, and so the
                   8791:                 old versions can be deleted, and the current ones
                   8792:                 added.</p>
                   8793:               </dd>
                   8794: 
                   8795:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   8796: 
                   8797:               <dd>
                   8798:                 <p>This target shows the directory in the pkgsrc
                   8799:                 hierarchy from which the package can be built and
                   8800:                 installed. This may not be the same directory as
                   8801:                 the one from which the package was installed. This
                   8802:                 target is intended to be used by people who may
                   8803:                 wish to upgrade many packages on a single host, and
                   8804:                 can be invoked from the top-level pkgsrc Makefile
                   8805:                 by using the &#8220;<span class=
                   8806:                 "quote">show-host-specific-pkgs</span>&#8221;
                   8807:                 target.</p>
                   8808:               </dd>
                   8809: 
                   8810:               <dt><span class=
                   8811:               "term">show-installed-depends</span></dt>
                   8812: 
                   8813:               <dd>
                   8814:                 <p>This target shows which installed packages match
1.14      xtraeme  8815:                 the current package's <code class=
                   8816:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    8817:                 dependencies are causing build problems.</p>
                   8818:               </dd>
                   8819: 
                   8820:               <dt><span class="term">check-shlibs</span></dt>
                   8821: 
                   8822:               <dd>
                   8823:                 <p>After a package is installed, check all its
                   8824:                 binaries and (on ELF platforms) shared libraries to
                   8825:                 see if they find the shared libs they need. Run by
1.14      xtraeme  8826:                 default if <code class=
                   8827:                 "varname">PKG_DEVELOPER</code> is set in
                   8828:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    8829:               </dd>
                   8830: 
                   8831:               <dt><span class="term">print-PLIST</span></dt>
                   8832: 
                   8833:               <dd>
                   8834:                 <p>After a &#8220;<span class="quote">make
                   8835:                 install</span>&#8221; from a new or upgraded pkg,
                   8836:                 this prints out an attempt to generate a new
1.14      xtraeme  8837:                 <code class="filename">PLIST</code> from a
                   8838:                 <span><strong class="command">find -newer
                   8839:                 work/.extract_done</strong></span>. An attempt is
                   8840:                 made to care for shared libs etc., but it is
1.1       grant    8841:                 <span class="emphasis"><em>strongly</em></span>
                   8842:                 recommended to review the result before putting it
1.14      xtraeme  8843:                 into <code class="filename">PLIST</code>. On
                   8844:                 upgrades, it's useful to diff the output of this
                   8845:                 command against an already existing <code class=
                   8846:                 "filename">PLIST</code> file.</p>
1.1       grant    8847: 
1.24      wiz      8848:                 <p>If the package installs files via <a href=
                   8849:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   8850:                 <span class="citerefentry"><span class=
                   8851:                 "refentrytitle">tar</span>(1)</span></a> or other
                   8852:                 methods that don't update file access times, be
                   8853:                 sure to add these files manually to your
1.14      xtraeme  8854:                 <code class="filename">PLIST</code>, as the
1.1       grant    8855:                 &#8220;<span class="quote">find
                   8856:                 -newer</span>&#8221; command used by this target
                   8857:                 won't catch them!</p>
                   8858: 
                   8859:                 <p>See <a href="#print-PLIST" title=
1.25      rillig   8860:                 "9.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;9.3,
1.14      xtraeme  8861:                 &#8220;Tweaking output of <span><strong class=
                   8862:                 "command">make
                   8863:                 print-PLIST</strong></span>&#8221;</a> for more
                   8864:                 information on this target.</p>
1.1       grant    8865:               </dd>
                   8866: 
                   8867:               <dt><span class="term">bulk-package</span></dt>
                   8868: 
                   8869:               <dd>
                   8870:                 <p>Used to do bulk builds. If an appropriate binary
                   8871:                 package already exists, no action is taken. If not,
                   8872:                 this target will compile, install and package it
1.14      xtraeme  8873:                 (and it's depends, if <code class=
                   8874:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    8875:                 <a href="#binary.configuration" title=
                   8876:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   8877:                 &#8220;Configuration&#8221;</a>. After creating the
                   8878:                 binary package, the sources, the just-installed
                   8879:                 package and it's required packages are removed,
                   8880:                 preserving free disk space.</p>
                   8881: 
                   8882:                 <p><span class="emphasis"><em>Beware that this
                   8883:                 target may deinstall all packages installed on a
                   8884:                 system!</em></span></p>
                   8885:               </dd>
                   8886: 
                   8887:               <dt><span class="term">bulk-install</span></dt>
                   8888: 
                   8889:               <dd>
                   8890:                 <p>Used during bulk-installs to install required
                   8891:                 packages. If an upto-date binary package is
                   8892:                 available, it will be installed via <a href=
                   8893:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8894:                 <span class="citerefentry"><span class=
                   8895:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  8896:                 not, <span><strong class="command">make
                   8897:                 bulk-package</strong></span> will be executed, but
                   8898:                 the installed binary not be removed.</p>
1.1       grant    8899: 
                   8900:                 <p>A binary package is considered
                   8901:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   8902:                 to be installed via <a href=
                   8903:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8904:                 <span class="citerefentry"><span class=
                   8905:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   8906:                 if:</p>
                   8907: 
                   8908:                 <div class="itemizedlist">
                   8909:                   <ul type="disc">
                   8910:                     <li>
1.14      xtraeme  8911:                       <p>None of the package's files (<code class=
                   8912:                       "filename">Makefile</code>, ...) were
                   8913:                       modified since it was built.</p>
1.1       grant    8914:                     </li>
                   8915: 
                   8916:                     <li>
                   8917:                       <p>None of the package's required (binary)
                   8918:                       packages were modified since it was
                   8919:                       built.</p>
                   8920:                     </li>
                   8921:                   </ul>
                   8922:                 </div>
                   8923: 
                   8924:                 <p><span class="emphasis"><em>Beware that this
                   8925:                 target may deinstall all packages installed on a
                   8926:                 system!</em></span></p>
                   8927:               </dd>
                   8928:             </dl>
                   8929:           </div>
                   8930:         </div>
                   8931:       </div>
                   8932: 
                   8933:       <div class="chapter" lang="en" xml:lang="en">
                   8934:         <div class="titlepage">
                   8935:           <div>
                   8936:             <div>
                   8937:               <h2 class="title"><a name="fixes" id=
1.25      rillig   8938:               "fixes"></a>Chapter&nbsp;13.&nbsp;Notes on fixes for
1.1       grant    8939:               packages</h2>
                   8940:             </div>
                   8941:           </div>
                   8942:         </div>
                   8943: 
                   8944:         <div class="toc">
                   8945:           <p><b>Table of Contents</b></p>
                   8946: 
                   8947:           <dl>
1.30    ! wiz      8948:             <dt><span class="sect1"><a href=
        !          8949:             "#general-operation">13.1. General
        !          8950:             operation</a></span></dt>
1.1       grant    8951: 
                   8952:             <dd>
                   8953:               <dl>
                   8954:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8955:                 "#pulling-vars-from-etc-mk.conf">13.1.1. How to
        !          8956:                 pull in variables from /etc/mk.conf</a></span></dt>
1.1       grant    8957: 
                   8958:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8959:                 "#restricted-packages">13.1.2. Restricted
1.1       grant    8960:                 packages</a></span></dt>
                   8961: 
                   8962:                 <dt><span class="sect2"><a href=
1.25      rillig   8963:                 "#dependencies">13.1.3. Handling
1.1       grant    8964:                 dependencies</a></span></dt>
                   8965: 
                   8966:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8967:                 "#conflicts">13.1.4. Handling conflicts with other
1.1       grant    8968:                 packages</a></span></dt>
                   8969: 
                   8970:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8971:                 "#not-building-packages">13.1.5. Packages that
        !          8972:                 cannot or should not be built</a></span></dt>
1.1       grant    8973: 
                   8974:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8975:                 "#undeletable-packages">13.1.6. Packages which
        !          8976:                 should not be deleted, once
        !          8977:                 installed</a></span></dt>
1.1       grant    8978: 
                   8979:                 <dt><span class="sect2"><a href=
1.25      rillig   8980:                 "#security-handling">13.1.7. Handling packages with
1.1       grant    8981:                 security problems</a></span></dt>
                   8982: 
                   8983:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8984:                 "#compiler-bugs">13.1.8. How to handle compiler
1.1       grant    8985:                 bugs</a></span></dt>
                   8986: 
                   8987:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8988:                 "#bumping-pkgrevision">13.1.9. How to handle
        !          8989:                 incrementing versions when fixing an existing
1.1       grant    8990:                 package</a></span></dt>
                   8991: 
                   8992:                 <dt><span class="sect2"><a href=
1.30    ! wiz      8993:                 "#portability-of-packages">13.1.10. Portability of
1.1       grant    8994:                 packages</a></span></dt>
                   8995:               </dl>
                   8996:             </dd>
                   8997: 
1.30    ! wiz      8998:             <dt><span class="sect1"><a href=
        !          8999:             "#downloading-issues">13.2. Possible downloading
        !          9000:             issues</a></span></dt>
1.1       grant    9001: 
                   9002:             <dd>
                   9003:               <dl>
                   9004:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9005:                 "#no-plain-download">13.2.1. Packages whose
        !          9006:                 distfiles aren't available for plain
1.1       grant    9007:                 downloading</a></span></dt>
                   9008: 
                   9009:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9010:                 "#modified-distfiles-same-name">13.2.2. How to
        !          9011:                 handle modified distfiles with the 'old'
        !          9012:                 name</a></span></dt>
1.1       grant    9013:               </dl>
                   9014:             </dd>
                   9015: 
1.30    ! wiz      9016:             <dt><span class="sect1"><a href=
        !          9017:             "#configuration-gotchas">13.3. Configuration
        !          9018:             gotchas</a></span></dt>
1.1       grant    9019: 
                   9020:             <dd>
                   9021:               <dl>
                   9022:                 <dt><span class="sect2"><a href=
1.25      rillig   9023:                 "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant    9024:                 libtool</a></span></dt>
                   9025: 
                   9026:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9027:                 "#using-libtool">13.3.2. Using libtool on GNU
        !          9028:                 packages that already support
        !          9029:                 libtool</a></span></dt>
1.1       grant    9030: 
                   9031:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9032:                 "#autoconf-automake">13.3.3. GNU
1.1       grant    9033:                 Autoconf/Automake</a></span></dt>
                   9034:               </dl>
                   9035:             </dd>
                   9036: 
1.30    ! wiz      9037:             <dt><span class="sect1"><a href=
        !          9038:             "#building-considerations">13.4. Building
        !          9039:             considerations</a></span></dt>
1.1       grant    9040: 
                   9041:             <dd>
                   9042:               <dl>
                   9043:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9044:                 "#cpp-defines">13.4.1. CPP defines</a></span></dt>
1.1       grant    9045:               </dl>
                   9046:             </dd>
                   9047: 
1.30    ! wiz      9048:             <dt><span class="sect1"><a href=
        !          9049:             "#package-specific-actions">13.5. Package specific
        !          9050:             actions</a></span></dt>
1.1       grant    9051: 
                   9052:             <dd>
                   9053:               <dl>
                   9054:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9055:                 "#package-configuration-files">13.5.1. Package
        !          9056:                 configuration files</a></span></dt>
1.1       grant    9057: 
                   9058:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9059:                 "#user-interaction">13.5.2. User
1.2       hubertf  9060:                 interaction</a></span></dt>
1.1       grant    9061: 
                   9062:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9063:                 "#handling-licenses">13.5.3. Handling
1.1       grant    9064:                 licenses</a></span></dt>
                   9065: 
                   9066:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9067:                 "#creating-accounts">13.5.4. Creating an account
        !          9068:                 from a package</a></span></dt>
1.1       grant    9069: 
                   9070:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9071:                 "#installing-score-files">13.5.5. Installing score
1.1       grant    9072:                 files</a></span></dt>
                   9073: 
                   9074:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9075:                 "#login-shells">13.5.6. Packages providing login
1.1       grant    9076:                 shells</a></span></dt>
                   9077: 
                   9078:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9079:                 "#perl-scripts">13.5.7. Packages containing perl
1.1       grant    9080:                 scripts</a></span></dt>
                   9081: 
                   9082:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9083:                 "#hardcoded-paths">13.5.8. Packages with hardcoded
        !          9084:                 paths to other interpreters</a></span></dt>
1.1       grant    9085: 
                   9086:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9087:                 "#perl-modules">13.5.9. Packages installing perl
1.1       grant    9088:                 modules</a></span></dt>
                   9089: 
                   9090:                 <dt><span class="sect2"><a href=
1.25      rillig   9091:                 "#faq.info-files">13.5.10. Packages installing info
1.1       grant    9092:                 files</a></span></dt>
                   9093: 
                   9094:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9095:                 "#gconf2-data-files">13.5.11. Packages installing
        !          9096:                 GConf2 data files</a></span></dt>
1.1       grant    9097: 
                   9098:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9099:                 "#scrollkeeper-data-files">13.5.12. Packages
        !          9100:                 installing scrollkeeper data files</a></span></dt>
1.1       grant    9101: 
                   9102:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9103:                 "#x11-fonts">13.5.13. Packages installing X11
1.1       grant    9104:                 fonts</a></span></dt>
                   9105: 
                   9106:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9107:                 "#gtk2-modules">13.5.14. Packages installing GTK2
1.1       grant    9108:                 modules</a></span></dt>
                   9109: 
                   9110:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9111:                 "#sgml-xml-data">13.5.15. Packages installing SGML
        !          9112:                 or XML data</a></span></dt>
1.1       grant    9113: 
                   9114:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9115:                 "#mime-database">13.5.16. Packages installing
1.1       grant    9116:                 extensions to the MIME database</a></span></dt>
                   9117: 
                   9118:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9119:                 "#intltool">13.5.17. Packages using
1.1       grant    9120:                 intltool</a></span></dt>
1.18      xtraeme  9121: 
                   9122:                 <dt><span class="sect2"><a href=
1.30    ! wiz      9123:                 "#startup-scripts">13.5.18. Packages installing
        !          9124:                 startup scripts</a></span></dt>
1.1       grant    9125:               </dl>
                   9126:             </dd>
                   9127: 
1.30    ! wiz      9128:             <dt><span class="sect1"><a href=
        !          9129:             "#feedback-to-author">13.6. Feedback to the
        !          9130:             author</a></span></dt>
1.1       grant    9131:           </dl>
                   9132:         </div>
                   9133: 
                   9134:         <div class="sect1" lang="en" xml:lang="en">
                   9135:           <div class="titlepage">
                   9136:             <div>
                   9137:               <div>
                   9138:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      9139:                 "general-operation" id=
        !          9140:                 "general-operation"></a>13.1.&nbsp;General
1.1       grant    9141:                 operation</h2>
                   9142:               </div>
                   9143:             </div>
                   9144:           </div>
                   9145: 
                   9146:           <div class="sect2" lang="en" xml:lang="en">
                   9147:             <div class="titlepage">
                   9148:               <div>
                   9149:                 <div>
1.30    ! wiz      9150:                   <h3 class="title"><a name=
        !          9151:                   "pulling-vars-from-etc-mk.conf" id=
        !          9152:                   "pulling-vars-from-etc-mk.conf"></a>13.1.1.&nbsp;How
        !          9153:                   to pull in variables from /etc/mk.conf</h3>
1.1       grant    9154:                 </div>
                   9155:               </div>
                   9156:             </div>
                   9157: 
                   9158:             <p>The problem with package-defined variables that can
1.14      xtraeme  9159:             be overridden via <code class="varname">MAKECONF</code>
                   9160:             or <code class="filename">/etc/mk.conf</code> is that
                   9161:             <a href=
1.1       grant    9162:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9163:             <span class="citerefentry"><span class=
                   9164:             "refentrytitle">make</span>(1)</span></a> expands a
                   9165:             variable as it is used, but evaluates preprocessor like
                   9166:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  9167:             So, to use any variable (which may be set in
                   9168:             <code class="filename">/etc/mk.conf</code>) in one of
                   9169:             the .if* statements, the file <code class=
                   9170:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    9171:             that .if* statement.</p>
                   9172: 
                   9173:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  9174:             including <code class="filename">/etc/mk.conf</code>,
                   9175:             should it exist, or <code class=
                   9176:             "varname">MAKECONF</code>, should it exist, include the
                   9177:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   9178:             file in the package Makefile before any
                   9179:             preprocessor-like .if, .ifdef, or .ifndef
                   9180:             statements:</p>
1.1       grant    9181:             <pre class="programlisting">
                   9182: .include "../../mk/bsd.prefs.mk"
                   9183:     
                   9184:     .if defined(USE_MENUS)
                   9185:       ...
                   9186:     .endif
                   9187: </pre>
                   9188: 
1.14      xtraeme  9189:             <p>If you wish to set the <code class=
                   9190:             "varname">CFLAGS</code> variable in <code class=
                   9191:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    9192:             use:</p>
                   9193:             <pre class="programlisting">
                   9194: CFLAGS+=  -your -flags
                   9195: </pre>
                   9196: 
1.14      xtraeme  9197:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   9198:             without the &#8220;<span class="quote">+</span>&#8221;)
                   9199:             may lead to problems with packages that need to add
                   9200:             their own flags. Also, you may want to take a look at
                   9201:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    9202:             href=
                   9203:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      9204:             class="pkgname">devel/cpuflags</a> package if you're
                   9205:             interested in optimization for the current CPU.</p>
1.1       grant    9206:           </div>
                   9207: 
                   9208:           <div class="sect2" lang="en" xml:lang="en">
                   9209:             <div class="titlepage">
                   9210:               <div>
                   9211:                 <div>
1.30    ! wiz      9212:                   <h3 class="title"><a name="restricted-packages"
        !          9213:                   id=
        !          9214:                   "restricted-packages"></a>13.1.2.&nbsp;Restricted
1.1       grant    9215:                   packages</h3>
                   9216:                 </div>
                   9217:               </div>
                   9218:             </div>
                   9219: 
                   9220:             <p>Some licenses restrict how software may be
                   9221:             re-distributed. In order to satisfy these restrictions,
                   9222:             the package system defines five make variables that can
                   9223:             be set to note these restrictions:</p>
                   9224: 
                   9225:             <div class="itemizedlist">
                   9226:               <ul type="disc">
                   9227:                 <li>
1.14      xtraeme  9228:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    9229: 
                   9230:                   <p>This variable should be set whenever a
                   9231:                   restriction exists (regardless of its kind). Set
                   9232:                   this variable to a string containing the reason
                   9233:                   for the restriction.</p>
                   9234:                 </li>
                   9235: 
                   9236:                 <li>
1.14      xtraeme  9237:                   <p><code class=
                   9238:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    9239: 
                   9240:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  9241:                   variable to <code class=
                   9242:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9243:                   package may not be included on a CD-ROM.</p>
                   9244:                 </li>
                   9245: 
                   9246:                 <li>
1.14      xtraeme  9247:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    9248: 
                   9249:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  9250:                   Set this variable to <code class=
                   9251:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9252:                   package may not not be made available on the
                   9253:                   Internet.</p>
                   9254:                 </li>
                   9255: 
                   9256:                 <li>
1.14      xtraeme  9257:                   <p><code class=
                   9258:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    9259: 
                   9260:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  9261:                   this variable to <code class=
                   9262:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9263:                   of the source code or other distfile(s) is not
                   9264:                   allowed on CD-ROMs.</p>
                   9265:                 </li>
                   9266: 
                   9267:                 <li>
1.14      xtraeme  9268:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    9269: 
                   9270:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  9271:                   variable to <code class=
                   9272:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9273:                   of the source code or other distfile(s) via the
                   9274:                   Internet is not allowed.</p>
                   9275:                 </li>
                   9276:               </ul>
                   9277:             </div>
                   9278: 
1.14      xtraeme  9279:             <p>Please note that the use of <code class=
                   9280:             "varname">NO_PACKAGE</code>, <code class=
                   9281:             "varname">IGNORE</code>, <code class=
                   9282:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    9283:             variables to denote restrictions is deprecated, because
                   9284:             they unconditionally prevent users from generating
                   9285:             binary packages!</p>
                   9286:           </div>
                   9287: 
                   9288:           <div class="sect2" lang="en" xml:lang="en">
                   9289:             <div class="titlepage">
                   9290:               <div>
                   9291:                 <div>
                   9292:                   <h3 class="title"><a name="dependencies" id=
1.25      rillig   9293:                   "dependencies"></a>13.1.3.&nbsp;Handling
1.1       grant    9294:                   dependencies</h3>
                   9295:                 </div>
                   9296:               </div>
                   9297:             </div>
                   9298: 
                   9299:             <p>Your package may depend on some other package being
                   9300:             present - and there are various ways of expressing this
1.14      xtraeme  9301:             dependency. pkgsrc supports the <code class=
                   9302:             "varname">BUILD_DEPENDS</code> and <code class=
                   9303:             "varname">DEPENDS</code> definitions, as well as
                   9304:             dependencies via <code class=
                   9305:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    9306:             way to handle dependencies, and which uses the
                   9307:             variables named above. See <a href="#buildlink" title=
1.25      rillig   9308:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9309:             <i>Buildlink methodology</i></a> for more
                   9310:             information.</p>
                   9311: 
                   9312:             <p>The basic difference between the two variables is as
1.14      xtraeme  9313:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    9314:             definition registers that pre-requisite in the binary
                   9315:             package so it will be pulled in when the binary package
1.14      xtraeme  9316:             is later installed, whilst the <code class=
                   9317:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    9318:             marking a dependency that is only needed for building
                   9319:             the package.</p>
                   9320: 
                   9321:             <p>This means that if you only need a package present
                   9322:             whilst you are building, it should be noted as a
1.14      xtraeme  9323:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    9324: 
1.14      xtraeme  9325:             <p>The format for a <code class=
                   9326:             "varname">BUILD_DEPENDS</code> and a <code class=
                   9327:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    9328:             <pre class="programlisting">
                   9329: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   9330: </pre>
                   9331: 
                   9332:             <p>Please note that the &#8220;<span class=
                   9333:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  9334:             any of the wildcard version numbers recognized by
1.1       grant    9335:             <a href=
                   9336:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9337:             <span class="citerefentry"><span class=
                   9338:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   9339: 
                   9340:             <div class="orderedlist">
                   9341:               <ol type="1">
                   9342:                 <li>
                   9343:                   <p>If your package needs another package's
                   9344:                   binaries or libraries to build or run, and if
1.14      xtraeme  9345:                   that package has a <code class=
                   9346:                   "filename">buildlink3.mk</code> file available,
                   9347:                   use it:</p>
1.1       grant    9348:                   <pre class="programlisting">
                   9349:     .include "../../graphics/jpeg/buildlink3.mk"
                   9350:     
                   9351: </pre>
                   9352:                 </li>
                   9353: 
                   9354:                 <li>
                   9355:                   <p>If your package needs to use another package
1.14      xtraeme  9356:                   to build itself and there is no <code class=
                   9357:                   "filename">buildlink3.mk</code> file available,
                   9358:                   use the <code class=
                   9359:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    9360:                   <pre class="programlisting">
                   9361: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   9362: </pre>
                   9363:                 </li>
                   9364: 
                   9365:                 <li>
                   9366:                   <p>If your package needs a library with which to
1.14      xtraeme  9367:                   link and again there is no <code class=
                   9368:                   "filename">buildlink3.mk</code> file available,
                   9369:                   this is specified using the <code class=
                   9370:                   "varname">DEPENDS</code> definition. An example
                   9371:                   of this is the <a xmlns=
1.1       grant    9372:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9373:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9374:                   class="pkgname">print/lyx</a> package, which uses
                   9375:                   the xpm library, version 3.4j to build:</p>
1.1       grant    9376:                   <pre class="programlisting">
                   9377: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   9378: </pre>
                   9379: 
                   9380:                   <p>You can also use wildcards in package
                   9381:                   dependences:</p>
                   9382:                   <pre class="programlisting">
                   9383: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   9384: </pre>
                   9385: 
                   9386:                   <p>Note that such wildcard dependencies are
                   9387:                   retained when creating binary packages. The
                   9388:                   dependency is checked when installing the binary
                   9389:                   package and any package which matches the pattern
                   9390:                   will be used. Wildcard dependencies should be
                   9391:                   used with care.</p>
                   9392: 
                   9393:                   <p>The &#8220;<span class=
                   9394:                   "quote">-[0-9]*</span>&#8221; should be used
                   9395:                   instead of &#8220;<span class=
                   9396:                   "quote">-*</span>&#8221; to avoid potentially
                   9397:                   ambiguous matches such as &#8220;<span class=
                   9398:                   "quote">tk-postgresql</span>&#8221; matching a
                   9399:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  9400:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    9401: 
                   9402:                   <p>Wildcards can also be used to specify that a
                   9403:                   package will only build against a certain minimum
                   9404:                   version of a pre-requisite:</p>
                   9405:                   <pre class="programlisting">
                   9406: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   9407: </pre>
                   9408: 
                   9409:                   <p>This means that the package will build against
                   9410:                   version 3.5.4 of the tiff library or newer. Such
                   9411:                   a dependency may be warranted if, for example,
                   9412:                   the API of the library has changed with version
                   9413:                   3.5.4 and a package would not compile against an
                   9414:                   earlier version of tiff.</p>
                   9415: 
                   9416:                   <p>Please note that such dependencies should only
                   9417:                   be updated if a package requires a newer
                   9418:                   pre-requisite, but not to denote recommendations
                   9419:                   such as security updates or ABI changes that do
                   9420:                   not prevent a package from building correctly.
                   9421:                   Such recommendations can be expressed using
1.14      xtraeme  9422:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    9423:                   <pre class="programlisting">
                   9424: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   9425: </pre>
                   9426: 
1.14      xtraeme  9427:                   <p>In addition to the above <code class=
                   9428:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    9429:                   while a package will build against
                   9430:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  9431:                   recommended. <code class=
                   9432:                   "varname">RECOMMENDED</code> entries will be
                   9433:                   turned into dependencies unless explicitly
                   9434:                   ignored (in which case a warning will be
                   9435:                   printed). Packages that are built with
1.1       grant    9436:                   recommendations ignored may not be uploaded to
                   9437:                   ftp.NetBSD.org by developers and should not be
                   9438:                   used across different systems that may have
                   9439:                   different versions of binary packages
                   9440:                   installed.</p>
                   9441: 
                   9442:                   <p>For security fixes, please update the package
                   9443:                   vulnerabilities file as well as setting
1.14      xtraeme  9444:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    9445:                   <a href="#security-handling" title=
1.25      rillig   9446:                   "13.1.7.&nbsp;Handling packages with security problems">
                   9447:                   Section 13.1.7, &#8220;Handling packages with
1.1       grant    9448:                   security problems&#8221;</a> for more
                   9449:                   information.</p>
                   9450:                 </li>
                   9451: 
                   9452:                 <li>
                   9453:                   <p>If your package needs some executable to be
1.17      sketch   9454:                   able to run correctly and if there's no
1.14      xtraeme  9455:                   <code class="filename">buildlink3.mk</code> file,
                   9456:                   this is specified using the <code class=
                   9457:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    9458:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9459:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9460:                   class="pkgname">print/lyx</a> package needs to be
                   9461:                   able to execute the latex binary from the teTeX
                   9462:                   package when it runs, and that is specified:</p>
1.1       grant    9463:                   <pre class="programlisting">
                   9464: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   9465: </pre>
                   9466: 
                   9467:                   <p>The comment about wildcard dependencies from
                   9468:                   previous paragraph applies here, too.</p>
                   9469:                 </li>
                   9470:               </ol>
                   9471:             </div>
                   9472: 
                   9473:             <p>If your package needs files from another package to
                   9474:             build, see the first part of the &#8220;<span class=
                   9475:             "quote">do-configure</span>&#8221; target <a xmlns=
                   9476:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9477:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      9478:             class="pkgname">print/ghostscript5</a> package (it
                   9479:             relies on the jpeg sources being present in source form
                   9480:             during the build):</p>
1.1       grant    9481:             <pre class="programlisting">
                   9482: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   9483:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   9484:     fi
                   9485: </pre>
                   9486: 
                   9487:             <p>If you build any other packages that way, please
                   9488:             make sure the working files are deleted too when this
                   9489:             package's working files are cleaned up. The easiest way
                   9490:             to do so is by adding a pre-clean target:</p>
                   9491:             <pre class="programlisting">
                   9492: pre-clean:
                   9493:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   9494: </pre>
                   9495: 
1.14      xtraeme  9496:             <p>Please also note the <code class=
                   9497:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   9498:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   9499:             which are provided as convenience definitions. The
1.24      wiz      9500:             former works out whether <a href=
                   9501:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   9502:             <span class="citerefentry"><span class=
                   9503:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   9504:             the base system, and, if it isn't, installs the
                   9505:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9506:             href=
1.1       grant    9507:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      9508:             class="pkgname">devel/gettext</a> package. The latter
                   9509:             adds a build dependency on either an installed version
                   9510:             of an older gettext package, or if it isn't, installs
                   9511:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9512:             href=
                   9513:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   9514:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    9515:           </div>
                   9516: 
                   9517:           <div class="sect2" lang="en" xml:lang="en">
                   9518:             <div class="titlepage">
                   9519:               <div>
                   9520:                 <div>
1.30    ! wiz      9521:                   <h3 class="title"><a name="conflicts" id=
        !          9522:                   "conflicts"></a>13.1.4.&nbsp;Handling conflicts
1.1       grant    9523:                   with other packages</h3>
                   9524:                 </div>
                   9525:               </div>
                   9526:             </div>
                   9527: 
                   9528:             <p>Your package may conflict with other packages a user
                   9529:             might already have installed on his system, e.g. if
                   9530:             your package installs the same set of files like
                   9531:             another package in our pkgsrc tree.</p>
                   9532: 
1.14      xtraeme  9533:             <p>In this case you can set <code class=
                   9534:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    9535:             packages (including version string) your package
                   9536:             conflicts with.</p>
                   9537: 
                   9538:             <p>For example <a xmlns=
                   9539:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9540:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      9541:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   9542:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9543:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   9544:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   9545:             same shared library, thus you set in <code class=
                   9546:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    9547:             <pre class="programlisting">
                   9548: CONFLICTS=      Xaw-Xpm-[0-9]*
                   9549: </pre>
                   9550: 
1.14      xtraeme  9551:             <p>and in <code class=
                   9552:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    9553:             <pre class="programlisting">
                   9554: CONFLICTS=      Xaw3d-[0-9]*
                   9555: </pre>
                   9556: 
                   9557:             <p>Packages will automatically conflict with other
                   9558:             packages with the name prefix and a different version
                   9559:             string. &#8220;<span class=
                   9560:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   9561:             conflict with the older version &#8220;<span class=
                   9562:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   9563:           </div>
                   9564: 
                   9565:           <div class="sect2" lang="en" xml:lang="en">
                   9566:             <div class="titlepage">
                   9567:               <div>
                   9568:                 <div>
1.30    ! wiz      9569:                   <h3 class="title"><a name="not-building-packages"
        !          9570:                   id=
        !          9571:                   "not-building-packages"></a>13.1.5.&nbsp;Packages
        !          9572:                   that cannot or should not be built</h3>
1.1       grant    9573:                 </div>
                   9574:               </div>
                   9575:             </div>
                   9576: 
                   9577:             <p>There are several reasons why a package might be
                   9578:             instructed to not build under certain circumstances. If
                   9579:             the package builds and runs on most platforms, the
1.14      xtraeme  9580:             exceptions should be noted with <code class=
                   9581:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   9582:             builds and runs on a small handful of platforms, set
                   9583:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   9584:             If the package should be skipped (for example, because
                   9585:             it provides functionality already provided by the
                   9586:             system), set <code class=
                   9587:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   9588:             message. If the package should fail because some
                   9589:             preconditions are not met, set <code class=
                   9590:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    9591:             message.</p>
                   9592: 
1.14      xtraeme  9593:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    9594:             because it didn't provide enough information to
                   9595:             determine whether the build should fail.</p>
                   9596:           </div>
                   9597: 
                   9598:           <div class="sect2" lang="en" xml:lang="en">
                   9599:             <div class="titlepage">
                   9600:               <div>
                   9601:                 <div>
1.30    ! wiz      9602:                   <h3 class="title"><a name="undeletable-packages"
        !          9603:                   id=
        !          9604:                   "undeletable-packages"></a>13.1.6.&nbsp;Packages
        !          9605:                   which should not be deleted, once installed</h3>
1.1       grant    9606:                 </div>
                   9607:               </div>
                   9608:             </div>
                   9609: 
                   9610:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  9611:             has been installed, the <code class=
                   9612:             "varname">PKG_PRESERVE</code> definition should be set
                   9613:             in the package Makefile. This will be carried into any
1.1       grant    9614:             binary package that is made from this pkgsrc entry. A
                   9615:             &#8220;<span class="quote">preserved</span>&#8221;
                   9616:             package will not be deleted using <a href=
                   9617:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9618:             <span class="citerefentry"><span class=
                   9619:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   9620:             the &#8220;<span class="quote">-f</span>&#8221; option
                   9621:             is used.</p>
                   9622:           </div>
                   9623: 
                   9624:           <div class="sect2" lang="en" xml:lang="en">
                   9625:             <div class="titlepage">
                   9626:               <div>
                   9627:                 <div>
                   9628:                   <h3 class="title"><a name="security-handling" id=
1.25      rillig   9629:                   "security-handling"></a>13.1.7.&nbsp;Handling
1.1       grant    9630:                   packages with security problems</h3>
                   9631:                 </div>
                   9632:               </div>
                   9633:             </div>
                   9634: 
                   9635:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  9636:             in <code class=
                   9637:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    9638:             and after the commit of that file, it should be copied
1.14      xtraeme  9639:             to both <code class=
                   9640:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   9641:             and <code class=
                   9642:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   9643:             on ftp.NetBSD.org using <code class=
                   9644:             "filename">localsrc/security/advisories/Makefile</code>.
                   9645:             In addition, if a <code class=
                   9646:             "filename">buildlink3.mk</code> file exists for an
                   9647:             affected package, bumping <code class=
                   9648:             "varname">PKGREVISION</code> and creating a
                   9649:             corresponding <code class=
                   9650:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   9651:             "replaceable"><code>pkg</code></em></code> entry should
                   9652:             be considered. See <a href="#buildlink" title=
1.25      rillig   9653:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9654:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  9655:             about writing <code class=
                   9656:             "filename">buildlink3.mk</code> files and <code class=
                   9657:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    9658: 
                   9659:             <p>Also, if the fix should be applied to the stable
                   9660:             pkgsrc branch, be sure to submit a pullup request!</p>
                   9661:           </div>
                   9662: 
                   9663:           <div class="sect2" lang="en" xml:lang="en">
                   9664:             <div class="titlepage">
                   9665:               <div>
                   9666:                 <div>
1.30    ! wiz      9667:                   <h3 class="title"><a name="compiler-bugs" id=
        !          9668:                   "compiler-bugs"></a>13.1.8.&nbsp;How to handle
1.1       grant    9669:                   compiler bugs</h3>
                   9670:                 </div>
                   9671:               </div>
                   9672:             </div>
                   9673: 
                   9674:             <p>Some source files trigger bugs in the compiler,
                   9675:             based on combinations of compiler version and
                   9676:             architecture and almost always relation to optimisation
                   9677:             being enabled. Common symptoms are gcc internal errors
                   9678:             or never finishing compiling a file.</p>
                   9679: 
                   9680:             <p>Typically a workaround involves testing the
1.14      xtraeme  9681:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    9682:             version, disabling optimisation for that
1.14      xtraeme  9683:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   9684:             combination, and documenting it in <code class=
                   9685:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    9686:             number of examples!</p>
                   9687:           </div>
                   9688: 
                   9689:           <div class="sect2" lang="en" xml:lang="en">
                   9690:             <div class="titlepage">
                   9691:               <div>
                   9692:                 <div>
1.30    ! wiz      9693:                   <h3 class="title"><a name="bumping-pkgrevision"
        !          9694:                   id="bumping-pkgrevision"></a>13.1.9.&nbsp;How to
        !          9695:                   handle incrementing versions when fixing an
        !          9696:                   existing package</h3>
1.1       grant    9697:                 </div>
                   9698:               </div>
                   9699:             </div>
                   9700: 
                   9701:             <p>When making fixes to an existing package it can be
1.14      xtraeme  9702:             useful to change the version number in <code class=
                   9703:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    9704:             future versions by the original author, a
                   9705:             &#8220;<span class="quote">nb1</span>&#8221;,
                   9706:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   9707:             suffix can be used on package versions by setting
1.14      xtraeme  9708:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   9709:             The &#8220;<span class="quote">nb</span>&#8221; is
                   9710:             treated like a &#8220;<span class=
                   9711:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    9712:             <pre class="programlisting">
                   9713:   DISTNAME= foo-17.42
                   9714:     PKGREVISION=  9
                   9715: </pre>
                   9716: 
1.14      xtraeme  9717:             <p>will result in a <code class=
                   9718:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    9719:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   9720: 
                   9721:             <p>When a new release of the package is released, the
1.14      xtraeme  9722:             <code class="varname">PKGREVISION</code> should be
                   9723:             removed. e.g. on a new minor release of the above
                   9724:             package, things should be like:</p>
1.1       grant    9725:             <pre class="programlisting">
                   9726: DISTNAME=   foo-17.43
                   9727: </pre>
                   9728:           </div>
                   9729: 
                   9730:           <div class="sect2" lang="en" xml:lang="en">
                   9731:             <div class="titlepage">
                   9732:               <div>
                   9733:                 <div>
1.30    ! wiz      9734:                   <h3 class="title"><a name=
        !          9735:                   "portability-of-packages" id=
        !          9736:                   "portability-of-packages"></a>13.1.10.&nbsp;Portability
        !          9737:                   of packages</h3>
1.1       grant    9738:                 </div>
                   9739:               </div>
                   9740:             </div>
                   9741: 
                   9742:             <p>One appealing feature of pkgsrc is that it runs on
                   9743:             many different platforms. As a result, it is important
                   9744:             to ensure, where possible, that packages in pkgsrc are
                   9745:             portable. There are some particular details you should
                   9746:             pay attention to while working on pkgsrc.</p>
                   9747: 
                   9748:             <div class="sect3" lang="en" xml:lang="en">
                   9749:               <div class="titlepage">
                   9750:                 <div>
                   9751:                   <div>
1.30    ! wiz      9752:                     <h4 class="title"><a name="install-scripts" id=
        !          9753:                     "install-scripts"></a>13.1.10.1.&nbsp;${INSTALL},
1.1       grant    9754:                     ${INSTALL_DATA_DIR}, ...</h4>
                   9755:                   </div>
                   9756:                 </div>
                   9757:               </div>
                   9758: 
1.14      xtraeme  9759:               <p>The BSD-compatible <span><strong class=
                   9760:               "command">install</strong></span> supplied with some
1.1       grant    9761:               operating systems will not perform more than one
                   9762:               operation at a time. As such, you should call
                   9763:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   9764:               etc. like this:</p>
                   9765:               <pre class="programlisting">
                   9766: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   9767: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   9768: </pre>
                   9769:             </div>
                   9770:           </div>
                   9771:         </div>
                   9772: 
                   9773:         <div class="sect1" lang="en" xml:lang="en">
                   9774:           <div class="titlepage">
                   9775:             <div>
                   9776:               <div>
                   9777:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      9778:                 "downloading-issues" id=
        !          9779:                 "downloading-issues"></a>13.2.&nbsp;Possible
1.1       grant    9780:                 downloading issues</h2>
                   9781:               </div>
                   9782:             </div>
                   9783:           </div>
                   9784: 
                   9785:           <div class="sect2" lang="en" xml:lang="en">
                   9786:             <div class="titlepage">
                   9787:               <div>
                   9788:                 <div>
1.30    ! wiz      9789:                   <h3 class="title"><a name="no-plain-download" id=
        !          9790:                   "no-plain-download"></a>13.2.1.&nbsp;Packages
        !          9791:                   whose distfiles aren't available for plain
1.1       grant    9792:                   downloading</h3>
                   9793:                 </div>
                   9794:               </div>
                   9795:             </div>
                   9796: 
                   9797:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  9798:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   9799:             and a <span><strong class="command">make
                   9800:             fetch</strong></span> will call <code class=
                   9801:             "filename">files/getsite.sh</code> with the name of
                   9802:             each file to download as an argument, expecting it to
                   9803:             output the URL of the directory from which to download
                   9804:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9805:             href=
1.1       grant    9806:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      9807:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   9808:             this usage.</p>
1.1       grant    9809: 
                   9810:             <p>If the download can't be automated, because the user
                   9811:             must submit personal information to apply for a
                   9812:             password, or must pay for the source, or whatever, you
1.14      xtraeme  9813:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   9814:             a macro which displays a message explaining the
                   9815:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   9816:             must be executable shell commands, not just a message.
                   9817:             (Generally, it executes <code class=
                   9818:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    9819:             following packages use this: <a xmlns=
                   9820:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9821:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      9822:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   9823:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9824:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   9825:             class="pkgname">cad/simian</a>, <a xmlns=
                   9826:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9827:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   9828:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   9829:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9830:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   9831:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   9832:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9833:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   9834:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   9835:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9836:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   9837:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   9838:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9839:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   9840:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   9841:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9842:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   9843:             class="pkgname">www/openacs</a>. Try to be consistent
                   9844:             with them.</p>
1.1       grant    9845:           </div>
                   9846: 
                   9847:           <div class="sect2" lang="en" xml:lang="en">
                   9848:             <div class="titlepage">
                   9849:               <div>
                   9850:                 <div>
1.30    ! wiz      9851:                   <h3 class="title"><a name=
        !          9852:                   "modified-distfiles-same-name" id=
        !          9853:                   "modified-distfiles-same-name"></a>13.2.2.&nbsp;How
        !          9854:                   to handle modified distfiles with the 'old'
        !          9855:                   name</h3>
1.1       grant    9856:                 </div>
                   9857:               </div>
                   9858:             </div>
                   9859: 
                   9860:             <p>Sometimes authors of a software package make some
                   9861:             modifications after the software was released, and they
                   9862:             put up a new distfile without changing the package's
                   9863:             version number. If a package is already in pkgsrc at
                   9864:             that time, the md5 checksum will no longer match. The
                   9865:             correct way to work around this is to update the
                   9866:             package's md5 checksum to match the package on the
                   9867:             master site (beware, any mirrors may not be up to date
                   9868:             yet!), and to remove the old distfile from
1.14      xtraeme  9869:             ftp.NetBSD.org's <code class=
                   9870:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    9871:             directory. Furthermore, a mail to the package's author
                   9872:             seems appropriate making sure the distfile was really
                   9873:             updated on purpose, and that no trojan horse or so
                   9874:             crept in.</p>
                   9875:           </div>
                   9876:         </div>
                   9877: 
                   9878:         <div class="sect1" lang="en" xml:lang="en">
                   9879:           <div class="titlepage">
                   9880:             <div>
                   9881:               <div>
                   9882:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      9883:                 "configuration-gotchas" id=
        !          9884:                 "configuration-gotchas"></a>13.3.&nbsp;Configuration
1.1       grant    9885:                 gotchas</h2>
                   9886:               </div>
                   9887:             </div>
                   9888:           </div>
                   9889: 
                   9890:           <div class="sect2" lang="en" xml:lang="en">
                   9891:             <div class="titlepage">
                   9892:               <div>
                   9893:                 <div>
                   9894:                   <h3 class="title"><a name="fixes.libtool" id=
1.25      rillig   9895:                   "fixes.libtool"></a>13.3.1.&nbsp;Shared libraries
1.1       grant    9896:                   - libtool</h3>
                   9897:                 </div>
                   9898:               </div>
                   9899:             </div>
                   9900: 
                   9901:             <p>pkgsrc supports many different machines, with
                   9902:             different object formats like a.out and ELF, and
                   9903:             varying abilities to do shared library and dynamic
                   9904:             loading at all. To accompany this, varying commands and
                   9905:             options have to be passed to the compiler, linker, etc.
                   9906:             to get the Right Thing, which can be pretty annoying
                   9907:             especially if you don't have all the machines at your
                   9908:             hand to test things. The <a xmlns=
                   9909:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9910:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      9911:             class="pkgname">devel/libtool</a> pkg can help here, as
                   9912:             it just &#8220;<span class="quote">knows</span>&#8221;
                   9913:             how to build both static and dynamic libraries from a
                   9914:             set of source files, thus being platform
                   9915:             independent.</p>
1.1       grant    9916: 
                   9917:             <p>Here's how to use libtool in a pkg in seven simple
                   9918:             steps:</p>
                   9919: 
                   9920:             <div class="orderedlist">
                   9921:               <ol type="1">
                   9922:                 <li>
1.14      xtraeme  9923:                   <p>Add <code class=
                   9924:                   "varname">USE_LIBTOOL=yes</code> to the package
                   9925:                   Makefile.</p>
1.1       grant    9926:                 </li>
                   9927: 
                   9928:                 <li>
                   9929:                   <p>For library objects, use &#8220;<span class=
                   9930:                   "quote">${LIBTOOL} --mode=compile
                   9931:                   ${CC}</span>&#8221; in place of
                   9932:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   9933:                   You could even add it to the definition of
1.14      xtraeme  9934:                   <code class="varname">CC</code>, if only
                   9935:                   libraries are being built in a given Makefile.
                   9936:                   This one command will build both PIC and non-PIC
                   9937:                   library objects, so you need not have separate
                   9938:                   shared and non-shared library rules.</p>
1.1       grant    9939:                 </li>
                   9940: 
                   9941:                 <li>
                   9942:                   <p>For the linking of the library, remove any
                   9943:                   &#8220;<span class="quote">ar</span>&#8221;,
                   9944:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   9945:                   and &#8220;<span class="quote">ld
                   9946:                   -Bshareable</span>&#8221; commands, and instead
                   9947:                   use:</p>
                   9948:                   <pre class="programlisting">
                   9949: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   9950: </pre>
                   9951: 
                   9952:                   <p>Note that the library is changed to have a
1.14      xtraeme  9953:                   <code class="filename">.la</code> extension, and
                   9954:                   the objects are changed to have a <code class=
                   9955:                   "filename">.lo</code> extension. Change
                   9956:                   <code class="varname">OBJS</code> as necessary.
                   9957:                   This automatically creates all of the
                   9958:                   <code class="filename">.a</code>, <code class=
                   9959:                   "filename">.so.major.minor</code>, and ELF
                   9960:                   symlinks (if necessary) in the build directory.
                   9961:                   Be sure to include &#8220;<span class=
1.1       grant    9962:                   "quote">-version-info</span>&#8221;, especially
                   9963:                   when major and minor are zero, as libtool will
                   9964:                   otherwise strip off the shared library
                   9965:                   version.</p>
                   9966: 
                   9967:                   <p>From the libtool manual:</p>
                   9968:                   <pre class="programlisting">
                   9969:      So, libtool library versions are described by three integers:
                   9970: 
                   9971: CURRENT
                   9972:        The most recent interface number that this library implements.
                   9973: 
                   9974: REVISION
                   9975:        The implementation number of the CURRENT interface.
                   9976: 
                   9977: AGE
                   9978:        The difference between the newest and oldest interfaces that this
                   9979:        library implements.  In other words, the library implements all the
                   9980:        interface numbers in the range from number `CURRENT - AGE' to
                   9981:        `CURRENT'.
                   9982:        
                   9983:      If two libraries have identical CURRENT and AGE numbers, then the
                   9984: dynamic linker chooses the library with the greater REVISION number. 
                   9985: </pre>
                   9986: 
                   9987:                   <p>The &#8220;<span class=
                   9988:                   "quote">-release</span>&#8221; option will
                   9989:                   produce different results for a.out and ELF
                   9990:                   (excluding symlinks) in only one case. An ELF
                   9991:                   library of the form &#8220;<span class=
                   9992:                   "quote">libfoo-release.so.<span class=
                   9993:                   "emphasis"><em>x</em></span>.<span class=
                   9994:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9995:                   have a symlink of &#8220;<span class=
                   9996:                   "quote">libfoo.so.<span class=
                   9997:                   "emphasis"><em>x</em></span>.<span class=
                   9998:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9999:                   a.out platform. This is handled
                   10000:                   automatically.</p>
                   10001: 
                   10002:                   <p>The &#8220;<span class="quote">-rpath
                   10003:                   argument</span>&#8221; is the install directory
                   10004:                   of the library being built.</p>
                   10005: 
1.14      xtraeme  10006:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  10007:                   include only the <code class=
                   10008:                   "filename">.la</code> file, the other files will
                   10009:                   be added automatically.</p>
1.1       grant    10010:                 </li>
                   10011: 
                   10012:                 <li>
1.14      xtraeme  10013:                   <p>When linking shared object (<code class=
                   10014:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      10015:                   loaded via <a href=
                   10016:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   10017:                   <span class="citerefentry"><span class=
                   10018:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   10019:                   shared libraries, use &#8220;<span class=
                   10020:                   "quote">-module -avoid-version</span>&#8221; to
                   10021:                   prevent them getting version tacked on.</p>
1.1       grant    10022: 
1.14      xtraeme  10023:                   <p>The <code class="filename">PLIST</code> file
                   10024:                   gets the <code class="filename">foo.so</code>
                   10025:                   entry.</p>
1.1       grant    10026:                 </li>
                   10027: 
                   10028:                 <li>
                   10029:                   <p>When linking programs that depend on these
                   10030:                   libraries <span class=
                   10031:                   "emphasis"><em>before</em></span> they are
                   10032:                   installed, preface the <a href=
                   10033:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   10034:                   <span class="citerefentry"><span class=
                   10035:                   "refentrytitle">cc</span>(1)</span></a> or
                   10036:                   <a href=
                   10037:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   10038:                   <span class="citerefentry"><span class=
                   10039:                   "refentrytitle">ld</span>(1)</span></a> line with
                   10040:                   &#8220;<span class="quote">${LIBTOOL}
                   10041:                   --mode=link</span>&#8221;, and it will find the
                   10042:                   correct libraries (static or shared), but please
                   10043:                   be aware that libtool will not allow you to
                   10044:                   specify a relative path in -L (such as
                   10045:                   &#8220;<span class=
                   10046:                   "quote">-L../somelib</span>&#8221;), because it
                   10047:                   expects you to change that argument to be the
1.14      xtraeme  10048:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    10049:                   <pre class="programlisting">
                   10050: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   10051: </pre>
                   10052: 
                   10053:                   <p>should be changed to:</p>
                   10054:                   <pre class="programlisting">
1.14      xtraeme  10055: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   10056: "replaceable"><code>someprog</code></em> <em class=
                   10057: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    10058: </pre>
                   10059: 
                   10060:                   <p>and it will do the right thing with the
                   10061:                   libraries.</p>
                   10062:                 </li>
                   10063: 
                   10064:                 <li>
                   10065:                   <p>When installing libraries, preface the
                   10066:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   10067:                   <span class="citerefentry"><span class=
                   10068:                   "refentrytitle">install</span>(1)</span></a> or
                   10069:                   <a href=
                   10070:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   10071:                   <span class="citerefentry"><span class=
                   10072:                   "refentrytitle">cp</span>(1)</span></a> command
                   10073:                   with &#8220;<span class="quote">${LIBTOOL}
                   10074:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  10075:                   library name to <code class=
                   10076:                   "filename">.la</code>. e.g.</p>
1.1       grant    10077:                   <pre class="programlisting">
                   10078: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   10079: </pre>
                   10080: 
1.14      xtraeme  10081:                   <p>This will install the static <code class=
                   10082:                   "filename">.a</code>, shared library, any needed
1.1       grant    10083:                   symlinks, and run <a href=
                   10084:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   10085:                   <span class="citerefentry"><span class=
                   10086:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   10087:                 </li>
                   10088: 
                   10089:                 <li>
1.14      xtraeme  10090:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      10091:                   include only the <code class=
                   10092:                   "filename">.la</code> file (this is a change from
                   10093:                   previous behaviour).</p>
1.1       grant    10094:                 </li>
                   10095:               </ol>
                   10096:             </div>
                   10097:           </div>
                   10098: 
                   10099:           <div class="sect2" lang="en" xml:lang="en">
                   10100:             <div class="titlepage">
                   10101:               <div>
                   10102:                 <div>
1.30    ! wiz      10103:                   <h3 class="title"><a name="using-libtool" id=
        !          10104:                   "using-libtool"></a>13.3.2.&nbsp;Using libtool on
        !          10105:                   GNU packages that already support libtool</h3>
1.1       grant    10106:                 </div>
                   10107:               </div>
                   10108:             </div>
                   10109: 
1.14      xtraeme  10110:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   10111:             the package Makefile. This will override the package's
                   10112:             own libtool in most cases. For older libtool using
1.1       grant    10113:             packages, libtool is made by ltconfig script during the
                   10114:             do-configure step; you can check the libtool script
1.14      xtraeme  10115:             location by doing <span><strong class="command">make
                   10116:             configure; find work*/ -name
                   10117:             libtool</strong></span>.</p>
                   10118: 
                   10119:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   10120:             specifies which libtool scripts, relative to
                   10121:             <code class="varname">WRKSRC</code>, to override. By
                   10122:             default, it is set to &#8220;<span class=
                   10123:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   10124:             this does not match the location of the package's
                   10125:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  10126: 
1.14      xtraeme  10127:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    10128:             static libraries built and installed, then use
1.14      xtraeme  10129:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    10130:             instead.</p>
                   10131: 
                   10132:             <p>If your package makes use of the platform
                   10133:             independent library for loading dynamic shared objects,
                   10134:             that comes with libtool (libltdl), you should include
1.22      tv       10135:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    10136: 
                   10137:             <p>Some packages use libtool incorrectly so that the
                   10138:             package may not work or build in some circumstances.
                   10139:             Some of the more common errors are:</p>
                   10140: 
                   10141:             <div class="itemizedlist">
                   10142:               <ul type="disc">
                   10143:                 <li>
                   10144:                   <p>The inclusion of a shared object (-module) as
                   10145:                   a dependent library in an executable or library.
                   10146:                   This in itself isn't a problem if one of two
                   10147:                   things has been done:</p>
                   10148: 
                   10149:                   <div class="orderedlist">
                   10150:                     <ol type="1">
                   10151:                       <li>
                   10152:                         <p>The shared object is named correctly,
1.14      xtraeme  10153:                         i.e. <code class=
                   10154:                         "filename">libfoo.la</code>, not
                   10155:                         <code class="filename">foo.la</code></p>
1.1       grant    10156:                       </li>
                   10157: 
                   10158:                       <li>
                   10159:                         <p>The -dlopen option is used when linking
                   10160:                         an executable.</p>
                   10161:                       </li>
                   10162:                     </ol>
                   10163:                   </div>
                   10164:                 </li>
                   10165: 
                   10166:                 <li>
                   10167:                   <p>The use of libltdl without the correct calls
                   10168:                   to initialisation routines. The function
                   10169:                   lt_dlinit() should be called and the macro
1.14      xtraeme  10170:                   <code class=
                   10171:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    10172:                   included in executables.</p>
                   10173:                 </li>
                   10174:               </ul>
                   10175:             </div>
                   10176:           </div>
                   10177: 
                   10178:           <div class="sect2" lang="en" xml:lang="en">
                   10179:             <div class="titlepage">
                   10180:               <div>
                   10181:                 <div>
1.30    ! wiz      10182:                   <h3 class="title"><a name="autoconf-automake" id=
        !          10183:                   "autoconf-automake"></a>13.3.3.&nbsp;GNU
1.1       grant    10184:                   Autoconf/Automake</h3>
                   10185:                 </div>
                   10186:               </div>
                   10187:             </div>
                   10188: 
                   10189:             <p>If a package needs GNU autoconf or automake to be
                   10190:             executed to regenerate the configure script and
                   10191:             Makefile.in makefile templates, then they should be
                   10192:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  10193:             fragments are provided in <code class=
                   10194:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   10195:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   10196:             help dealing with these tools. See comments in these
                   10197:             files for details.</p>
1.1       grant    10198: 
                   10199:             <p>For packages that need only autoconf:</p>
                   10200:             <pre class="programlisting">
                   10201: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   10202: ...
                   10203: 
                   10204: pre-configure:
                   10205:           cd ${WRKSRC}; ${AUTOCONF}
                   10206: 
                   10207: ...
                   10208: .include "../../mk/autoconf.mk"
                   10209: </pre>
                   10210: 
                   10211:             <p>and for packages that need automake and
                   10212:             autoconf:</p>
                   10213:             <pre class="programlisting">
                   10214: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   10215: ...
                   10216: 
                   10217: pre-configure:
                   10218:           cd ${WRKSRC};                                           \
                   10219:           ${ACLOCAL};                                             \
                   10220:           ${AUTOHEADER};                                          \
                   10221:           ${AUTOMAKE} -a --foreign -i;                            \
                   10222:           ${AUTOCONF}
                   10223: 
                   10224: ...
                   10225: .include "../mk/automake.mk"
                   10226: </pre>
                   10227: 
                   10228:             <p>Packages which use GNU Automake will almost
                   10229:             certainly require GNU Make, but that's automatically
1.14      xtraeme  10230:             provided for you in <code class=
                   10231:             "filename">mk/automake.mk</code>.</p>
1.1       grant    10232: 
                   10233:             <p>There are times when the configure process makes
                   10234:             additional changes to the generated files, which then
                   10235:             causes the build process to try to re-execute the
                   10236:             automake sequence. This is prevented by touching
                   10237:             various files in the configure stage. If this causes
1.14      xtraeme  10238:             problems with your package you can set <code class=
                   10239:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    10240:             Makefile.</p>
                   10241:           </div>
                   10242:         </div>
                   10243: 
                   10244:         <div class="sect1" lang="en" xml:lang="en">
                   10245:           <div class="titlepage">
                   10246:             <div>
                   10247:               <div>
                   10248:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      10249:                 "building-considerations" id=
        !          10250:                 "building-considerations"></a>13.4.&nbsp;Building
1.1       grant    10251:                 considerations</h2>
                   10252:               </div>
                   10253:             </div>
                   10254:           </div>
                   10255: 
                   10256:           <div class="sect2" lang="en" xml:lang="en">
                   10257:             <div class="titlepage">
                   10258:               <div>
                   10259:                 <div>
1.30    ! wiz      10260:                   <h3 class="title"><a name="cpp-defines" id=
        !          10261:                   "cpp-defines"></a>13.4.1.&nbsp;CPP defines</h3>
1.1       grant    10262:                 </div>
                   10263:               </div>
                   10264:             </div>
                   10265: 
                   10266:             <p>To port an application to NetBSD, it's usually
                   10267:             necessary for the compiler to be able to judge the
                   10268:             system on which it's compiling, and we use definitions
                   10269:             so that the C pre-processor can do this.</p>
                   10270: 
                   10271:             <p>To test whether you are working on a 4.4 BSD-derived
                   10272:             system, you should use the BSD definition, which is
1.14      xtraeme  10273:             defined in <code class=
                   10274:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    10275:             systems.</p>
                   10276:             <pre class="programlisting">
                   10277: #include &lt;sys/param.h&gt;
                   10278: </pre>
                   10279: 
                   10280:             <p>and then you can surround the BSD-specific parts of
                   10281:             your package's C/C++ code using this conditional:</p>
                   10282:             <pre class="programlisting">
                   10283: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   10284:     ...
                   10285: #endif
                   10286: </pre>
                   10287: 
                   10288:             <p>Please use the &#8220;<span class=
                   10289:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   10290:             it should only apply to features of NetBSD that are not
                   10291:             present in other 4.4-lite derived BSDs.</p>
                   10292:           </div>
                   10293:         </div>
                   10294: 
                   10295:         <div class="sect1" lang="en" xml:lang="en">
                   10296:           <div class="titlepage">
                   10297:             <div>
                   10298:               <div>
                   10299:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      10300:                 "package-specific-actions" id=
        !          10301:                 "package-specific-actions"></a>13.5.&nbsp;Package
1.1       grant    10302:                 specific actions</h2>
                   10303:               </div>
                   10304:             </div>
                   10305:           </div>
                   10306: 
                   10307:           <div class="sect2" lang="en" xml:lang="en">
                   10308:             <div class="titlepage">
                   10309:               <div>
                   10310:                 <div>
1.30    ! wiz      10311:                   <h3 class="title"><a name=
        !          10312:                   "package-configuration-files" id=
        !          10313:                   "package-configuration-files"></a>13.5.1.&nbsp;Package
1.1       grant    10314:                   configuration files</h3>
                   10315:                 </div>
                   10316:               </div>
                   10317:             </div>
                   10318: 
                   10319:             <p>Packages should be taught to look for their
1.14      xtraeme  10320:             configuration files in <code class=
                   10321:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    10322:             through to the configure and build processes.
1.14      xtraeme  10323:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    10324:             customized in various ways by setting other make
                   10325:             variables:</p>
                   10326: 
                   10327:             <div class="itemizedlist">
                   10328:               <ul type="disc">
                   10329:                 <li>
1.14      xtraeme  10330:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   10331:                   is the main config directory under which all
                   10332:                   package configuration files are to be found. This
                   10333:                   defaults to <code class=
                   10334:                   "filename">${PREFIX}/etc</code>, but may be
                   10335:                   overridden in <code class=
                   10336:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    10337:                 </li>
                   10338: 
                   10339:                 <li>
1.14      xtraeme  10340:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   10341:                   is the subdirectory of <code class=
                   10342:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    10343:                   configuration files for a particular package may
                   10344:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  10345:                   all be found under the <code class=
                   10346:                   "filename">httpd/</code> subdirectory of
                   10347:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   10348:                   This should be set in the package Makefile.</p>
1.1       grant    10349:                 </li>
                   10350: 
                   10351:                 <li>
1.14      xtraeme  10352:                   <p>By default, <code class=
                   10353:                   "varname">PKG_SYSCONFDIR</code> is set to
                   10354:                   <code class=
                   10355:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   10356:                   but this may be overridden by setting
                   10357:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   10358:                   for a particular package, where <code class=
                   10359:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   10360:                   <code class="varname">${PKGBASE}</code>. This is
                   10361:                   not meant to be set by a package Makefile, but is
1.1       grant    10362:                   reserved for users who wish to override the
1.14      xtraeme  10363:                   <code class="varname">PKG_SYSCONFDIR</code>
                   10364:                   setting for a particular package with a special
1.1       grant    10365:                   location.</p>
                   10366:                 </li>
                   10367:               </ul>
                   10368:             </div>
                   10369: 
                   10370:             <p>The only variables that users should customize are
1.14      xtraeme  10371:             <code class="varname">PKG_SYSCONFBASE</code> and
                   10372:             <code class=
                   10373:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   10374:             Users will typically want to set <code class=
                   10375:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   10376:             "filename">/etc</code>, or to accept the default
                   10377:             location of <code class=
                   10378:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    10379:           </div>
                   10380: 
                   10381:           <div class="sect2" lang="en" xml:lang="en">
                   10382:             <div class="titlepage">
                   10383:               <div>
                   10384:                 <div>
1.30    ! wiz      10385:                   <h3 class="title"><a name="user-interaction" id=
        !          10386:                   "user-interaction"></a>13.5.2.&nbsp;User
1.2       hubertf  10387:                   interaction</h3>
1.1       grant    10388:                 </div>
                   10389:               </div>
                   10390:             </div>
                   10391: 
                   10392:             <p>Occasionally, packages require interaction from the
                   10393:             user, and this can be in a number of ways:</p>
                   10394: 
                   10395:             <div class="itemizedlist">
                   10396:               <ul type="disc">
                   10397:                 <li>
                   10398:                   <p>help in fetching the distfiles</p>
                   10399:                 </li>
                   10400: 
                   10401:                 <li>
                   10402:                   <p>help to configure the package before it is
                   10403:                   built</p>
                   10404:                 </li>
                   10405: 
                   10406:                 <li>
                   10407:                   <p>help during the build process</p>
                   10408:                 </li>
                   10409: 
                   10410:                 <li>
                   10411:                   <p>help during the installation of a package</p>
                   10412:                 </li>
                   10413:               </ul>
                   10414:             </div>
                   10415: 
1.14      xtraeme  10416:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    10417:             definition is provided to notify the pkgsrc mechanism
                   10418:             of an interactive stage which will be needed, and this
1.14      xtraeme  10419:             should be set in the package's <code class=
                   10420:             "filename">Makefile</code>. e.g.</p>
1.1       grant    10421:             <pre class="programlisting">
                   10422: INTERACTIVE_STAGE= build
                   10423: </pre>
                   10424: 
                   10425:             <p>Multiple interactive stages can be specified:</p>
                   10426:             <pre class="programlisting">
                   10427: INTERACTIVE_STAGE= configure install
                   10428: </pre>
                   10429:           </div>
                   10430: 
                   10431:           <div class="sect2" lang="en" xml:lang="en">
                   10432:             <div class="titlepage">
                   10433:               <div>
                   10434:                 <div>
1.30    ! wiz      10435:                   <h3 class="title"><a name="handling-licenses" id=
        !          10436:                   "handling-licenses"></a>13.5.3.&nbsp;Handling
1.1       grant    10437:                   licenses</h3>
                   10438:                 </div>
                   10439:               </div>
                   10440:             </div>
                   10441: 
                   10442:             <p>A package may underly a license which the user has
                   10443:             or has not agreed to accept. Usually, packages that
                   10444:             underly well-known Open Source licenses (e.g. the GNU
                   10445:             Public License, GPL) won't have any special license
                   10446:             tags added in pkgsrc which require special action by
                   10447:             the user of such packages, but there are quite a number
                   10448:             of other licenses out there that pkgsrc users may not
                   10449:             be able to follow, for whatever reasons. For these
                   10450:             cases, pkgsrc contains a mechanism to note that a
                   10451:             package underlies a certain license, and the user has
                   10452:             to accept the license before the package can be
                   10453:             installed.</p>
                   10454: 
                   10455:             <p>Placing a certain package under a certain license
1.14      xtraeme  10456:             works by setting the <code class=
                   10457:             "varname">LICENSE</code> variable to a string
                   10458:             identifying the license, e.g. in <a xmlns=
                   10459:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10460:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      10461:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    10462:             <pre class="programlisting">
                   10463: LICENSE=        graphviz-license
                   10464: </pre>
                   10465: 
                   10466:             <p>When trying to build, the user will get a notice
                   10467:             that the package underlies a license which he hasn't
                   10468:             accepted (yet):</p>
                   10469:             <pre class="programlisting">
1.14      xtraeme  10470: <code class="prompt">%</code> <strong class=
                   10471: "userinput"><code>make</code></strong>
1.1       grant    10472: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   10473: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   10474: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   10475: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   10476: *** Error code 1
                   10477: </pre>
                   10478: 
1.14      xtraeme  10479:             <p>The license can be viewed with <span><strong class=
                   10480:             "command">make show-license</strong></span>, and if it
                   10481:             is considered appropriate, the line printed above can
                   10482:             be added to <code class="filename">/etc/mk.conf</code>
                   10483:             to indicate acceptance of the particular license:</p>
1.1       grant    10484:             <pre class="programlisting">
                   10485: ACCEPTABLE_LICENSES+=graphviz-license
                   10486: </pre>
                   10487: 
                   10488:             <p>When adding a package with a new license, the
1.14      xtraeme  10489:             license text should be added to <code class=
                   10490:             "filename">pkgsrc/licenses</code> for displaying. A
                   10491:             list of known licenses can be seen in this directory as
                   10492:             well as by looking at the list of (commented out)
                   10493:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   10494:             variable settings in <code class=
                   10495:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    10496: 
1.17      sketch   10497:             <p>If there is a <span class=
1.1       grant    10498:             "emphasis"><em>really</em></span> pressing need to
                   10499:             accept all licenses at once, like when trying to
                   10500:             download or mirror all distfiles or doing a bulk build
                   10501:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  10502:             done by setting <code class=
                   10503:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    10504:           </div>
                   10505: 
                   10506:           <div class="sect2" lang="en" xml:lang="en">
                   10507:             <div class="titlepage">
                   10508:               <div>
                   10509:                 <div>
1.30    ! wiz      10510:                   <h3 class="title"><a name="creating-accounts" id=
        !          10511:                   "creating-accounts"></a>13.5.4.&nbsp;Creating an
        !          10512:                   account from a package</h3>
1.1       grant    10513:                 </div>
                   10514:               </div>
                   10515:             </div>
                   10516: 
                   10517:             <p>There are two make variables used to control the
                   10518:             creation of package-specific groups and users at
1.14      xtraeme  10519:             pre-install time. The first is <code class=
                   10520:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    10521:             group[:groupid] elements, where the groupid is
1.14      xtraeme  10522:             optional. The second is <code class=
                   10523:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    10524:             of the form:</p>
                   10525:             <pre class="programlisting">
                   10526: user:group[:[userid][:[description][:[home][:shell]]]]
                   10527: </pre>
                   10528: 
                   10529:             <p>where only the user and group are required, the rest
                   10530:             being optional. A simple example is:</p>
                   10531:             <pre class="programlisting">
                   10532:   PKG_GROUPS=       foogroup
                   10533:     PKG_USERS=    foouser:foogroup
                   10534: </pre>
                   10535: 
                   10536:             <p>A more complex example is that creates two groups
                   10537:             and two users is:</p>
                   10538:             <pre class="programlisting">
                   10539:   PKG_GROUPS=       group1 group2:1005
                   10540:     PKG_USERS=    first:group1::First\\ User                      \
                   10541:                   second:group2::Second\\ User:/home/second:${SH}
                   10542: </pre>
                   10543: 
                   10544:             <p>By default, a new user will have home directory
1.14      xtraeme  10545:             <code class="filename">/nonexistent</code>, and login
                   10546:             shell <code class="filename">/sbin/nologin</code>
                   10547:             unless they are specified as part of the user
                   10548:             element.</p>
1.1       grant    10549: 
1.14      xtraeme  10550:             <p>The package <code class="filename">Makefile</code>
                   10551:             must also set <code class=
                   10552:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   10553:             the users and groups to be created at pre-install time,
                   10554:             and the admin will be prompted to remove them at
                   10555:             post-deinstall time. Automatic creation of the users
                   10556:             and groups can be toggled on and off by setting the
                   10557:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   10558:             variable prior to package installation.</p>
1.1       grant    10559:           </div>
                   10560: 
                   10561:           <div class="sect2" lang="en" xml:lang="en">
                   10562:             <div class="titlepage">
                   10563:               <div>
                   10564:                 <div>
1.30    ! wiz      10565:                   <h3 class="title"><a name=
        !          10566:                   "installing-score-files" id=
        !          10567:                   "installing-score-files"></a>13.5.5.&nbsp;Installing
        !          10568:                   score files</h3>
1.1       grant    10569:                 </div>
                   10570:               </div>
                   10571:             </div>
                   10572: 
                   10573:             <p>Certain packages, most of them in the games
                   10574:             category, install a score file that allows all users on
                   10575:             the system to record their highscores. In order for
                   10576:             this to work, the binaries need to be installed setgid
                   10577:             and the score files owned by the appropriate group
                   10578:             and/or owner (traditionally the "games" user/group).
                   10579:             The following variables, documented in more detail in
1.14      xtraeme  10580:             <code class="filename">mk/defaults/mk.conf</code>,
                   10581:             control this behaviour: <code class=
                   10582:             "varname">SETGIDGAME</code>, <code class=
                   10583:             "varname">GAMEDATAMODE</code>, <code class=
                   10584:             "varname">GAMEGRP</code>, <code class=
                   10585:             "varname">GAMEMODE</code>, <code class=
                   10586:             "varname">GAMEOWN</code>.</p>
1.1       grant    10587: 
                   10588:             <p>Note that per default, setgid installation of games
1.14      xtraeme  10589:             is disabled; setting <code class=
                   10590:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    10591:             variables accordingly.</p>
                   10592: 
                   10593:             <p>A package should therefor never hard code file
1.14      xtraeme  10594:             ownership or access permissions but rely on
                   10595:             <code class="varname">INSTALL_GAME</code> and
                   10596:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   10597:             these correctly.</p>
1.1       grant    10598:           </div>
                   10599: 
                   10600:           <div class="sect2" lang="en" xml:lang="en">
                   10601:             <div class="titlepage">
                   10602:               <div>
                   10603:                 <div>
1.30    ! wiz      10604:                   <h3 class="title"><a name="login-shells" id=
        !          10605:                   "login-shells"></a>13.5.6.&nbsp;Packages
        !          10606:                   providing login shells</h3>
1.1       grant    10607:                 </div>
                   10608:               </div>
                   10609:             </div>
                   10610: 
                   10611:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  10612:             shell, the variable <code class=
                   10613:             "varname">PKG_SHELL</code> should contain the full
                   10614:             pathname of the shell executable installed by this
                   10615:             package. The package <code class=
                   10616:             "filename">Makefile</code> must also set <code class=
                   10617:             "varname">USE_PKGINSTALL=YES</code> to use the
                   10618:             automatically generated <code class=
                   10619:             "filename">INSTALL</code>/<code class=
                   10620:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    10621: 
                   10622:             <p>An example taken from shells/zsh:</p>
                   10623:             <pre class="programlisting">
                   10624:   USE_PKGINSTALL=   YES
                   10625:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   10626: </pre>
                   10627: 
1.14      xtraeme  10628:             <p>The shell is registered into <code class=
                   10629:             "filename">/etc/shells</code> file automatically in the
                   10630:             post-install target by the generated <code class=
                   10631:             "filename">INSTALL</code> script and removed in the
                   10632:             deinstall target by the <code class=
                   10633:             "filename">DEINSTALL</code> script.</p>
1.1       grant    10634:           </div>
                   10635: 
                   10636:           <div class="sect2" lang="en" xml:lang="en">
                   10637:             <div class="titlepage">
                   10638:               <div>
                   10639:                 <div>
1.30    ! wiz      10640:                   <h3 class="title"><a name="perl-scripts" id=
        !          10641:                   "perl-scripts"></a>13.5.7.&nbsp;Packages
        !          10642:                   containing perl scripts</h3>
1.1       grant    10643:                 </div>
                   10644:               </div>
                   10645:             </div>
                   10646: 
                   10647:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  10648:             set <code class="varname">REPLACE_PERL</code> to ensure
                   10649:             that the proper interpreter path is set. <code class=
                   10650:             "varname">REPLACE_PERL</code> should contain a list of
                   10651:             scripts, relative to <code class=
                   10652:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    10653:           </div>
                   10654: 
                   10655:           <div class="sect2" lang="en" xml:lang="en">
                   10656:             <div class="titlepage">
                   10657:               <div>
                   10658:                 <div>
1.30    ! wiz      10659:                   <h3 class="title"><a name="hardcoded-paths" id=
        !          10660:                   "hardcoded-paths"></a>13.5.8.&nbsp;Packages with
1.1       grant    10661:                   hardcoded paths to other interpreters</h3>
                   10662:                 </div>
                   10663:               </div>
                   10664:             </div>
                   10665: 
                   10666:             <p>Your package may also contain scripts with hardcoded
                   10667:             paths to other interpreters besides (or as well as)
                   10668:             perl. To correct the full pathname to the script
                   10669:             interpreter, you need to set the following definitions
1.14      xtraeme  10670:             in your <code class="filename">Makefile</code> (we
                   10671:             shall use <span><strong class=
                   10672:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    10673:             <pre class="programlisting">
                   10674:   REPLACE_INTERPRETER+=     tcl
                   10675:     _REPLACE.tcl.old=     .*/bin/tclsh
                   10676:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   10677:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   10678:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   10679: </pre>
                   10680:           </div>
                   10681: 
                   10682:           <div class="sect2" lang="en" xml:lang="en">
                   10683:             <div class="titlepage">
                   10684:               <div>
                   10685:                 <div>
1.30    ! wiz      10686:                   <h3 class="title"><a name="perl-modules" id=
        !          10687:                   "perl-modules"></a>13.5.9.&nbsp;Packages
        !          10688:                   installing perl modules</h3>
1.1       grant    10689:                 </div>
                   10690:               </div>
                   10691:             </div>
                   10692: 
                   10693:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  10694:             include the Makefile fragment <code class=
                   10695:             "filename">../../lang/perl5/module.mk</code>. It
                   10696:             provides a <span><strong class=
                   10697:             "command">do-configure</strong></span> target for the
                   10698:             standard perl configuration for such modules as well as
                   10699:             various hooks to tune this configuration. See comments
                   10700:             in this file for details.</p>
1.1       grant    10701: 
                   10702:             <p>Perl5 modules will install into different places
                   10703:             depending on the version of perl used during the build
                   10704:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  10705:             the <code class="filename">PLIST</code> corresponding
                   10706:             to the files listed in the installed <code class=
                   10707:             "filename">.packlist</code> file generated by most
                   10708:             perl5 modules. This is invoked by defining <code class=
                   10709:             "varname">PERL5_PACKLIST</code> to a space-separated
                   10710:             list of paths to packlist files, e.g.:</p>
1.1       grant    10711:             <pre class="programlisting">
                   10712: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   10713: </pre>
                   10714: 
1.14      xtraeme  10715:             <p>The variables <code class=
                   10716:             "varname">PERL5_SITELIB</code>, <code class=
                   10717:             "varname">PERL5_SITEARCH</code>, and <code class=
                   10718:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    10719:             locations in which perl5 modules may be installed, and
                   10720:             may be used by perl5 packages that don't have a
                   10721:             packlist. These three variables are also substituted
1.14      xtraeme  10722:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    10723:           </div>
                   10724: 
                   10725:           <div class="sect2" lang="en" xml:lang="en">
                   10726:             <div class="titlepage">
                   10727:               <div>
                   10728:                 <div>
                   10729:                   <h3 class="title"><a name="faq.info-files" id=
1.25      rillig   10730:                   "faq.info-files"></a>13.5.10.&nbsp;Packages
1.1       grant    10731:                   installing info files</h3>
                   10732:                 </div>
                   10733:               </div>
                   10734:             </div>
                   10735: 
                   10736:             <p>Some packages install info files or use the
                   10737:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   10738:             &#8220;<span class="quote">install-info</span>&#8221;
                   10739:             commands. Each of the info files:</p>
                   10740: 
                   10741:             <div class="itemizedlist">
                   10742:               <ul type="disc">
                   10743:                 <li>
                   10744:                   <p>is considered to be installed in the directory
1.14      xtraeme  10745:                   <code class=
                   10746:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    10747:                 </li>
                   10748: 
                   10749:                 <li>
                   10750:                   <p>is registered in the Info directory file
1.14      xtraeme  10751:                   <code class=
                   10752:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    10753:                 </li>
                   10754: 
                   10755:                 <li>
                   10756:                   <p>and must be listed as a filename in the
1.14      xtraeme  10757:                   <code class="varname">INFO_FILES</code> variable
                   10758:                   in the package Makefile.</p>
1.1       grant    10759:                 </li>
                   10760:               </ul>
                   10761:             </div>
                   10762: 
1.14      xtraeme  10763:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    10764:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  10765:             be overridden in the package Makefile. <code class=
                   10766:             "filename">INSTALL</code> and <code class=
                   10767:             "filename">DEINSTALL</code> scripts will be generated
                   10768:             to handle registration of the info files in the Info
1.1       grant    10769:             directory file. The &#8220;<span class=
                   10770:             "quote">install-info</span>&#8221; command used for the
                   10771:             info files registration is either provided by the
                   10772:             system, or by a special purpose package automatically
                   10773:             added as dependency if needed.</p>
                   10774: 
                   10775:             <p>A package which needs the &#8220;<span class=
                   10776:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  10777:             must define the variable <code class=
                   10778:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    10779:             minimum version of the &#8220;<span class=
                   10780:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  10781:             should be noted with the <code class=
                   10782:             "varname">TEXINFO_REQD</code> variable in the package
                   10783:             <code class="filename">Makefile</code>. By default, a
1.1       grant    10784:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  10785:             not provide a <span><strong class=
                   10786:             "command">makeinfo</strong></span> command or if it
                   10787:             does not match the required minimum, a build dependency
                   10788:             on the <a xmlns=
                   10789:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10790:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      10791:             class="pkgname">devel/gtexinfo</a> package will be
                   10792:             added automatically.</p>
1.1       grant    10793: 
                   10794:             <p>The build and installation process of the software
                   10795:             provided by the package should not use the
1.14      xtraeme  10796:             <span><strong class=
                   10797:             "command">install-info</strong></span> command as the
                   10798:             registration of info files is the task of the package
                   10799:             <code class="filename">INSTALL</code> script, and it
                   10800:             must use the appropriate <span><strong class=
                   10801:             "command">makeinfo</strong></span> command.</p>
1.1       grant    10802: 
                   10803:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  10804:             creates overriding scripts for the <span><strong class=
                   10805:             "command">install-info</strong></span> and
                   10806:             <span><strong class="command">makeinfo</strong></span>
                   10807:             commands in a directory listed early in <code class=
                   10808:             "varname">PATH</code>.</p>
1.1       grant    10809: 
1.14      xtraeme  10810:             <p>The script overriding <span><strong class=
                   10811:             "command">install-info</strong></span> has no effect
                   10812:             except the logging of a message. The script overriding
                   10813:             <span><strong class="command">makeinfo</strong></span>
                   10814:             logs a message and according to the value of
                   10815:             <code class="varname">USE_MAKEINFO</code> and
                   10816:             <code class="varname">TEXINFO_REQD</code> either run
                   10817:             the appropriate <span><strong class=
                   10818:             "command">makeinfo</strong></span> command or exit on
                   10819:             error.</p>
1.1       grant    10820:           </div>
                   10821: 
                   10822:           <div class="sect2" lang="en" xml:lang="en">
                   10823:             <div class="titlepage">
                   10824:               <div>
                   10825:                 <div>
1.30    ! wiz      10826:                   <h3 class="title"><a name="gconf2-data-files" id=
        !          10827:                   "gconf2-data-files"></a>13.5.11.&nbsp;Packages
        !          10828:                   installing GConf2 data files</h3>
1.1       grant    10829:                 </div>
                   10830:               </div>
                   10831:             </div>
                   10832: 
1.14      xtraeme  10833:             <p>If a package installs <code class=
                   10834:             "filename">.schemas</code> or <code class=
                   10835:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    10836:             need to take some extra steps to make sure they get
                   10837:             registered in the database:</p>
                   10838: 
                   10839:             <div class="orderedlist">
                   10840:               <ol type="1">
                   10841:                 <li>
1.14      xtraeme  10842:                   <p>Include <code class=
                   10843:                   "filename">../../devel/GConf2/schemas.mk</code>
                   10844:                   instead of its <code class=
                   10845:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10846:                   care of rebuilding the GConf2 database at
                   10847:                   installation and deinstallation time, and tells
                   10848:                   the package where to install GConf2 data files
                   10849:                   using some standard configure arguments. It also
                   10850:                   disallows any access to the database directly
                   10851:                   from the package.</p>
                   10852:                 </li>
                   10853: 
                   10854:                 <li>
                   10855:                   <p>Ensure that the package installs its
1.14      xtraeme  10856:                   <code class="filename">.schemas</code> files
                   10857:                   under <code class=
                   10858:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   10859:                   If they get installed under <code class=
                   10860:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    10861:                   manually patch the package.</p>
                   10862:                 </li>
                   10863: 
                   10864:                 <li>
                   10865:                   <p>Check the PLIST and remove any entries under
                   10866:                   the etc/gconf directory, as they will be handled
                   10867:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  10868:                   "6.14.&nbsp;Configuration files handling and placement">
                   10869:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    10870:                   handling and placement&#8221;</a> for more
                   10871:                   information.</p>
                   10872:                 </li>
                   10873: 
                   10874:                 <li>
1.14      xtraeme  10875:                   <p>Define the <code class=
                   10876:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   10877:                   <code class="filename">Makefile</code> with a
                   10878:                   list of all <code class=
                   10879:                   "filename">.schemas</code> files installed by the
                   10880:                   package, if any. Names must not contain any
                   10881:                   directories in them.</p>
1.1       grant    10882:                 </li>
                   10883: 
                   10884:                 <li>
1.14      xtraeme  10885:                   <p>Define the <code class=
                   10886:                   "varname">GCONF2_ENTRIES</code> variable in your
                   10887:                   <code class="filename">Makefile</code> with a
                   10888:                   list of all <code class=
                   10889:                   "filename">.entries</code> files installed by the
                   10890:                   package, if any. Names must not contain any
                   10891:                   directories in them.</p>
1.1       grant    10892:                 </li>
                   10893:               </ol>
                   10894:             </div>
                   10895:           </div>
                   10896: 
                   10897:           <div class="sect2" lang="en" xml:lang="en">
                   10898:             <div class="titlepage">
                   10899:               <div>
                   10900:                 <div>
1.30    ! wiz      10901:                   <h3 class="title"><a name=
        !          10902:                   "scrollkeeper-data-files" id=
        !          10903:                   "scrollkeeper-data-files"></a>13.5.12.&nbsp;Packages
        !          10904:                   installing scrollkeeper data files</h3>
1.1       grant    10905:                 </div>
                   10906:               </div>
                   10907:             </div>
                   10908: 
1.14      xtraeme  10909:             <p>If a package installs <code class=
                   10910:             "filename">.omf</code> files, used by scrollkeeper, you
                   10911:             need to take some extra steps to make sure they get
                   10912:             registered in the database:</p>
1.1       grant    10913: 
                   10914:             <div class="orderedlist">
                   10915:               <ol type="1">
                   10916:                 <li>
1.14      xtraeme  10917:                   <p>Include <code class=
                   10918:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   10919:                   instead of its <code class=
                   10920:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10921:                   care of rebuilding the scrollkeeper database at
                   10922:                   installation and deinstallation time, and
                   10923:                   disallows any access to it directly from the
                   10924:                   package.</p>
                   10925:                 </li>
                   10926: 
                   10927:                 <li>
                   10928:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10929:                   the <code class=
                   10930:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    10931:                   as they will be handled automatically.</p>
                   10932:                 </li>
                   10933: 
                   10934:                 <li>
1.14      xtraeme  10935:                   <p>Remove the <code class=
                   10936:                   "filename">share/omf</code> directory from the
                   10937:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    10938:                 </li>
                   10939:               </ol>
                   10940:             </div>
                   10941:           </div>
                   10942: 
                   10943:           <div class="sect2" lang="en" xml:lang="en">
                   10944:             <div class="titlepage">
                   10945:               <div>
                   10946:                 <div>
1.30    ! wiz      10947:                   <h3 class="title"><a name="x11-fonts" id=
        !          10948:                   "x11-fonts"></a>13.5.13.&nbsp;Packages installing
1.1       grant    10949:                   X11 fonts</h3>
                   10950:                 </div>
                   10951:               </div>
                   10952:             </div>
                   10953: 
                   10954:             <p>If a package installs font files, you will need to
                   10955:             rebuild the fonts database in the directory where they
                   10956:             get installed at installation and deinstallation time.
1.14      xtraeme  10957:             This can be automatically done by using <code class=
                   10958:             "filename">mk/fonts.mk</code>, which you need to
                   10959:             include in your <code class=
                   10960:             "filename">Makefile</code>.</p>
1.1       grant    10961: 
                   10962:             <p>When the file is included, you can list the
1.14      xtraeme  10963:             directories where fonts are installed in the
                   10964:             <code class="varname">FONTS_<em class=
                   10965:             "replaceable"><code>type</code></em>_DIRS</code>
                   10966:             variables, where <em class=
                   10967:             "replaceable"><code>type</code></em> can be one of
                   10968:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    10969:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   10970:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  10971:             sure that the database file <code class=
                   10972:             "filename">fonts.dir</code> is not listed in the
1.1       grant    10973:             PLIST.</p>
                   10974: 
                   10975:             <p>Note that you should not create new directories for
                   10976:             fonts; instead use the standard ones to avoid that the
                   10977:             user needs to manually configure his X server to find
                   10978:             them.</p>
                   10979:           </div>
                   10980: 
                   10981:           <div class="sect2" lang="en" xml:lang="en">
                   10982:             <div class="titlepage">
                   10983:               <div>
                   10984:                 <div>
1.30    ! wiz      10985:                   <h3 class="title"><a name="gtk2-modules" id=
        !          10986:                   "gtk2-modules"></a>13.5.14.&nbsp;Packages
        !          10987:                   installing GTK2 modules</h3>
1.1       grant    10988:                 </div>
                   10989:               </div>
                   10990:             </div>
                   10991: 
                   10992:             <p>If a package installs gtk2 immodules or loaders, you
                   10993:             need to take some extra steps to get them registered in
                   10994:             the GTK2 database properly:</p>
                   10995: 
                   10996:             <div class="orderedlist">
                   10997:               <ol type="1">
                   10998:                 <li>
1.14      xtraeme  10999:                   <p>Include <code class=
                   11000:                   "filename">../../x11/gtk2/modules.mk</code>
                   11001:                   instead of its <code class=
                   11002:                   "filename">buildlink3.mk</code> file. This takes
                   11003:                   care of rebuilding the database at installation
                   11004:                   and deinstallation time.</p>
1.1       grant    11005:                 </li>
                   11006: 
                   11007:                 <li>
1.14      xtraeme  11008:                   <p>Set <code class=
                   11009:                   "varname">GTK2_IMMODULES=YES</code> if your
                   11010:                   package installs GTK2 immodules.</p>
1.1       grant    11011:                 </li>
                   11012: 
                   11013:                 <li>
1.14      xtraeme  11014:                   <p>Set <code class=
                   11015:                   "varname">GTK2_LOADERS=YES</code> if your package
                   11016:                   installs GTK2 loaders.</p>
1.1       grant    11017:                 </li>
                   11018: 
                   11019:                 <li>
                   11020:                   <p>Patch the package to not touch any of the gtk2
                   11021:                   databases directly. These are:</p>
                   11022: 
                   11023:                   <div class="itemizedlist">
                   11024:                     <ul type="disc">
                   11025:                       <li>
1.14      xtraeme  11026:                         <p><code class=
                   11027:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    11028:                       </li>
                   11029: 
                   11030:                       <li>
1.14      xtraeme  11031:                         <p><code class=
                   11032:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    11033:                       </li>
                   11034:                     </ul>
                   11035:                   </div>
                   11036:                 </li>
                   11037: 
                   11038:                 <li>
                   11039:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11040:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    11041:                   directory, as they will be handled
                   11042:                   automatically.</p>
                   11043:                 </li>
                   11044:               </ol>
                   11045:             </div>
                   11046:           </div>
                   11047: 
                   11048:           <div class="sect2" lang="en" xml:lang="en">
                   11049:             <div class="titlepage">
                   11050:               <div>
                   11051:                 <div>
1.30    ! wiz      11052:                   <h3 class="title"><a name="sgml-xml-data" id=
        !          11053:                   "sgml-xml-data"></a>13.5.15.&nbsp;Packages
        !          11054:                   installing SGML or XML data</h3>
1.1       grant    11055:                 </div>
                   11056:               </div>
                   11057:             </div>
                   11058: 
                   11059:             <p>If a package installs SGML or XML data files that
                   11060:             need to be registered in system-wide catalogs (like
                   11061:             DTDs, sub-catalogs, etc.), you need to take some extra
                   11062:             steps:</p>
                   11063: 
                   11064:             <div class="orderedlist">
                   11065:               <ol type="1">
                   11066:                 <li>
1.14      xtraeme  11067:                   <p>Include <code class=
                   11068:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   11069:                   in your <code class="filename">Makefile</code>,
                   11070:                   which takes care of registering those files in
1.1       grant    11071:                   system-wide catalogs at installation and
                   11072:                   deinstallation time.</p>
                   11073:                 </li>
                   11074: 
                   11075:                 <li>
1.14      xtraeme  11076:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   11077:                   to the full path of any SGML catalogs installed
                   11078:                   by the package.</p>
1.1       grant    11079:                 </li>
                   11080: 
                   11081:                 <li>
1.14      xtraeme  11082:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   11083:                   to the full path of any XML catalogs installed by
1.1       grant    11084:                   the package.</p>
                   11085:                 </li>
                   11086: 
                   11087:                 <li>
1.14      xtraeme  11088:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   11089:                   to individual entries to be added to the SGML
1.1       grant    11090:                   catalog. These come in groups of three strings;
                   11091:                   see xmlcatmgr(1) for more information
                   11092:                   (specifically, arguments recognized by the 'add'
                   11093:                   action). Note that you will normally not use this
                   11094:                   variable.</p>
                   11095:                 </li>
                   11096: 
                   11097:                 <li>
1.14      xtraeme  11098:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   11099:                   to individual entries to be added to the XML
1.1       grant    11100:                   catalog. These come in groups of three strings;
                   11101:                   see xmlcatmgr(1) for more information
                   11102:                   (specifically, arguments recognized by the 'add'
                   11103:                   action). Note that you will normally not use this
                   11104:                   variable.</p>
                   11105:                 </li>
                   11106:               </ol>
                   11107:             </div>
                   11108:           </div>
                   11109: 
                   11110:           <div class="sect2" lang="en" xml:lang="en">
                   11111:             <div class="titlepage">
                   11112:               <div>
                   11113:                 <div>
1.30    ! wiz      11114:                   <h3 class="title"><a name="mime-database" id=
        !          11115:                   "mime-database"></a>13.5.16.&nbsp;Packages
        !          11116:                   installing extensions to the MIME database</h3>
1.1       grant    11117:                 </div>
                   11118:               </div>
                   11119:             </div>
                   11120: 
                   11121:             <p>If a package provides extensions to the MIME
1.14      xtraeme  11122:             database by installing <code class=
                   11123:             "filename">.xml</code> files inside <code class=
                   11124:             "filename">${PREFIX}/share/mime/packages</code>, you
                   11125:             need to take some extra steps to ensure that the
                   11126:             database is kept consistent with respect to these new
                   11127:             files:</p>
1.1       grant    11128: 
                   11129:             <div class="orderedlist">
                   11130:               <ol type="1">
                   11131:                 <li>
1.14      xtraeme  11132:                   <p>Include <code class=
                   11133:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   11134:                   (avoid using the <code class=
                   11135:                   "filename">buildlink3.mk</code> file from this
                   11136:                   same directory, which is reserved for inclusion
                   11137:                   from other <code class=
                   11138:                   "filename">buildlink3.mk</code> files). It takes
                   11139:                   care of rebuilding the MIME database at
                   11140:                   installation and deinstallation time, and
                   11141:                   disallows any access to it directly from the
1.1       grant    11142:                   package.</p>
                   11143:                 </li>
                   11144: 
                   11145:                 <li>
                   11146:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  11147:                   the <code class="filename">share/mime</code>
1.1       grant    11148:                   directory, <span class=
                   11149:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  11150:                   under <code class=
                   11151:                   "filename">share/mime/packages</code>. The former
1.1       grant    11152:                   are handled automatically by the
                   11153:                   update-mime-database program, but the later are
                   11154:                   package-dependent and must be removed by the
                   11155:                   package that installed them in the first
                   11156:                   place.</p>
                   11157:                 </li>
                   11158: 
                   11159:                 <li>
1.14      xtraeme  11160:                   <p>Remove any <code class=
                   11161:                   "filename">share/mime/*</code> directories from
                   11162:                   the PLIST. They will be handled by the
1.1       grant    11163:                   shared-mime-info package.</p>
                   11164:                 </li>
                   11165:               </ol>
                   11166:             </div>
                   11167:           </div>
                   11168: 
                   11169:           <div class="sect2" lang="en" xml:lang="en">
                   11170:             <div class="titlepage">
                   11171:               <div>
                   11172:                 <div>
1.30    ! wiz      11173:                   <h3 class="title"><a name="intltool" id=
        !          11174:                   "intltool"></a>13.5.17.&nbsp;Packages using
1.1       grant    11175:                   intltool</h3>
                   11176:                 </div>
                   11177:               </div>
                   11178:             </div>
                   11179: 
                   11180:             <p>If a package uses intltool during its build, include
1.14      xtraeme  11181:             the <code class=
                   11182:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    11183:             file, which forces it to use the intltool package
                   11184:             provided by pkgsrc, instead of the one bundled with the
                   11185:             distribution file.</p>
                   11186: 
                   11187:             <p>This tracks intltool's build-time dependencies and
                   11188:             uses the latest available version; this way, the
                   11189:             package benefits of any bug fixes that may have
                   11190:             appeared since it was released.</p>
                   11191:           </div>
1.18      xtraeme  11192: 
                   11193:           <div class="sect2" lang="en" xml:lang="en">
                   11194:             <div class="titlepage">
                   11195:               <div>
                   11196:                 <div>
1.30    ! wiz      11197:                   <h3 class="title"><a name="startup-scripts" id=
        !          11198:                   "startup-scripts"></a>13.5.18.&nbsp;Packages
        !          11199:                   installing startup scripts</h3>
1.18      xtraeme  11200:                 </div>
                   11201:               </div>
                   11202:             </div>
                   11203: 
                   11204:             <p>If a package contains a rc.d script, it won't be
                   11205:             copied into the startup directory by default, but you
                   11206:             can enable it, by adding the option <code class=
                   11207:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   11208:             "filename">/etc/mk.conf</code>. This option will copy
                   11209:             the scripts into <code class=
                   11210:             "filename">/etc/rc.d</code> when a package is
                   11211:             installed, and it will automatically remove the scripts
                   11212:             when the package is deinstalled.</p>
                   11213:           </div>
1.1       grant    11214:         </div>
                   11215: 
                   11216:         <div class="sect1" lang="en" xml:lang="en">
                   11217:           <div class="titlepage">
                   11218:             <div>
                   11219:               <div>
                   11220:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11221:                 "feedback-to-author" id=
        !          11222:                 "feedback-to-author"></a>13.6.&nbsp;Feedback to the
        !          11223:                 author</h2>
1.1       grant    11224:               </div>
                   11225:             </div>
                   11226:           </div>
                   11227: 
                   11228:           <p>If you have found any bugs in the package you make
                   11229:           available, if you had to do special steps to make it run
                   11230:           under NetBSD or if you enhanced the software in various
                   11231:           other ways, be sure to report these changes back to the
                   11232:           original author of the program! With that kind of
                   11233:           support, the next release of the program can incorporate
                   11234:           these fixes, and people not using the NetBSD packages
                   11235:           system can win from your efforts.</p>
                   11236: 
                   11237:           <p>Support the idea of free software!</p>
                   11238:         </div>
                   11239:       </div>
                   11240: 
                   11241:       <div class="chapter" lang="en" xml:lang="en">
                   11242:         <div class="titlepage">
                   11243:           <div>
                   11244:             <div>
                   11245:               <h2 class="title"><a name="debug" id=
1.25      rillig   11246:               "debug"></a>Chapter&nbsp;14.&nbsp;Debugging</h2>
1.1       grant    11247:             </div>
                   11248:           </div>
                   11249:         </div>
                   11250: 
                   11251:         <p>To check out all the gotchas when building a package,
                   11252:         here are the steps that I do in order to get a package
                   11253:         working. Please note this is basically the same as what was
                   11254:         explained in the previous sections, only with some
                   11255:         debugging aids.</p>
                   11256: 
                   11257:         <div class="itemizedlist">
                   11258:           <ul type="disc">
                   11259:             <li>
1.14      xtraeme  11260:               <p>Be sure to set <code class=
                   11261:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   11262:               "filename">/etc/mk.conf</code></p>
1.1       grant    11263:             </li>
                   11264: 
                   11265:             <li>
                   11266:               <p>Install <a xmlns=
                   11267:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11268:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      11269:               class="pkgname">pkgtools/url2pkg</a>, create a
                   11270:               directory for a new package, change into it, then run
                   11271:               <span><strong class=
                   11272:               "command">url2pkg</strong></span>:</p>
1.1       grant    11273:               <pre class="screen">
1.14      xtraeme  11274: <code class="prompt">%</code> <strong class=
                   11275: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   11276: "replaceable"><code>category</code></em>/<em class=
                   11277: "replaceable"><code>examplepkg</code></em></code></strong>
                   11278: <code class="prompt">%</code> <strong class=
                   11279: "userinput"><code>cd /usr/pkgsrc/<em class=
                   11280: "replaceable"><code>category</code></em>/<em class=
                   11281: "replaceable"><code>examplepkg</code></em></code></strong>
                   11282: <code class="prompt">%</code> <strong class=
                   11283: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    11284: </pre>
                   11285:             </li>
                   11286: 
                   11287:             <li>
1.14      xtraeme  11288:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    11289:               requested.</p>
                   11290:             </li>
                   11291: 
                   11292:             <li>
1.14      xtraeme  11293:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    11294:               file</p>
                   11295:             </li>
                   11296: 
                   11297:             <li>
1.14      xtraeme  11298:               <p>Run <span><strong class="command">make
                   11299:               configure</strong></span></p>
1.1       grant    11300:             </li>
                   11301: 
                   11302:             <li>
                   11303:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  11304:               and the configure step to the package's <code class=
                   11305:               "filename">Makefile</code>.</p>
1.1       grant    11306:             </li>
                   11307: 
                   11308:             <li>
                   11309:               <p>Make the package compile, doing multiple rounds
                   11310:               of</p>
                   11311:               <pre class="screen">
1.14      xtraeme  11312: <code class="prompt">%</code> <strong class=
                   11313: "userinput"><code>make</code></strong>
                   11314: <code class="prompt">%</code> <strong class=
                   11315: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   11316: <code class="prompt">%</code> <strong class=
                   11317: "userinput"><code>mkpatches</code></strong>
                   11318: <code class="prompt">%</code> <strong class=
                   11319: "userinput"><code>patchdiff</code></strong>
                   11320: <code class="prompt">%</code> <strong class=
                   11321: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   11322: <code class="prompt">%</code> <strong class=
                   11323: "userinput"><code>make mps</code></strong>
                   11324: <code class="prompt">%</code> <strong class=
                   11325: "userinput"><code>make clean</code></strong>
1.1       grant    11326: </pre>
                   11327: 
                   11328:               <p>Doing as non-root user will ensure that no files
                   11329:               are modified that shouldn't be, especially during the
1.14      xtraeme  11330:               build phase. <span><strong class=
                   11331:               "command">mkpatches</strong></span>,
                   11332:               <span><strong class=
                   11333:               "command">patchdiff</strong></span> and
                   11334:               <span><strong class="command">pkgvi</strong></span>
                   11335:               are from the <a xmlns=
1.1       grant    11336:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11337:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      11338:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    11339:             </li>
                   11340: 
                   11341:             <li>
1.14      xtraeme  11342:               <p>Look at the <code class=
                   11343:               "filename">Makefile</code>, fix if necessary; see
                   11344:               <a href="#components.Makefile" title=
1.27      rillig   11345:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
1.14      xtraeme  11346:               &#8220;<code class=
                   11347:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    11348:             </li>
                   11349: 
                   11350:             <li>
1.14      xtraeme  11351:               <p>Generate a <code class=
                   11352:               "filename">PLIST</code>:</p>
1.1       grant    11353:               <pre class="screen">
1.14      xtraeme  11354: <code class="prompt">#</code> <strong class=
                   11355: "userinput"><code>make install</code></strong>
                   11356: <code class="prompt">#</code> <strong class=
                   11357: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   11358: <code class="prompt">#</code> <strong class=
                   11359: "userinput"><code>make deinstall</code></strong>
                   11360: <code class="prompt">#</code> <strong class=
                   11361: "userinput"><code>make install</code></strong>
                   11362: <code class="prompt">#</code> <strong class=
                   11363: "userinput"><code>make deinstall</code></strong>
1.1       grant    11364: </pre>
                   11365: 
1.14      xtraeme  11366:               <p>You usually need to be <code class=
                   11367:               "username">root</code> to do this. Look if there are
1.1       grant    11368:               any files left:</p>
                   11369:               <pre class="screen">
1.14      xtraeme  11370: <code class="prompt">#</code> <strong class=
                   11371: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11372: </pre>
                   11373: 
                   11374:               <p>If this reveals any files that are missing in
1.14      xtraeme  11375:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    11376:             </li>
                   11377: 
                   11378:             <li>
1.14      xtraeme  11379:               <p>Now that the <code class="filename">PLIST</code>
                   11380:               is OK, install the package again and make a binary
1.1       grant    11381:               package:</p>
                   11382:               <pre class="screen">
1.14      xtraeme  11383: <code class="prompt">#</code> <strong class=
                   11384: "userinput"><code>make reinstall</code></strong>
                   11385: <code class="prompt">#</code> <strong class=
                   11386: "userinput"><code>make package</code></strong>
1.1       grant    11387: </pre>
                   11388:             </li>
                   11389: 
                   11390:             <li>
                   11391:               <p>Delete the installed package:</p>
                   11392:               <pre class="screen">
1.14      xtraeme  11393: <code class="prompt">#</code> <strong class=
                   11394: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    11395: </pre>
                   11396:             </li>
                   11397: 
                   11398:             <li>
1.14      xtraeme  11399:               <p>Repeat the above <span><strong class=
                   11400:               "command">make print-PLIST</strong></span> command,
                   11401:               which shouldn't find anything now:</p>
1.1       grant    11402:               <pre class="screen">
1.14      xtraeme  11403: <code class="prompt">#</code> <strong class=
                   11404: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11405: </pre>
                   11406:             </li>
                   11407: 
                   11408:             <li>
                   11409:               <p>Reinstall the binary package:</p>
                   11410:               <pre class="screen">
1.14      xtraeme  11411: <code class="prompt">#</code> <strong class=
                   11412: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    11413: </pre>
                   11414:             </li>
                   11415: 
                   11416:             <li>
                   11417:               <p>Play with it. Make sure everything works.</p>
                   11418:             </li>
                   11419: 
                   11420:             <li>
1.14      xtraeme  11421:               <p>Run <span><strong class=
                   11422:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    11423:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11424:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11425:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   11426:               problems it reports:</p>
1.1       grant    11427:               <pre class="screen">
1.14      xtraeme  11428: <code class="prompt">#</code> <strong class=
                   11429: "userinput"><code>pkglint</code></strong>
1.1       grant    11430: </pre>
                   11431:             </li>
                   11432: 
                   11433:             <li>
                   11434:               <p>Submit (or commit, if you have cvs access); see
                   11435:               <a href="#submit" title=
1.25      rillig   11436:               "Chapter&nbsp;15.&nbsp;Submitting and Committing">Chapter&nbsp;15,
1.1       grant    11437:               <i>Submitting and Committing</i></a>.</p>
                   11438:             </li>
                   11439:           </ul>
                   11440:         </div>
                   11441:       </div>
                   11442: 
                   11443:       <div class="chapter" lang="en" xml:lang="en">
                   11444:         <div class="titlepage">
                   11445:           <div>
                   11446:             <div>
                   11447:               <h2 class="title"><a name="submit" id=
1.25      rillig   11448:               "submit"></a>Chapter&nbsp;15.&nbsp;Submitting and
1.1       grant    11449:               Committing</h2>
                   11450:             </div>
                   11451:           </div>
                   11452:         </div>
                   11453: 
                   11454:         <div class="toc">
                   11455:           <p><b>Table of Contents</b></p>
                   11456: 
                   11457:           <dl>
1.30    ! wiz      11458:             <dt><span class="sect1"><a href=
        !          11459:             "#submitting-your-package">15.1. Submitting your
        !          11460:             packages</a></span></dt>
1.1       grant    11461: 
1.30    ! wiz      11462:             <dt><span class="sect1"><a href=
        !          11463:             "#committing-importing">15.2. Committing: Importing a
        !          11464:             package into CVS</a></span></dt>
1.1       grant    11465: 
1.30    ! wiz      11466:             <dt><span class="sect1"><a href=
        !          11467:             "#updating-package">15.3. Updating a package to a newer
        !          11468:             version</a></span></dt>
1.1       grant    11469: 
1.30    ! wiz      11470:             <dt><span class="sect1"><a href="#moving-package">15.4.
1.2       hubertf  11471:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    11472:           </dl>
                   11473:         </div>
                   11474: 
                   11475:         <div class="sect1" lang="en" xml:lang="en">
                   11476:           <div class="titlepage">
                   11477:             <div>
                   11478:               <div>
                   11479:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11480:                 "submitting-your-package" id=
        !          11481:                 "submitting-your-package"></a>15.1.&nbsp;Submitting
        !          11482:                 your packages</h2>
1.1       grant    11483:               </div>
                   11484:             </div>
                   11485:           </div>
                   11486: 
                   11487:           <p>You have to separate between binary and
                   11488:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   11489:           packages here:</p>
                   11490: 
                   11491:           <div class="itemizedlist">
                   11492:             <ul type="disc">
                   11493:               <li>
                   11494:                 <p>precompiled binary packages</p>
                   11495: 
                   11496:                 <p>Our policy is that we accept binaries only from
                   11497:                 pkgsrc developers to guarantee that the packages
                   11498:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  11499:                 annoy anyone but rather to protect our users!
1.1       grant    11500:                 You're still free to put up your home-made binary
1.13      hubertf  11501:                 packages and tell the world where to get them.
                   11502:                 NetBSD developers doing bulk builds and wanting to
                   11503:                 upload them please see <a href="#bulk-upload"
                   11504:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   11505:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   11506:                 bulk build&#8221;</a>.</p>
1.1       grant    11507:               </li>
                   11508: 
                   11509:               <li>
                   11510:                 <p>packages</p>
                   11511: 
                   11512:                 <p>First, check that your package is complete,
                   11513:                 compiles and runs well; see <a href="#debug" title=
1.25      rillig   11514:                 "Chapter&nbsp;14.&nbsp;Debugging">Chapter&nbsp;14,
1.1       grant    11515:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      11516:                 Next, generate an uuencoded gzipped <a href=
                   11517:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11518:                 <span class="citerefentry"><span class=
                   11519:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    11520:                 preferably with all files in a single directory.
1.14      xtraeme  11521:                 Finally, <span><strong class=
                   11522:                 "command">send-pr</strong></span> with category
1.1       grant    11523:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   11524:                 synopsis which includes the package name and
                   11525:                 version number, a short description of your package
                   11526:                 (contents of the COMMENT variable or DESCR file are
                   11527:                 OK) and attach the archive to your PR.</p>
                   11528: 
                   11529:                 <p>If you want to submit several packages, please
                   11530:                 send a separate PR for each one, it's easier for us
                   11531:                 to track things that way.</p>
                   11532: 
                   11533:                 <p>Alternatively, you can also import new packages
                   11534:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   11535:                 work-in-progress</span>&#8221;); see the homepage
                   11536:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   11537:                 target=
                   11538:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   11539:                 details.</p>
                   11540:               </li>
                   11541:             </ul>
                   11542:           </div>
                   11543:         </div>
                   11544: 
                   11545:         <div class="sect1" lang="en" xml:lang="en">
                   11546:           <div class="titlepage">
                   11547:             <div>
                   11548:               <div>
                   11549:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11550:                 "committing-importing" id=
        !          11551:                 "committing-importing"></a>15.2.&nbsp;Committing:
        !          11552:                 Importing a package into CVS</h2>
1.1       grant    11553:               </div>
                   11554:             </div>
                   11555:           </div>
                   11556: 
                   11557:           <p>This section is only of interest for pkgsrc developers
                   11558:           with write access to the pkgsrc repository. Please
                   11559:           remember that cvs imports files relative to the current
                   11560:           working directory, and that the pathname that you give
1.14      xtraeme  11561:           the <span><strong class="command">cvs
                   11562:           import</strong></span> command is so that it knows where
                   11563:           to place the files in the repository. Newly created
                   11564:           packages should be imported with a vendor tag of
                   11565:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   11566:           release tag of &#8220;<span class=
                   11567:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    11568:           <pre class="programlisting">
                   11569:   % cd .../pkgsrc/category/pkgname
                   11570:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   11571: </pre>
                   11572: 
                   11573:           <p>Remember to move the directory from which you imported
                   11574:           out of the way, or cvs will complain the next time you
                   11575:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   11576:           source tree. Also don't forget to add the new package to
1.14      xtraeme  11577:           the category's <code class=
                   11578:           "filename">Makefile</code>.</p>
1.1       grant    11579: 
                   11580:           <p>The commit message of the initial import should
1.14      xtraeme  11581:           include part of the <code class="filename">DESCR</code>
                   11582:           file, so people reading the mailing lists know what the
                   11583:           package is/does.</p>
1.1       grant    11584: 
                   11585:           <p>Please note all package updates/additions in
1.14      xtraeme  11586:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   11587:           very important to keep this file up to date and
                   11588:           conforming to the existing format, because it will be
                   11589:           used by scripts to automatically update pages on <a href=
1.1       grant    11590:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   11591:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   11592:           file and remove the entry for the package you updated, in
                   11593:           case it was mentioned there.</p>
                   11594: 
                   11595:           <p>For new packages, &#8220;<span class="quote">cvs
                   11596:           import</span>&#8221; is preferred to &#8220;<span class=
                   11597:           "quote">cvs add</span>&#8221; because the former gets
                   11598:           everything with a single command, and provides a
                   11599:           consistent tag.</p>
                   11600:         </div>
                   11601: 
                   11602:         <div class="sect1" lang="en" xml:lang="en">
                   11603:           <div class="titlepage">
                   11604:             <div>
                   11605:               <div>
                   11606:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11607:                 "updating-package" id=
        !          11608:                 "updating-package"></a>15.3.&nbsp;Updating a
        !          11609:                 package to a newer version</h2>
1.1       grant    11610:               </div>
                   11611:             </div>
                   11612:           </div>
                   11613: 
                   11614:           <p>Please always put a concise, appropriate and relevant
                   11615:           summary of the changes between old and new versions into
                   11616:           the commit log when updating a package. There are various
                   11617:           reasons for this:</p>
                   11618: 
                   11619:           <div class="itemizedlist">
                   11620:             <ul type="disc">
                   11621:               <li>
                   11622:                 <p>A URL is volatile, and can change over time. It
                   11623:                 may go away completely or its information may be
                   11624:                 overwritten by newer information.</p>
                   11625:               </li>
                   11626: 
                   11627:               <li>
                   11628:                 <p>Having the change information between old and
                   11629:                 new versions in our CVS repository is very useful
                   11630:                 for people who use either cvs or anoncvs.</p>
                   11631:               </li>
                   11632: 
                   11633:               <li>
                   11634:                 <p>Having the change information between old and
                   11635:                 new versions in our CVS repository is very useful
                   11636:                 for people who read the pkgsrc-changes mailing
                   11637:                 list, so that they can make tactical decisions
                   11638:                 about when to upgrade the package.</p>
                   11639:               </li>
                   11640:             </ul>
                   11641:           </div>
                   11642: 
1.18      xtraeme  11643:           <p>Please also recognize that, just because a new version
1.1       grant    11644:           of a package has been released, it should not
                   11645:           automatically be upgraded in the CVS repository. We
                   11646:           prefer to be conservative in the packages that are
                   11647:           included in pkgsrc - development or beta packages are not
                   11648:           really the best thing for most places in which pkgsrc is
                   11649:           used. Please use your judgement about what should go into
                   11650:           pkgsrc, and bear in mind that stability is to be
                   11651:           preferred above new and possibly untested features.</p>
                   11652:         </div>
                   11653: 
                   11654:         <div class="sect1" lang="en" xml:lang="en">
                   11655:           <div class="titlepage">
                   11656:             <div>
                   11657:               <div>
                   11658:                 <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11659:                 "moving-package" id=
        !          11660:                 "moving-package"></a>15.4.&nbsp;Moving a package in
        !          11661:                 pkgsrc</h2>
1.1       grant    11662:               </div>
                   11663:             </div>
                   11664:           </div>
                   11665: 
                   11666:           <div class="orderedlist">
                   11667:             <ol type="1">
                   11668:               <li>
                   11669:                 <p>Make a copy of the directory somewhere else.</p>
                   11670:               </li>
                   11671: 
                   11672:               <li>
                   11673:                 <p>Remove all CVS dirs.</p>
                   11674: 
                   11675:                 <p>Alternatively to the first two steps you can
                   11676:                 also do:</p>
                   11677:                 <pre class="screen">
1.14      xtraeme  11678: <code class="prompt">%</code> <strong class=
                   11679: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    11680: </pre>
                   11681: 
                   11682:                 <p>and use that for further work.</p>
                   11683:               </li>
                   11684: 
                   11685:               <li>
1.14      xtraeme  11686:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   11687:                 any <code class="varname">DEPENDS</code> paths that
                   11688:                 just did &#8220;<span class=
1.1       grant    11689:                 "quote">../package</span>&#8221; instead of
                   11690:                 &#8220;<span class=
                   11691:                 "quote">../../category/package</span>&#8221;.</p>
                   11692:               </li>
                   11693: 
                   11694:               <li>
1.14      xtraeme  11695:                 <p><span><strong class="command">cvs
                   11696:                 import</strong></span> the modified package in the
                   11697:                 new place.</p>
1.1       grant    11698:               </li>
                   11699: 
                   11700:               <li>
                   11701:                 <p>Check if any package depends on it:</p>
                   11702:                 <pre class="screen">
1.14      xtraeme  11703: <code class="prompt">%</code> <strong class=
                   11704: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   11705: <code class="prompt">%</code> <strong class=
                   11706: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    11707: </pre>
                   11708:               </li>
                   11709: 
                   11710:               <li>
                   11711:                 <p>Fix paths in packages from step 5 to point to
                   11712:                 new location.</p>
                   11713:               </li>
                   11714: 
                   11715:               <li>
1.14      xtraeme  11716:                 <p><span><strong class="command">cvs rm
                   11717:                 (-f)</strong></span> the package at the old
                   11718:                 location.</p>
1.1       grant    11719:               </li>
                   11720: 
                   11721:               <li>
1.14      xtraeme  11722:                 <p>Remove from <code class=
                   11723:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    11724:               </li>
                   11725: 
                   11726:               <li>
1.14      xtraeme  11727:                 <p>Add to <code class=
                   11728:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    11729:               </li>
                   11730: 
                   11731:               <li>
                   11732:                 <p>Commit the changed and removed files:</p>
                   11733:                 <pre class="screen">
1.14      xtraeme  11734: <code class="prompt">%</code> <strong class=
                   11735: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    11736: </pre>
                   11737: 
                   11738:                 <p>(and any packages from step 5, of course).</p>
                   11739:               </li>
                   11740:             </ol>
                   11741:           </div>
                   11742:         </div>
                   11743:       </div>
                   11744:     </div>
                   11745: 
                   11746:     <div class="appendix" lang="en" xml:lang="en">
                   11747:       <div class="titlepage">
                   11748:         <div>
                   11749:           <div>
                   11750:             <h2 class="title"><a name="examples" id=
                   11751:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   11752:             package: bison</h2>
                   11753:           </div>
                   11754:         </div>
                   11755:       </div>
                   11756: 
                   11757:       <div class="toc">
                   11758:         <p><b>Table of Contents</b></p>
                   11759: 
                   11760:         <dl>
1.30    ! wiz      11761:           <dt><span class="sect1"><a href="#example-files">A.1.
1.1       grant    11762:           files</a></span></dt>
                   11763: 
                   11764:           <dd>
                   11765:             <dl>
1.30    ! wiz      11766:               <dt><span class="sect2"><a href=
        !          11767:               "#example-Makefile">A.1.1. Makefile</a></span></dt>
1.1       grant    11768: 
1.30    ! wiz      11769:               <dt><span class="sect2"><a href=
        !          11770:               "#example-descr">A.1.2. DESCR</a></span></dt>
1.1       grant    11771: 
1.30    ! wiz      11772:               <dt><span class="sect2"><a href=
        !          11773:               "#example-plist">A.1.3. PLIST</a></span></dt>
1.1       grant    11774: 
1.30    ! wiz      11775:               <dt><span class="sect2"><a href=
        !          11776:               "#checking-package-with-pkglint">A.1.4. Checking a
        !          11777:               package with <span><strong class=
1.14      xtraeme  11778:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    11779:             </dl>
                   11780:           </dd>
                   11781: 
1.30    ! wiz      11782:           <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2.
        !          11783:           Steps for building, installing, packaging</a></span></dt>
1.1       grant    11784:         </dl>
                   11785:       </div>
                   11786: 
                   11787:       <p>We checked to find a piece of software that wasn't in the
                   11788:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  11789:       would want to have <span><strong class=
                   11790:       "command">bison</strong></span> when Berkeley
                   11791:       <span><strong class="command">yacc</strong></span> is already
                   11792:       present in the tree is beyond us, but it's useful for the
                   11793:       purposes of this exercise.</p>
1.1       grant    11794: 
                   11795:       <div class="sect1" lang="en" xml:lang="en">
                   11796:         <div class="titlepage">
                   11797:           <div>
                   11798:             <div>
                   11799:               <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11800:               "example-files" id=
        !          11801:               "example-files"></a>A.1.&nbsp;files</h2>
1.1       grant    11802:             </div>
                   11803:           </div>
                   11804:         </div>
                   11805: 
                   11806:         <div class="sect2" lang="en" xml:lang="en">
                   11807:           <div class="titlepage">
                   11808:             <div>
                   11809:               <div>
1.30    ! wiz      11810:                 <h3 class="title"><a name="example-Makefile" id=
        !          11811:                 "example-Makefile"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    11812:               </div>
                   11813:             </div>
                   11814:           </div>
                   11815:           <pre class="programlisting">
1.17      sketch   11816: # $NetBSD$
1.1       grant    11817: #
                   11818: 
                   11819: DISTNAME=       bison-1.25
                   11820: CATEGORIES=     devel
                   11821: MASTER_SITES=   ${MASTER_SITE_GNU}
                   11822: 
                   11823: MAINTAINER=     thorpej@NetBSD.org
                   11824: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   11825: COMMENT=        GNU yacc clone
                   11826: 
                   11827: GNU_CONFIGURE=  yes
                   11828: INFO_FILES=     bison.info
                   11829: 
                   11830: .include "../../mk/bsd.pkg.mk"
                   11831: </pre>
                   11832:         </div>
                   11833: 
                   11834:         <div class="sect2" lang="en" xml:lang="en">
                   11835:           <div class="titlepage">
                   11836:             <div>
                   11837:               <div>
1.30    ! wiz      11838:                 <h3 class="title"><a name="example-descr" id=
        !          11839:                 "example-descr"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    11840:               </div>
                   11841:             </div>
                   11842:           </div>
                   11843:           <pre class="programlisting">
                   11844: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   11845: improvements.  Why you would want this when Berkeley <a href=
                   11846: "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
                   11847: of the NetBSD source tree is beyond me.
                   11848: </pre>
                   11849:         </div>
                   11850: 
                   11851:         <div class="sect2" lang="en" xml:lang="en">
                   11852:           <div class="titlepage">
                   11853:             <div>
                   11854:               <div>
1.30    ! wiz      11855:                 <h3 class="title"><a name="example-plist" id=
        !          11856:                 "example-plist"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    11857:               </div>
                   11858:             </div>
                   11859:           </div>
                   11860:           <pre class="programlisting">
1.17      sketch   11861: @comment $NetBSD$
1.1       grant    11862: bin/bison
                   11863: man/man1/bison.1.gz
                   11864: share/bison.simple
                   11865: share/bison.hairy
                   11866: </pre>
                   11867:         </div>
                   11868: 
                   11869:         <div class="sect2" lang="en" xml:lang="en">
                   11870:           <div class="titlepage">
                   11871:             <div>
                   11872:               <div>
1.30    ! wiz      11873:                 <h3 class="title"><a name=
        !          11874:                 "checking-package-with-pkglint" id=
        !          11875:                 "checking-package-with-pkglint"></a>A.1.4.&nbsp;Checking
        !          11876:                 a package with <span><strong class=
1.14      xtraeme  11877:                 "command">pkglint</strong></span></h3>
1.1       grant    11878:               </div>
                   11879:             </div>
                   11880:           </div>
                   11881: 
                   11882:           <p>The NetBSD package system comes with <a xmlns=
                   11883:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   11884:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11885:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   11886:           the contents of these files. After installation it is
                   11887:           quite easy to use, just change to the directory of the
                   11888:           package you wish to examine and execute
                   11889:           <span><strong class=
                   11890:           "command">pkglint</strong></span>:</p>
1.1       grant    11891:           <pre class="screen">
1.14      xtraeme  11892: <code class="prompt">$</code> <strong class=
                   11893: "userinput"><code>pkglint</code></strong>
1.1       grant    11894: looks fine.
                   11895: </pre>
                   11896: 
                   11897:           <p>Depending on the supplied command line arguments (see
                   11898:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  11899:           e.g. <span><strong class="command">pkglint
                   11900:           -v</strong></span> for a very verbose check.</p>
1.1       grant    11901:         </div>
                   11902:       </div>
                   11903: 
                   11904:       <div class="sect1" lang="en" xml:lang="en">
                   11905:         <div class="titlepage">
                   11906:           <div>
                   11907:             <div>
                   11908:               <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      11909:               "steps-for-b-i-p" id=
        !          11910:               "steps-for-b-i-p"></a>A.2.&nbsp;Steps for building,
        !          11911:               installing, packaging</h2>
1.1       grant    11912:             </div>
                   11913:           </div>
                   11914:         </div>
                   11915: 
                   11916:         <p>Create the directory where the package lives, plus any
                   11917:         auxiliary directories:</p>
                   11918:         <pre class="screen">
1.14      xtraeme  11919: <code class="prompt">#</code> <strong class=
                   11920: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   11921: <code class="prompt">#</code> <strong class=
                   11922: "userinput"><code>mkdir bison</code></strong>
                   11923: <code class="prompt">#</code> <strong class=
                   11924: "userinput"><code>cd bison</code></strong>
                   11925: <code class="prompt">#</code> <strong class=
                   11926: "userinput"><code>mkdir patches</code></strong>
1.1       grant    11927: </pre>
                   11928: 
1.14      xtraeme  11929:         <p>Create <code class="filename">Makefile</code>,
                   11930:         <code class="filename">DESCR</code> and <code class=
                   11931:         "filename">PLIST</code> (see <a href="#components" title=
1.27      rillig   11932:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   11933:         Chapter 7, <i>Package components - files, directories and
1.1       grant    11934:         contents</i></a>) then continue with fetching the
                   11935:         distfile:</p>
                   11936:         <pre class="screen">
1.14      xtraeme  11937: <code class="prompt">#</code> <strong class=
                   11938: "userinput"><code>make fetch</code></strong>
1.1       grant    11939: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   11940: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   11941: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11942: ftp: Error retrieving file: 500 Internal error
                   11943: 
                   11944: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   11945: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11946: ftp: Error retrieving file: 500 Internal error
                   11947: 
                   11948: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   11949: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11950: Successfully retrieved file.
                   11951: </pre>
                   11952: 
1.14      xtraeme  11953:         <p>Generate the checksum of the distfile into <code class=
                   11954:         "filename">distinfo</code>:</p>
1.1       grant    11955:         <pre class="screen">
1.14      xtraeme  11956: <code class="prompt">#</code> <strong class=
                   11957: "userinput"><code>make makesum</code></strong>
1.1       grant    11958: </pre>
                   11959: 
                   11960:         <p>Now compile:</p>
                   11961:         <pre class="screen">
1.14      xtraeme  11962: <code class="prompt">#</code> <strong class=
                   11963: "userinput"><code>make</code></strong>
1.1       grant    11964: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11965: ===&gt;  Extracting for bison-1.25
                   11966: ===&gt;  Patching for bison-1.25
                   11967: ===&gt;   Ignoring empty patch directory
                   11968: ===&gt;  Configuring for bison-1.25
                   11969: creating cache ./config.cache
                   11970: checking for gcc... cc
                   11971: checking whether we are using GNU C... yes
                   11972: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   11973: checking how to run the C preprocessor... cc -E
                   11974: checking for minix/config.h... no
                   11975: checking for POSIXized ISC... no
                   11976: checking whether cross-compiling... no
                   11977: checking for ANSI C header files... yes
                   11978: checking for string.h... yes
                   11979: checking for stdlib.h... yes
                   11980: checking for memory.h... yes
                   11981: checking for working const... yes
                   11982: checking for working alloca.h... no
                   11983: checking for alloca... yes
                   11984: checking for strerror... yes
                   11985: updating cache ./config.cache
                   11986: creating ./config.status
                   11987: creating Makefile
                   11988: ===&gt;  Building for bison-1.25
                   11989: 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
                   11990: 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
                   11991: 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
                   11992: 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
                   11993: 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
                   11994: 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 
                   11995: 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
                   11996: 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
                   11997: 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
                   11998: 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
                   11999: 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
                   12000: 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
                   12001: 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
                   12002: 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
                   12003: 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
                   12004: 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
                   12005: 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
                   12006: 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
                   12007: 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
                   12008: 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
                   12009: 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
                   12010: 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
                   12011: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   12012: rm -f bison.s1
                   12013: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   12014: </pre>
                   12015: 
                   12016:         <p>Everything seems OK, so install the files:</p>
                   12017:         <pre class="screen">
1.14      xtraeme  12018: <code class="prompt">#</code> <strong class=
                   12019: "userinput"><code>make install</code></strong>
1.1       grant    12020: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12021: ===&gt;  Installing for bison-1.25
                   12022: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   12023: rm -f /usr/pkg/bin/bison
                   12024: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   12025: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   12026: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   12027: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   12028: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   12029: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   12030: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   12031: ===&gt;  Registering installation for bison-1.25
                   12032: </pre>
                   12033: 
                   12034:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  12035:         remove it with <span><strong class="command">pkg_delete
                   12036:         bison</strong></span>. Should you decide that you want a
                   12037:         binary package, do this now:</p>
1.1       grant    12038:         <pre class="screen">
1.14      xtraeme  12039: <code class="prompt">#</code> <strong class=
                   12040: "userinput"><code>make package</code></strong>
1.1       grant    12041: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   12042: ===&gt;  Building package for bison-1.25
                   12043: Creating package bison-1.25.tgz
                   12044: Registering depends:.
                   12045: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   12046: </pre>
                   12047: 
                   12048:         <p>Now that you don't need the source and object files any
                   12049:         more, clean up:</p>
                   12050:         <pre class="screen">
1.14      xtraeme  12051: <code class="prompt">#</code> <strong class=
                   12052: "userinput"><code>make clean</code></strong>
1.1       grant    12053: ===&gt;  Cleaning for bison-1.25
                   12054: </pre>
                   12055:       </div>
                   12056:     </div>
                   12057: 
                   12058:     <div class="appendix" lang="en" xml:lang="en">
                   12059:       <div class="titlepage">
                   12060:         <div>
                   12061:           <div>
                   12062:             <h2 class="title"><a name="logs" id=
                   12063:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   12064:           </div>
                   12065:         </div>
                   12066:       </div>
                   12067: 
                   12068:       <div class="toc">
                   12069:         <p><b>Table of Contents</b></p>
                   12070: 
                   12071:         <dl>
                   12072:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   12073:           Building figlet</a></span></dt>
                   12074: 
                   12075:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   12076:           Packaging figlet</a></span></dt>
                   12077:         </dl>
                   12078:       </div>
                   12079: 
                   12080:       <div class="sect1" lang="en" xml:lang="en">
                   12081:         <div class="titlepage">
                   12082:           <div>
                   12083:             <div>
                   12084:               <h2 class="title" style="clear: both"><a name=
                   12085:               "logs.building" id=
                   12086:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   12087:             </div>
                   12088:           </div>
                   12089:         </div>
                   12090:         <pre class="screen">
1.14      xtraeme  12091: <code class="prompt">#</code> <strong class=
                   12092: "userinput"><code>make</code></strong>
1.1       grant    12093: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12094: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   12095: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   12096: =&gt; [172219 bytes]
                   12097: Connected to ftp.plig.net.
                   12098: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   12099: 331 Guest login ok, send your complete e-mail address as password.
                   12100: 230-You are user #5 of 500 simultaneous users allowed.
                   12101: 230-
                   12102: 230-  ___ _             _ _                   
                   12103: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   12104: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   12105: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   12106: 230-         |_|   |_|     |___|         |___|
                   12107: 230-
                   12108: 230-** Welcome to ftp.plig.org **
                   12109: 230-
                   12110: 230-Please note that all transfers from this FTP site are logged. If you
                   12111: 230-do not like this, please disconnect now.
                   12112: 230-
                   12113: 230-This arhive is available via
                   12114: 230-
                   12115: 230-HTTP:  http://ftp.plig.org/
                   12116: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   12117: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   12118: 230-
                   12119: 230-Please email comments, bug reports and requests for packages to be
                   12120: 230-mirrored to ftp-admin@plig.org.   
                   12121: 230-
                   12122: 230-
                   12123: 230 Logged in anonymously.
                   12124: Remote system type is UNIX.
                   12125: Using binary mode to transfer files.
                   12126: 200 Type okay.
                   12127: 250 "/pub" is new cwd.
                   12128: 250-"/pub/figlet" is new cwd.
                   12129: 250-
                   12130: 250-Welcome to the figlet archive at ftp.figlet.org
                   12131: 250-    
                   12132: 250-    ftp://ftp.figlet.org/pub/figlet/
                   12133: 250-
                   12134: 250-The official FIGlet web page is:
                   12135: 250-    http://www.figlet.org/
                   12136: 250-
                   12137: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   12138: 250-contribute a font or something else, you can email us.
                   12139: 250 
                   12140: 250 "/pub/figlet/program" is new cwd.
                   12141: 250 "/pub/figlet/program/unix" is new cwd.
                   12142: local: figlet221.tar.gz remote: figlet221.tar.gz
                   12143: 502 Unimplemented command.
                   12144: 227 Entering Passive Mode (195,40,6,41,246,104)
                   12145: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   12146: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   12147: 226 Transfer completed.
                   12148: 172219 bytes received in 00:02 (75.99 KB/s)
                   12149: 221 Goodbye.
                   12150: =&gt; Checksum OK for figlet221.tar.gz.
                   12151: ===&gt; Extracting for figlet-2.2.1nb2
                   12152: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   12153: ===&gt; Patching for figlet-2.2.1nb2
                   12154: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   12155: ===&gt; Overriding tools for figlet-2.2.1nb2
                   12156: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   12157: ===&gt; Configuring for figlet-2.2.1nb2
                   12158: ===&gt; Building for figlet-2.2.1nb2
                   12159: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   12160: chmod a+x figlet
                   12161: gcc -O2 -o chkfont chkfont.c
                   12162: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  12163: <code class="prompt">#</code>
                   12164: <code class="prompt">#</code> <strong class=
                   12165: "userinput"><code>make install</code></strong>
1.1       grant    12166: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12167: ===&gt; Installing for figlet-2.2.1nb2
                   12168: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   12169: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   12170: mkdir -p /usr/pkg/share/figlet
                   12171: cp figlet /usr/pkg/bin
                   12172: cp chkfont /usr/pkg/bin
                   12173: chmod 555 figlist showfigfonts
                   12174: cp figlist /usr/pkg/bin
                   12175: cp showfigfonts /usr/pkg/bin
                   12176: cp fonts/*.flf /usr/pkg/share/figlet
                   12177: cp fonts/*.flc /usr/pkg/share/figlet
                   12178: cp figlet.6 /usr/pkg/man/man6
                   12179: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  12180: <code class="prompt">#</code>
1.1       grant    12181: </pre>
                   12182:       </div>
                   12183: 
                   12184:       <div class="sect1" lang="en" xml:lang="en">
                   12185:         <div class="titlepage">
                   12186:           <div>
                   12187:             <div>
                   12188:               <h2 class="title" style="clear: both"><a name=
                   12189:               "logs.package" id=
                   12190:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   12191:             </div>
                   12192:           </div>
                   12193:         </div>
                   12194:         <pre class="screen">
1.14      xtraeme  12195: <code class="prompt">#</code> <strong class=
                   12196: "userinput"><code>make package</code></strong>
1.1       grant    12197: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12198: ===&gt; Packaging figlet-2.2.1nb2
                   12199: ===&gt; Building binary package for figlet-2.2.1nb2
                   12200: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   12201: Using SrcDir value of /usr/pkg
                   12202: Registering depends:.  
1.14      xtraeme  12203: <code class="prompt">#</code>
1.1       grant    12204: </pre>
                   12205:       </div>
                   12206:     </div>
                   12207: 
                   12208:     <div class="appendix" lang="en" xml:lang="en">
                   12209:       <div class="titlepage">
                   12210:         <div>
                   12211:           <div>
                   12212:             <h2 class="title"><a name="ftp-layout" id=
                   12213:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   12214:             FTP server's package archive</h2>
                   12215:           </div>
                   12216:         </div>
                   12217:       </div>
                   12218: 
                   12219:       <p>Layout for precompiled binary packages on
                   12220:       ftp.NetBSD.org:</p>
                   12221:       <pre class="programlisting">
                   12222: /pub/NetBSD/packages/
                   12223:                 distfiles/
                   12224: 
                   12225:                 # Unpacked pkgsrc trees
                   12226:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   12227:                 pkgsrc-2003Q4 -&gt; N/A
                   12228:                 pkgsrc-2004Q1/pkgsrc
                   12229: 
                   12230:                 # pkgsrc archives
                   12231:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   12232:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   12233:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   12234: 
                   12235:                 # Per pkgsrc-release/OS-release/arch package archives
                   12236:                 pkgsrc-2003Q4/
                   12237:                         NetBSD-1.6.2/
                   12238:                                 i386/
                   12239:                                         All/
                   12240:                                         archivers/
                   12241:                                                 foo -&gt; ../All/foo
                   12242:                                         ...
                   12243:                 pkgsrc-2004Q1/
                   12244:                         NetBSD-1.6.2/
                   12245:                                 i386/
                   12246:                                         All/
                   12247:                                         ...
                   12248:                         NetBSD-2.0/
                   12249:                                 i386/
                   12250:                                         All/
                   12251:                                         ...
                   12252:                         SunOS-5.9/
                   12253:                                 sparc/
                   12254:                                         All/
                   12255:                                         ...
                   12256:                                 x86/
                   12257:                                         All/
                   12258:                                         ...
                   12259: 
                   12260:                 # Per os-release package archive convenience links
                   12261:                 NetBSD-1.6.2 -&gt; 1.6.2
                   12262:                 1.6.2/
                   12263:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   12264:                         m68k/
                   12265:                                 All/
                   12266:                                 archivers/
                   12267:                                         foo -&gt; ../All/foo
                   12268:                                 ...
                   12269:                         amiga -&gt; m68k
                   12270:                         atari -&gt; m68k
                   12271:                         ...
                   12272: 
                   12273:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   12274:                 NetBSD-2.0/
                   12275:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   12276:                 SunOS-5.9/
                   12277:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   12278:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   12279:                         
                   12280: </pre>
                   12281: 
                   12282:       <p>To create:</p>
                   12283: 
                   12284:       <div class="orderedlist">
                   12285:         <ol type="1">
                   12286:           <li>
                   12287:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   12288:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   12289:             5.3, &#8220;Doing a bulk build of all
                   12290:             packages&#8221;</a></p>
                   12291:           </li>
                   12292: 
                   12293:           <li>
                   12294:             <p>Upload /usr/pkgsrc/packages to</p>
                   12295:             <pre class="programlisting">
                   12296:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  12297:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    12298:         `uname -s`-`uname -r`/                  # OS &amp; version
                   12299:         `uname -p`                              # architecture
                   12300:        
                   12301: </pre>
                   12302:           </li>
                   12303: 
                   12304:           <li>
1.14      xtraeme  12305:             <p>If necessary, create a symlink <span><strong class=
                   12306:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   12307:             (amiga -&gt; m68k, ...)</p>
1.1       grant    12308:           </li>
                   12309:         </ol>
                   12310:       </div>
                   12311:     </div>
1.2       hubertf  12312: 
                   12313:     <div class="appendix" lang="en" xml:lang="en">
                   12314:       <div class="titlepage">
                   12315:         <div>
                   12316:           <div>
                   12317:             <h2 class="title"><a name="editing" id=
                   12318:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   12319:             for the pkgsrc guide</h2>
                   12320:           </div>
                   12321:         </div>
                   12322:       </div>
                   12323: 
                   12324:       <div class="toc">
                   12325:         <p><b>Table of Contents</b></p>
                   12326: 
                   12327:         <dl>
1.30    ! wiz      12328:           <dt><span class="sect1"><a href="#targets">D.1.
1.2       hubertf  12329:           Targets</a></span></dt>
                   12330: 
1.30    ! wiz      12331:           <dt><span class="sect1"><a href="#procedure">D.2.
1.2       hubertf  12332:           Procedure</a></span></dt>
                   12333:         </dl>
                   12334:       </div>
                   12335: 
                   12336:       <p>This section contains information on editing the pkgsrc
                   12337:       guide itself.</p>
                   12338: 
                   12339:       <div class="sect1" lang="en" xml:lang="en">
                   12340:         <div class="titlepage">
                   12341:           <div>
                   12342:             <div>
                   12343:               <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      12344:               "targets" id="targets"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  12345:             </div>
                   12346:           </div>
                   12347:         </div>
                   12348: 
1.14      xtraeme  12349:         <p>The pkgsrc guide's source code is stored in <code class=
                   12350:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  12351:         are created from it:</p>
                   12352: 
                   12353:         <div class="itemizedlist">
                   12354:           <ul type="disc">
                   12355:             <li>
1.14      xtraeme  12356:               <p><code class=
1.23      wiz      12357:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  12358:             </li>
                   12359: 
                   12360:             <li>
1.14      xtraeme  12361:               <p><code class=
                   12362:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  12363:             </li>
                   12364: 
                   12365:             <li>
1.14      xtraeme  12366:               <p><code class=
                   12367:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  12368:               the documentation on the NetBSD website will be built
                   12369:               from pkgsrc and kept up to date on the web server
                   12370:               itself. This means you <span class=
                   12371:               "emphasis"><em>must</em></span> make sure that your
                   12372:               changes haven't broken the build!</p>
                   12373:             </li>
1.6       hubertf  12374: 
                   12375:             <li>
1.14      xtraeme  12376:               <p><code class=
                   12377:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  12378:               PDF version of the pkgsrc guide.</p>
                   12379:             </li>
                   12380: 
                   12381:             <li>
1.14      xtraeme  12382:               <p><code class=
                   12383:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  12384:               PostScript version of the pkgsrc guide.</p>
                   12385:             </li>
1.2       hubertf  12386:           </ul>
                   12387:         </div>
                   12388:       </div>
                   12389: 
                   12390:       <div class="sect1" lang="en" xml:lang="en">
                   12391:         <div class="titlepage">
                   12392:           <div>
                   12393:             <div>
                   12394:               <h2 class="title" style="clear: both"><a name=
1.30    ! wiz      12395:               "procedure" id=
        !          12396:               "procedure"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  12397:             </div>
                   12398:           </div>
                   12399:         </div>
                   12400: 
                   12401:         <p>The procedure to edit the pkgsrc guide is:</p>
                   12402: 
                   12403:         <div class="itemizedlist">
                   12404:           <ul type="disc">
                   12405:             <li>
1.6       hubertf  12406:               <p>Make sure you have the packages needed to
                   12407:               re-generate the pkgsrc guide (and other XML-based
                   12408:               NetBSD documentation) installed. These are
1.11      ben      12409:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  12410:               for creating the ASCII- and HTML-version, and
                   12411:               &#8220;<span class=
1.11      ben      12412:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  12413:               PostScript- and PDF version. You will need both
                   12414:               packages installed, to make sure documentation is
                   12415:               consistent across all formats. The packages can be
1.14      xtraeme  12416:               found in <code class=
                   12417:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   12418:               <code class=
                   12419:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  12420:             </li>
                   12421: 
                   12422:             <li>
1.14      xtraeme  12423:               <p>Edit the XML file(s) in <code class=
                   12424:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  12425:             </li>
                   12426: 
                   12427:             <li>
1.14      xtraeme  12428:               <p>Run <span><strong class="command">make extract
                   12429:               &amp;&amp; make do-lint</strong></span> in
                   12430:               <code class="filename">pkgsrc/doc/guide</code> to
                   12431:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  12432:             </li>
                   12433: 
                   12434:             <li>
1.14      xtraeme  12435:               <p>Run <span><strong class=
                   12436:               "command">make</strong></span> in <code class=
                   12437:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   12438:               and ASCII version.</p>
1.2       hubertf  12439:             </li>
                   12440: 
                   12441:             <li>
1.14      xtraeme  12442:               <p>If all is well, run <span><strong class=
                   12443:               "command">make install-doc</strong></span> to put the
                   12444:               generated files into <code class=
                   12445:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  12446:             </li>
                   12447: 
                   12448:             <li>
1.14      xtraeme  12449:               <p><span><strong class="command">cvs commit
                   12450:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  12451:             </li>
                   12452: 
                   12453:             <li>
1.14      xtraeme  12454:               <p><span><strong class="command">cvs commit -m
                   12455:               re-generate
                   12456:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  12457:             </li>
1.4       hubertf  12458: 
                   12459:             <li>
                   12460:               <p>Until the webserver on www.NetBSD.org is really
                   12461:               updated automatically to pick up changes to the
1.14      xtraeme  12462:               pkgsrc guide automatically, also run
1.18      xtraeme  12463:               <span><strong class="command">make install-htdocs
1.14      xtraeme  12464:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   12465:               similar, adjust <code class=
                   12466:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  12467:             </li>
                   12468: 
                   12469:             <li>
1.14      xtraeme  12470:               <p><span><strong class="command">cvs commit
                   12471:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  12472:             </li>
1.2       hubertf  12473:           </ul>
                   12474:         </div>
                   12475:       </div>
                   12476:     </div>
1.1       grant    12477:   </div>
                   12478: </body>
                   12479: </html>

CVSweb <webmaster@jp.NetBSD.org>